I am using a web3 sendTransaction function to send coins, and then storing the transactionHash in my databse

await web3SendInstance.eth.sendTransaction({to:receiveAddress, from:web3.eth.defaultAccount, value:amount, chainId:chainid, gas:21000, gasPrice:currentGasPrice, txHash:txHash,})
            .on('transactionHash', function(hash){


The problem is that sometimes these transactions get dropped and never mined, and so the hash that is returned is irrelevant.

How do I check that the txhash doesn't get dropped, and why is it sometimes dropped?

  • What was the error? be clear please there too many reasons a transaction (sendTransaction) has an error. Also what is txHash? Have you tried to use only: from, to, and value parameters.
    – anwar
    Commented Sep 22, 2021 at 4:37
  • I didn't say it threw an error, I said that the transaction hash becomes irrelevant. There are no errors, I get returned a hash from the .on() function but that hash sometimes isn't a hash that links to any transaction on etherscan Commented Sep 22, 2021 at 11:21

1 Answer 1


I didn't see any issue here, I removed the txHash:txHash,. Interesting was your transaction on testnet or mainnet?

truffle(develop)> await web3.eth.sendTransaction({to:'0x765659e499cb2cd7ba3c8eb7a114636032be208b', from:'0xde9155dcb95c66f57d6678845931d0db2ffeeb4a', value:'1000', chainId:'1337', gas:'21000', gasPrice:'20000000000'}).on('transactionHash', function(hash){console.log('hash', hash)})
hash 0x561c11132a68dd67c7bcfae13e8cfa9981d7264583175e215c962ffbcdd2b422
  transactionHash: '0x561c11132a68dd67c7bcfae13e8cfa9981d7264583175e215c962ffbcdd2b422',
  transactionIndex: 0,
  blockHash: '0x06cae82646744772b661b8c5aa63b53b6e6e04ec73fcd919ba3f4ebc836a4a0b',
  blockNumber: 3,
  from: '0xde9155dcb95c66f57d6678845931d0db2ffeeb4a',
  to: '0x765659e499cb2cd7ba3c8eb7a114636032be208b',
  gasUsed: 21000,
  cumulativeGasUsed: 21000,
  contractAddress: null,
  logs: [],
  status: true,
  logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
truffle(develop)> debug 0x561c11132a68dd67c7bcfae13e8cfa9981d7264583175e215c962ffbcdd2b422
Starting Truffle Debugger...

Addresses affected:

Warning: The source code for one or more contracts could not be found.
Warning: this transaction has no trace steps. This may happen if you are attempting to debug a transaction sent to an externally-owned account, or if the node you are connecting to failed to produce a trace for some reason. Please check your configuration and try again.

(enter) last command entered (step next)
(o) step over, (i) step into, (u) step out, (n) step next
(c) continue until breakpoint
(;) step instruction (include number to step multiple)
(g) turn on generated sources, (G) turn off generated sources except via `;`
(p) print instruction & state (`p [mem|cal|sto]*`; see docs for more)
(l) print additional source context, (s) print stacktrace, (h) print this help
(q) quit, (r) reset, (t) load new transaction, (T) unload transaction
(b) add breakpoint (`b [[<source-file>:]<line-number>]`; see docs for more)
(B) remove breakpoint (similar to adding, or `B all` to remove all)
(+) add watch expression (`+:<expr>`), (-) remove watch expression (-:<expr>)
(?) list existing watch expressions and breakpoints
(v) print variables and values, (:) evaluate expression - see `v`

debug(develop:0x561c1113...)> i

Transaction completed successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.