Detecting Deposits
Find Incoming Receipts
Exchange can query finalized blocks and their new chunks, or consume a receipt stream from an indexer. Track incoming receipts across all shards: scanning only original transaction receivers misses deposits generated by contracts in later blocks. Inspect chunk receipts as well as transactions, and resolve receipt outcomes even when their original transactions were included earlier. For indexers and hosted data APIs, see Accessing On-chain Data.Verify Finalized Execution
For a known transaction, query status with receipts using named parameterstx_hash, sender_account_id, and wait_until: "FINAL". Require final_execution_status === "FINAL". An indexer must independently establish finality of each receipt’s outcome block.
For each receipt addressed to an exchange-controlled account, match receipt_id to receipts_outcome[].id and verify that outcome.executor_id matches the receiver. A successful receipt has SuccessValue or SuccessReceiptId, not Failure or Unknown.
Identify Deposit Amounts
Inspect everyTransfer action, including those in mixed-action receipts. Record the deposit amount and action index; review key changes, contract deployment, or deletion in the same receipt before accepting it under your custody policy.
Receipts with predecessor_id: "system" are refunds or system payouts; reconcile them separately rather than crediting a new customer deposit. NEAR attached to a FunctionCall needs an approved exchange-contract interface that authenticates the customer and accounts for accepted funds, forwarding, and refunds. Do not infer a deposit solely from the attached amount.
Direct Transfer Example
This testnet transaction transfers 2 NEAR frominfluencer.testnet to linkdrop.primitives.testnet. Query its finalized receipt details:
Transfer.deposit is 2000000000000000000000000 yoctoNEAR (2 NEAR). If the receiver is a customer-assigned account you control, record that movement once using its receipt ID and action index (0 here). The receiver’s balance after this transfer is shown in Balances & Reconciliation.
Transfer from Function Call
NEAR allows transfers to happen within a function call. More importantly, when an account is deployed with some contract, it is possible that the only way to transfer tokens from that account is through a function call. Therefore, exchanges need to support transfers through function calls as well. The lockup and multisig examples below show how contract calls generate transfer receipts and how to inspect their execution outcomes.Example of transfer from a lockup contract
A contractevgeny.lockup.near is deployed and we can check its owner by
Example RPC response
Example RPC response
receipts field this object
Transfer action and whose predecessor_id is not system. Now we can check the status of the
execution by looking for the same receipt id EvHfj4fUyVuLBRKNdCZmFGr4WfqwYf7YCbzFsRGFTFJC in receipts_outcome field
of the rpc return result, this leads us to this execution outcome
SuccessValue, which indicates that the receipt has succeeded. Therefore we know that
1000000000000000000000000 yoctoNEAR, or 1 NEAR has been successfully transferred.
Example of transfer from a multisig contract
Multisig contract, as the name suggests, uses multiple signatures to confirm a transaction and therefore, actions performed by the multisig contract involve multiple transactions. In the following example, we will show how a transfer is done from a multisig contract that requires two confirmations.- First step:
add_request_and_confirm. This initiates the action that the multisig contract wants to perform with one confirmation. The multisig contractmultisigtest.testnetwants to transfer 1 NEAR tobowenand it first sends a transaction that callsadd_request_and_confirmwith a request
bowen. Notice that this transaction only records the action
but does not perform the actual transfer. The transaction result is as follows:
Example RPC response
Example RPC response
- Second step:
confirm. A second transaction is sent to confirm the transfer. This transaction takes the request id returned by the first transaction and does the actual transfer. The transaction result is as follows
Example RPC response
Example RPC response
receipts field that meet
our requirements:
receipts_outcome: