Say we want to confirm that a value transaction tx
has reached certain finality, which we define as waiting for 12 block confirmations. We do this to drop the probability of tx
getting lost due a fork or it getting included in an uncle block.
The examples I've seen use getBlock
and/or getTransaction
first to make sure tx
was mined in a block.
They then wait until 12 new blocks have been mined and seem to use getTransactionReceipt
to check if tx
is still in the blockchain.
Is there some functional difference in this context between using
getTransaction
andgetTransactionReceipt
to check iftx
still hasblockNumber
? The implementations don't seem to use any of the additional data returned bygetTransactionReceipt
making it slightly confusing.Lets say a fork happened or
tx
got into an orphaned block before 12 confirmations. Does this mean thatgetTransaction
andgetTransactionReceipt
will return null for the transaction or how is this reflected in these calls?