Is there a library out there that handles the lifecycle of a transaction and ensures it up to a certain guarantee (1-12 confirmations, accepted, etc)?

How do developers handle this issue? It seems to be from reading some of the articles that there are many scenarios that can throw off a trx.

Thank you : )


With web3js you can broadcast a transaction and then use the .on('confirmation', function(confirmationNumber, receipt){ ... }) event (https://web3js.readthedocs.io/en/v1.2.11/web3-eth.html#sendtransaction) :

"confirmation" returns confirmationNumber: Number, receipt: Object, latestBlockHash: String: Fired for every confirmation up to the 12th confirmation. Receives the confirmation number as the first and the receipt as the second argument. Fired from confirmation 0 on, which is the block where it’s mined.

from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
value: '1000000000000000'
.on('confirmation', function(confirmationNumber, receipt){ 
console.log(receipt.status); //return true if the transaction succeeded, false if it was reverted by the EVM

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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