How many confirmations? Finality on Bitcoin, Ethereum, Tron
"Wait for N confirmations" is standard advice, and N has a different meaning on every chain. Before you write the payment logic, decide what you are protecting against: a temporary reorganisation or an attacker with resources.
Bitcoin: probabilistic
Bitcoin uses proof of work with a longest-chain rule. A block can be replaced if a competing chain with more work appears, and the probability drops exponentially with the number of blocks built on top of yours. The original whitepaper calculates it for an attacker with a given share of hash rate, and the six-confirmation convention (about an hour) is a widely used habit, not a protocol constant. Smaller amounts often accept fewer, and very large ones wait longer. Nothing on Bitcoin is ever absolutely final, only increasingly improbable to reverse.
Ethereum: slots, epochs and finality
Since the switch to proof of stake in September 2022, Ethereum time is divided into 12-second slots, and 32 slots make an epoch (6.4 minutes). Blocks are proposed one per slot when the proposer is online. Validators vote, and a block becomes finalized after two epochs of supermajority agreement, which normally takes about 12.8 minutes. Reversing a finalized block would require a large fraction of all staked ETH to be destroyed by slashing, so finality here is economic and stronger than the probabilistic kind.

JSON-RPC lets you ask for it directly: the block tags latest, safe and finalized return the head, a block considered very unlikely to be reorganised, and the last finalized block. Using finalized for crediting deposits is the conservative choice, and latest with a few blocks of depth is the fast one.
Tron
Tron produces a block every 3 seconds, and 27 elected Super Representatives take turns to produce them. A block is considered solidified (irreversible) once more than two thirds of them, 19 of 27, have built on top of it, which is about a minute in normal operation. Many Tron services therefore read from the solidified node endpoint and not the latest one. Details of the consensus rules are documented by the Tron project and the exact behaviour under stress is worth testing yourself.
Practical guidance
- Store the block hash and number next to every credited transaction. If a later check finds a different hash at that height, you have seen a reorg and you can reverse the credit.
- Do the confirmation check with a separate job that re-verifies pending deposits, not only once at first sight.
- Separate the "seen" state from the "credited" state in your data model: seen means in a block, credited means deep enough.
- Match the threshold to the risk. A donation and a high-value order do not need the same depth.
A payment system built on the assumption that one confirmation is final works until the first reorg, and then it works incorrectly and silently. A record of block hashes is cheap insurance.
Reading the tags directly from a node
The three JSON-RPC block tags mentioned above are worth seeing requested explicitly, since the difference between them is otherwise easy to leave abstract:
import json, urllib.request
def get_block(tag):
payload = {"jsonrpc": "2.0", "method": "eth_getBlockByNumber",
"params": [tag, False], "id": 1}
req = urllib.request.Request(RPC_URL, json.dumps(payload).encode(),
{"Content-Type": "application/json"})
return json.loads(urllib.request.urlopen(req).read())["result"]
for tag in ("latest", "safe", "finalized"):
block = get_block(tag)
print(tag, int(block["number"], 16))
Run against a live node, finalized will report a lower block number than latest, normally by roughly two epochs' worth of blocks under the timing described above, and safe sits somewhere between the two. A payment system that credits on latest and one that credits on finalized are making a deliberate, different trade-off between speed and the strength of the finality guarantee, and reading the actual numbers back from a node, rather than assuming a fixed block-count offset, is the reliable way to implement whichever choice you make, since the gap between the tags is defined by consensus timing, not by a constant you can hardcode.