Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendSignedTransaction function is not returning a receipt (after Istanbul) #3104

Closed
umurb-hydrogen opened this issue Oct 7, 2019 · 7 comments
Labels
1.x 1.0 related issues 2.x 2.0 related issues Needs Clarification Requires additional input

Comments

@umurb-hydrogen
Copy link

umurb-hydrogen commented Oct 7, 2019

Description

My code, which has been working fine on Ropsten Test Network is not working after the Istanbul hardfork.

Expected behavior

Calling await web3.eth.sendSignedTransaction(signedTx.rawTransaction) to return a receipt.

Actual behavior

Calling await web3.eth.sendSignedTransaction(signedTx.rawTransaction) does send out the transaction, but does not return the receipt nor resolve the promise.

Steps to reproduce the behavior

Try sending a signed transaction on Ropsten Test Network, and I think you'll be able to reproduce the issue.

Versions

  • web3.js: 1.2.1
  • nodejs: 10.15.3
  • ethereum node: Ropsten (Infura)
@umurb-hydrogen umurb-hydrogen changed the title sendSignedTransaction function is not returning a receipt sendSignedTransaction function is not returning a receipt (after Istanbul) Oct 7, 2019
@Aleione
Copy link

Aleione commented Oct 7, 2019

Same identical problem, i have already opened a issue on Infura Github page:
INFURA/infura#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.

@nivida nivida added 1.x 1.0 related issues 2.x 2.0 related issues Needs Clarification Requires additional input labels Oct 8, 2019
@cgewecke
Copy link
Collaborator

cgewecke commented Oct 8, 2019

@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 ethereumjs-tx@2.1.1

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

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.)

@Aleione
Copy link

Aleione commented Oct 8, 2019

I have solved my problem substituting
var transaction = new Tx(txData, {chain:'ropsten'})
with
var transaction = new Tx(txData, {chain:'ropsten', hardfork: 'istanbul'}).

Thanks

@umurb-hydrogen
Copy link
Author

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.

@cgewecke
Copy link
Collaborator

cgewecke commented Oct 8, 2019

@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.

@cgewecke cgewecke closed this as completed Oct 8, 2019
@timsabanov
Copy link

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.

@skliarovartem
Copy link

Stil can't call sendSignedTransaction on main net, no answer no timeout, nothing in response...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues 2.x 2.0 related issues Needs Clarification Requires additional input
Projects
None yet
Development

No branches or pull requests

6 participants