Bitcoin
Ready to call this in production?
Free tier covers personal projects. Pay-as-you-go scales without a card.
Bitcoin
Free tier covers personal projects. Pay-as-you-go scales without a card.
Bitcoin offers probabilistic, not instant, finality: a spend becomes harder to reverse with every block mined on top of it, because rewriting history would mean out-mining the network's proof-of-work from that point forward. The number of blocks stacked above a transaction — its confirmation count — is therefore the practical measure of how settled a payment is. Zero confirmations means the transaction is only in the mempool and could still be replaced or dropped; six confirmations means roughly an hour of accumulated work that no realistic attacker can undo. This guide gives developers a safe confirmation-counting flow against https://bitcoin.therpc.io/YOUR_API_KEY: how to read a transaction's confirmation count, how many to require for a given value, and how to notice when a chain reorganization pulls a confirmed transaction back into limbo.
confirmations field is derived from the tip. On a verbose getrawtransaction the node computes confirmations as the current chain height minus the height of the containing block, plus one. A transaction still in the mempool has no containing block, so the field is absent (treat it as zero), which is why the example code uses tx.confirmations || 0.getbestblockhash to watch the tip, and use getchaintips to spot competing branches with valid-fork or valid-headers status. After a tip change, re-check that your transaction's blockhash still belongs to the active chain; if it no longer does, the transaction was reorged out and must re-confirm.