My code, which has been working fine on Ropsten Test Network is not working after the Istanbul hardfork.
Calling await web3.eth.sendSignedTransaction(signedTx.rawTransaction) to return a receipt.
Calling await web3.eth.sendSignedTransaction(signedTx.rawTransaction) does send out the transaction, but does not return the receipt nor resolve the promise.
Try sending a signed transaction on Ropsten Test Network, and I think you'll be able to reproduce the issue.
Same identical problem, i have already opened a issue on Infura Github page:
https://github.com/INFURA/infura/issues/190
Before Istanbul on ropsten all ok, now sendSignedTransaction never solves promise. Try to change different web3 versions and situation does not change.
I am using Infura, i don't know if the problem show up also running a local full node.
@umurb-hydrogen Have not been able to reproduce this. Could you look at the example below and identify any differences between what you've been doing and a tx which executed successfully?
NB: Signing with [email protected]
const Transaction = require('ethereumjs-tx').Transaction;
const account1 = "0xAcb3e9205229D212Db914a92C77856b228B0a4E4";
const account2 = "0x458B8Adf2248709cf739149fE4BAb0B20101c4A1";
const txCount = await web3.eth.getTransactionCount(account1)
// Transaction
const txObject = {
nonce: web3.utils.toHex(txCount),
to: account2,
value: web3.utils.toHex(web3.utils.toWei('0.1', 'ether')),
gasLimit: web3.utils.toHex(21000),
gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei'))
}
// Sign the transaction
const tx = new Transaction(txObject, { chain: 'ropsten', hardfork: 'istanbul' })
const pk = Buffer.from(PRIVATE_KEY_ACCOUNT_1, 'hex')
tx.sign(pk)
const serializedTx = tx.serialize()
const raw = '0x' + serializedTx.toString('hex')
// Broadcast the transaction
const receipt = await web3.eth.sendSignedTransaction(raw)
Receipt
{
"blockHash": "0xdbb365914fd57cfc08657eed1a843a619d51651b233d3b45648ca5658e54f14f",
"blockNumber": 6527760,
"contractAddress": null,
"cumulativeGasUsed": 7643463,
"from": "0xacb3e9205229d212db914a92c77856b228b0a4e4",
"gasUsed": 21000,
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": true,
"to": "0x458b8adf2248709cf739149fe4bab0b20101c4a1",
"transactionHash": "0xb909b8f4074f45f067125348eb1cf71a197149dc03a37446dacd4a925963ff47",
"transactionIndex": 70
}
Ropsten Etherscan
[EDIT - Apologies, looked more carefully at your initial report - you're using accounts.sign? Will investigate this but suspect it will require a fix currently pending as part of #3070. Signing with ethereumjs-tx as above is a work-around.)
I have solved my problem substituting
var transaction = new Tx(txData, {chain:'ropsten'})
with
var transaction = new Tx(txData, {chain:'ropsten', hardfork: 'istanbul'}).
Thanks
Thanks for sharing the solution! Adding the hardfork information did solve the issue.
Another thing to note is that my original code (without the hardfork information) is also working at the moment. I am not sure what changed, but all is good.
I think we can close this issue.
@umurb-hydrogen
Another thing to note is that my original code (without the hardfork information) is also working at the moment. I am not sure what changed, but all is good.
Ah interesting! Perhaps the network was having some problems...
This is also being tracked in #3070 (under "transaction signing"). Closing.
Looks like it has been resolved now.
One additional thing to notice: if you are using web3 sendSignedTransaction function with infura nodes, promise is actually never resolved if nonce is too high.
Most helpful comment
@umurb-hydrogen Have not been able to reproduce this. Could you look at the example below and identify any differences between what you've been doing and a tx which executed successfully?
NB: Signing with
[email protected]Receipt
Ropsten Etherscan
link to tx
[EDIT - Apologies, looked more carefully at your initial report - you're using accounts.sign? Will investigate this but suspect it will require a fix currently pending as part of #3070. Signing with ethereumjs-tx as above is a work-around.)