Looking for a way to understand success (or failure) for ethereum transaction.
When we execute a contract method (send transaction) we receive it hash. Transaction is added to the block, block is added into chain and waiting for to be mind. It should be mined on one node and on others, success of failure would be clear after consensus stage.
The question is what is the proper way to wait for status of the transaction.
Here is a research on this topic
Polling
How can a DApp detect a fork or chain reorganization using web3.js or additional libraries?
External lib
https://github.com/barkthins/ether-pudding/blob/master/index.js#L375
Consensus
What number of confirmations is considered secure in Ethereum?
(why they define 12 as a result of secure transaction? It should 51% of all nodes, isn't it?)
Usage of filter and why it is not right way to go
What's the proper way to wait for a transaction to be mined and get the results?
Waiting for a transaction to be confirmed
Best Answer
Made a npm module called await-transaction-mined for this specific problem.
It polls the blockchain every 500ms to check if the transaction has been mined. Once mined it returns the transaction receipt.