Eth::Tx.new is incompatible with eip-155
After I have upgraded geth on production, I noticed that I cant send transaction anymore.
I call the method like that:
tx = Eth::Tx.new(
chainId: chain_id,
from: key.address,
nonce: nonce,
to: target,
value: value,
data: "",
gas_limit: DEFAULT_GAS_LIMIT,
gas_price: DEFAULT_GAS_PRICE
)
The signed raw transaction looks like this:
0xf86d8085051f4d5c00833d09009484bdc414abe39c40408b64353e0f16934bdc981e880157e7164e420000801ba074e8c2479dd5e899c7d3f2e52d9ac36984a4467cf54b2aea32b99547df7752daa07c3e83bc76d795c3ec1873b992f19bb862eb247f50d4fd34c6947336b638f505
{
"nonce": 0,
"gasPrice": 22000000000,
"gasLimit": 4000000,
"to": "0x84bdc414abe39c40408b64353e0f16934bdc981e",
"value": 96800000000000000,
"data": "",
"from": "0x63681d0a842b9e45ba7830065fb5d37ecaaa1e0c",
"r": "85610492e55ba1be1ed5003146e934b32d7ffdcf10e260dee5f191b4b76ef1ab",
"v": "1b",
"s": "542f4f6c8611eeb0dfee0f28c7cff9f938a182cb95328330bb1f45eecba8f63b"
}
As you can see is v : 0x1b which is wrong, as I understand regarding this specification : https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md#specification
It has to be 38 on the mainnet.
My current work around is to pass the --rpc.allow-unprotected-txs to geth but this will removed in the future.
Any Idea how to fix this ?
Hi, sorry for the late response, have you tried
Eth.configure do |config|
config.chain_id = 1 # nil by default, meaning valid on any chain
end
This will be fixed in https://github.com/q9f/eth.rb/pull/33
This is fixed in 0.5.0+