Skip to main content
The RPC API enables you to send transactions and query their status on the NEAR blockchain. This includes sending new transactions, checking transaction status, retrieving receipts, and monitoring transaction execution.

Quick Reference

MethodParametersDescription
send_txsigned_tx_base64, wait_untilSend a transaction and optionally wait for execution
txtx_hash, sender_account_id, wait_untilQuery transaction status by hash
EXPERIMENTAL_tx_statustx_hash, sender_account_id, wait_untilQuery transaction status with receipt details
EXPERIMENTAL_receiptreceipt_idFetch receipt by ID
broadcast_tx_asyncsigned_tx_base64(Deprecated) Send transaction asynchronously
broadcast_tx_commitsigned_tx_base64(Deprecated) Send transaction and wait for completion

Send transaction

Sends transaction. Returns the guaranteed execution status and the results the blockchain can provide at the moment.
method
string
required
send_tx
signed_tx_base64
string
required
SignedTransaction encoded in base64
wait_until
string
The required minimal execution level. Default value is EXECUTED_OPTIMISTIC. Read more here.
Using send_tx with wait_until = NONE is equal to legacy broadcast_tx_async method. Using send_tx with wait_until = EXECUTED_OPTIMISTIC is equal to legacy broadcast_tx_commit method.
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "send_tx",
  "params": {
    "signed_tx_base64": "DgAAAHNlbmRlci50ZXN0bmV0AOrmAai64SZOv9e/naX4W15pJx0GAap35wTT1T/DwcbbDwAAAAAAAAAQAAAAcmVjZWl2ZXIudGVzdG5ldNMnL7URB1cxPOu3G8jTqlEwlcasagIbKlAJlF5ywVFLAQAAAAMAAACh7czOG8LTAAAAAAAAAGQcOG03xVSFQFjoagOb4NBBqWhERnnz45LY4+52JgZhm1iQKz7qAdPByrGFDQhQ2Mfga8RlbysuQ8D8LlA6bQE=",
    "wait_until": "INCLUDED_FINAL"
  }
}

Transaction Status

Queries status of a transaction by hash and returns the final transaction result.
method
string
required
tx
tx_hash
string
required
Transaction hash (see NearBlocks Explorer for valid hashes)
sender_account_id
string
required
Used to determine which shard to query for transaction
wait_until
string
The required minimal execution level. Default is EXECUTED_OPTIMISTIC. Read more here.
A Transaction status request with wait_until != NONE will wait until the transaction appears on the blockchain. If the transaction does not exist, the method will wait until the timeout is reached. If you only need to check whether the transaction exists, use wait_until = NONE, it will return the response immediately.
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "tx",
  "params": {
    "tx_hash": "7AfonAhbK4ZbdBU9VPcQdrTZVZBXE25HmZAMEABs9To1",
    "sender_account_id": "rpc-examples.testnet",
    "wait_until": "FINAL"
  }
}

Transaction Status with Receipts

Queries status of a transaction by hash, returning the final transaction result and details of all receipts.
method
string
required
EXPERIMENTAL_tx_status
tx_hash
string
required
Transaction hash
sender_account_id
string
required
Used to determine which shard to query for transaction
wait_until
string
The required minimal execution level. Default is EXECUTED_OPTIMISTIC.

Receipt by ID

Fetches a receipt by its ID (as is, without a status or execution outcome).
method
string
required
EXPERIMENTAL_receipt
receipt_id
string
required
Receipt ID (see NearBlocks Explorer for valid receipt IDs)
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "EXPERIMENTAL_receipt",
  "params": {
    "receipt_id": "23r1wWsMAVtZysr9wNV6TCSdZTUyPbhBZ3McJ6zStpaE"
  }
}

Transaction Execution Levels

All the methods listed above have wait_until request parameter, and final_execution_status response value. They correspond to the same enum TxExecutionStatus. See the detailed explanation for all the options:
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum TxExecutionStatus {
  /// Transaction is waiting to be included into the block
  None,
  /// Transaction is included into the block. The block may be not finalized yet
  Included,
  /// Transaction is included into the block +
  /// All non-refund transaction receipts finished their execution.
  /// The corresponding blocks for tx and each receipt may be not finalized yet
  #[default]
  ExecutedOptimistic,
  /// Transaction is included into finalized block
  IncludedFinal,
  /// Transaction is included into finalized block +
  /// All non-refund transaction receipts finished their execution.
  /// The corresponding blocks for each receipt may be not finalized yet
  Executed,
  /// Transaction is included into finalized block +
  /// Execution of all transaction receipts is finalized, including refund receipts
  Final,
}

Deprecated methods

[deprecated] Send transaction (async)

Consider using send_tx instead.
Sends a transaction and immediately returns transaction hash.
method
string
required
broadcast_tx_async
params
array
required
[SignedTransaction encoded in base64]

[deprecated] Send transaction (await)

Consider using send_tx instead.
Sends a transaction and waits until transaction is fully complete. (Has a 10 second timeout)
method
string
required
broadcast_tx_commit
params
array
required
[SignedTransaction encoded in base64]

Error Handling

Common Error Types

Error CodeDescriptionSolution
UnknownTransactionTransaction not foundVerify transaction hash and sender account
TimeoutErrorTransaction timeoutUse appropriate wait_until parameter or retry
InvalidTransactionInvalid transaction formatCheck transaction structure and signature
InvalidAccountInvalid account formatUse valid account ID format (e.g., account.near)
InsufficientStakeNot enough stake for operationEnsure account has sufficient NEAR tokens
MethodNotFoundInvalid method nameCheck method spelling and API version
ParseErrorJSON parsing errorVerify JSON format and structure
ServerErrorInternal server errorRetry request or use different RPC endpoint

Best Practices

  • Use appropriate wait_until levels: Choose the right execution level based on your requirements
    • NONE: For fire-and-forget scenarios
    • INCLUDED: When you need confirmation the transaction is in a block
    • EXECUTED_OPTIMISTIC: For most use cases (default)
    • FINAL: When you need absolute finality guarantees
  • Handle timeouts gracefully: Implement proper timeout handling and retry logic
  • Monitor gas usage: Track gas consumption to optimize transaction costs
  • Batch operations: When possible, batch multiple actions in a single transaction

Build docs developers (and LLMs) love