RPC methods
Use the same Metal network for all reads and verify its chain ID against the network configured by your application.
See the JSON-RPC reference for request and
response formats.
Fields and encodings
These are the raw JSON-RPC encodings. SDKs may decode them into integers or named status values.
Decode
receipt.blockNumber from hex before comparing it numerically with
consensus_status.finalized.number. Compare hashes as bytes or consistently
formatted hex strings. The finalized head may have advanced beyond the receipt’s
block. Fetch the block at receipt.blockNumber and compare its hash with
receipt.blockHash to verify that the transaction belongs to the finalized
chain.
Finality check
Require all of the following for the transaction recording the payment result:- The receipt exists and its transaction hash matches the expected transaction.
receipt.statusis"0x1".- The receipt’s logs or contract state establish the expected payment result.
receipt.blockNumber <= consensus_status.finalized.number, after decoding both heights.eth_getBlockByNumber(receipt.blockNumber, false)returns a block whose hash equalsreceipt.blockHash.
null or an RPC request fails, keep verification
pending because the transaction may already have succeeded. Query its original
hash to resolve the outcome before creating a new payment transaction.
Block selectors
When checking contract state for a payment, read it at the verified receipt’s
block number. This ensures that the state you inspect corresponds to the block
recording the payment result.
Payment result checks
Each contract defines the events and state changes that establish its payment result. Use the evidence listed below to verify the intended transfer or hold outcome.
When verifying that evidence:
- Require successful execution and finality for the transaction recording the result
- Match logs to the expected contract and transaction
- Compare token amounts as integers in the token’s base units
- For payments with additional lifecycle steps, verify the final contract outcome required by the payment agreement
Verification outcomes
Use the observations below to decide whether to keep verification pending, record a failure, or complete the payment in your application.
For admission and execution failures, see Error Codes.
Reconciliation and duplicate processing
Save the application’s payment identifier and expected result with the signed transaction and its hash before broadcasting. If the submission response is lost, the saved hash lets you query the original transaction’s outcome and match it to the payment record. Once an event is verified, retain its chain ID, emitting contract, transaction hash, log index, block number, and block hash as the evidence for that payment. The chain ID, transaction hash, and log index together identify the event with a durable key:Independent finality verification
The RPC checks rely on the endpoint reporting chain state accurately. To verify finality independently:- Fetch the certificate and header using
metal_getFinalityCertificate(blockHash). - Verify the certificate against trusted network parameters and the validator set for its epoch.
- Check that the header hashes to the certified block hash.
null response means the node cannot provide the certificate. This can happen
before the certificate has been persisted or after it has been pruned, even for
a finalized block.
Verify and reconcile payments
Implement receipt, event, finality, and duplicate-processing checks.
Finality certificates
Verify finalized headers independently of the RPC endpoint.