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

Hash returned but not broadcasting #1438

Closed
NormTheThird opened this issue Mar 8, 2018 · 10 comments
Closed

Hash returned but not broadcasting #1438

NormTheThird opened this issue Mar 8, 2018 · 10 comments
Assignees

Comments

@NormTheThird
Copy link

We are receiving a hash back from sendRawTransaction but the transaction is never broadcasting to the network or if it does it could take 24 hours. Is this normal? Should we be getting a hash back if it has not broadcasted yet?

nonce++;
var nonceHex = web3.toHex(nonce);
var valueAmount = web3.toHex(amounts[i] * tokenMultiplier);

data = contract.transfer.getData(addresses[i], valueAmount, {from: "0xd5c..."})
                    
var rawTx = {
    "from": "0xd5c...",
    "nonce": nonceHex,
    "gasPrice": gasPrice,
    "gasLimit": gasLimit,
     "to": contract.address,
     "value": "0x00",
      "data": data,
      "chainId": 0x01
}

var tx = new Tx(rawTx);
 tx.sign(privateKey);
var serializedTx = tx.serialize();
web3.eth.sendRawTransaction(`0x${serializedTx.toString('hex')}`, function (err, hash) {
    if (err)
        console.log(err);
    else
        console.log('Transaction hash: ' + hash);
}); 

Thanks

@jamboj
Copy link

jamboj commented Mar 9, 2018

Check if your nonce is too high?

@NormTheThird
Copy link
Author

I have checked that and its correct. We also started with a new wallet to see if that would help so the nonce would start at the beginning and that did not work either. Its been 17 hours and it has not broadcasted yet.

@cj-zeiger
Copy link

This is happening to me as well.

@kilmas
Copy link

kilmas commented Sep 2, 2018

This is happening to me as well.

@i-am-vivek
Copy link

This is happening to me as well. :(

@nivida
Copy link
Contributor

nivida commented Nov 28, 2018

@kilmas & @i-am-vivek could you provide a code example too?

@cj-zeiger
Copy link

I can add some additional information.

When I first started working with Web3.js I was ignorant to a lot of how Ethereum transactions worked. What was happening was my transaction was being broadcast but the node I was broadcasting to was not adding the transaction in the transaction pool. This can happen for a number of reasons:

  • Transaction pool of the node is full and the gas price is too small to take a spot in the pool
  • Node is handling too many transactions and one gets dropped
  • Other consequences of the non-deterministic nature of the Ethereum network.

In summary, none of these is caused by a bug with Web3.js.

My solution was writing a more robust version of what I was trying to accomplish and to monitor gas prices closely so that my transactions were not under gassed.

I'm not ruling out a possible bug with Web3.js, but because the three things I listed above are much more likely to be the cause of this occurring, I think @nivida would need a very detailed example to even start working on this.

@nivida
Copy link
Contributor

nivida commented Apr 16, 2019

@cj-zeiger Thanks!

@nivida nivida closed this as completed Apr 16, 2019
@i-am-vivek
Copy link

i-am-vivek commented Apr 16, 2019

Hey,
I don't know whether the problem was with my node which I had installed or web3. later I moved to ethers.js and got a free node from infura.io. And configured in ethers.js. it started working.

@nivida
Copy link
Contributor

nivida commented Apr 16, 2019

@i-am-vivek It was a problem of the node. Hopefully, you're coming back to the Web3.js library ;)
We have some cool new features like customizing of the transaction signing process, correct transaction confirmations, Realms implementation, Web3 Module API and way more. Check our documentation to get more details about :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants