The one-sentence version
You confirm "Transfer 100 USDC to Alice" on the interface, and the wallet signs and broadcasts the transaction. But is the transaction on-chain truly the one you confirmed? Between the webpage, browser extension, and wallet software, if any link is tampered with, what gets signed might be a completely different transaction. The "Verify After Signing" approach is: once the transaction hash is obtained, read the transaction back from the chain and compare it field-by-field with your original intent. If there is a mismatch, immediately trigger an alert and lock the session. This is the application of the ancient engineering principle "read-after-write" to blockchain.
This article has three layers:
- Layer 1: The Intuition: Opening a sent letter to check it again
- Layer 2: Real-World Use: Databases, payment reconciliation, blockchain transactions
- Layer 3: Principles and engineering key points: which fields to compare, which differences are acceptable, and what to do when an inconsistency is found
Layer 1: The Intuition
1.1 Opening a sent letter to check it again
You ask a secretary to mail an important letter for you. The secretary seals it and sends it off. How do you know they sent exactly what you wrote?
If you could retrieve the sent letter from the post office to take a look, you could confirm it. Blockchain provides exactly this capability: all transactions are public, and anyone can read them using the transaction hash.
1.2 Why checking the interface before signing is not enough
| Link | Potential Issues |
|---|---|
| Webpage | Tampered with; displays Address A, but actually requests Address B in the wallet |
| Browser Extension | Malicious extension intercepts and modifies the wallet request |
| Wallet Software | Replaced by a malicious version |
| The User | Modifies parameters (e.g., gas fees) in the wallet popup, or clicks the wrong thing |
Verification before signing checks "what is displayed on the interface"; verification after signing checks "what is actually on-chain."
Layer 2: Real-World Use
- Databases: Performing a read-after-write after an important write operation to confirm that what was written is indeed what was intended, especially in systems with multiple replicas or eventual consistency.
- Payment Reconciliation: Banks and payment companies reconcile their books against clearinghouse records transaction by transaction every day, investigating discrepancies immediately. This is the financial industry's version of "verify after signing."
- Blockchain Wallets:
- After a transaction is broadcast, retrieve the transaction from the chain using the transaction hash and compare it field-by-field;
- Retrieve it using two independent nodes to prevent a single node from lying (see "Multi-source Cross-verification").
- Software Release: Re-download the artifact from the online server after release and compare the hashes (see "The Bybit Incident and Frontend Integrity").
Layer 3: Principles and Engineering
3.1 Which fields to compare
| Field | Must Match | Description |
|---|---|---|
from |
Yes | The sender's address |
to |
Yes | For ERC-20 transfers, this is the token contract address |
value |
Yes | The amount of ETH being sent |
input (calldata) |
Yes | For ERC-20 transfers, the actual recipient and amount encoding is here |
chainId |
Yes | Prevents signing for a different chain (see "Signature Login and Replay Protection") |
| Gas-related fields | Allowed to differ within a range | Wallets usually allow users to adjust fees |
Note item 4: During an ERC-20 transfer, to is the token contract, and the actual recipient is hidden inside the calldata. Comparing only to will miss the most critical tampering.
3.2 Which differences are acceptable
Wallets allow users to modify gas fees, so it is normal for maxFeePerGas, maxPriorityFeePerGas, and gasLimit to be inconsistent. However, an upper limit should be set: if the gas fee is modified to several times the intended amount, it should be treated as an anomaly (it could be an attack to "drain the balance via exorbitant fees," or simply user error, both of which warrant a warning).
3.3 What to do when an inconsistency is found
An inconsistency means at least one link in the signing chain is untrustworthy. You must act decisively:
- Immediately mark this intended transaction as an anomaly;
- End the current session and require re-authentication;
- Issue a high-priority alert through independent channels (email, in-app notification);
- Record it in the audit log (see "Hash Chain Audit Logs").
At this point, the transaction has likely already been put on-chain and cannot be recalled. The value of "verify after signing" is not in recovering this specific transaction, but in:
- Detecting a compromised link immediately to prevent the next transaction;
- Providing clear evidence for investigation.
3.4 Tracking the subsequent status of a transaction
After a transaction is broadcast, several other scenarios may occur, all of which must be tracked:
| Status | Description |
|---|---|
| On-chain | Read the receipt to confirm successful execution (no revert) |
| Not on-chain for a long time | The gas fee might be too low, or it may have been dropped |
| Replaced | Another transaction appears with the same nonce. This could be the user accelerating or canceling it, or someone else using a stolen private key to front-run |
"Replaced" is particularly alarming: if the user did not perform an acceleration or cancellation, and another transaction appears with the same nonce, it is almost certain that the private key has been leaked.
3.5 It is complementary to "verification before signing"
| Verification Before Signing | Verification After Signing | |
|---|---|---|
| Object of verification | Content displayed on the interface, simulation results | The actual transaction on-chain |
| Ability to prevent loss | Yes | Usually no (already on-chain) |
| Ability to detect tampering in the chain | No (the attacker controls the interface) | Yes |
Both are indispensable.
Summary
| Layer | Key points |
|---|---|
| Intuition | Opening a sent letter to check it again |
| Principle | read-after-write; reconciliation |
| Fields | from, to, value, input, chainId must match; gas has a tolerance with an upper limit |
| Value | Detecting a compromised chain, preventing the next transaction, leaving evidence |