Quick Reference
| Method | Parameters | Description |
|---|---|---|
send_tx | signed_tx_base64, wait_until | Send a transaction and optionally wait for execution |
tx | tx_hash, sender_account_id, wait_until | Query transaction status by hash |
EXPERIMENTAL_tx_status | tx_hash, sender_account_id, wait_until | Query transaction status with receipt details |
EXPERIMENTAL_receipt | receipt_id | Fetch receipt by ID |
broadcast_tx_async | signed_tx_base64 | (Deprecated) Send transaction asynchronously |
broadcast_tx_commit | signed_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.send_txSignedTransaction encoded in base64
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.Transaction Status
Queries status of a transaction by hash and returns the final transaction result.txTransaction hash (see NearBlocks Explorer for valid hashes)
Used to determine which shard to query for transaction
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.Transaction Status with Receipts
Queries status of a transaction by hash, returning the final transaction result and details of all receipts.EXPERIMENTAL_tx_statusTransaction hash
Used to determine which shard to query for transaction
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).EXPERIMENTAL_receiptReceipt ID (see NearBlocks Explorer for valid receipt IDs)
Transaction Execution Levels
All the methods listed above havewait_until request parameter, and final_execution_status response value. They correspond to the same enum TxExecutionStatus. See the detailed explanation for all the options:
Deprecated methods
[deprecated] Send transaction (async)
Sends a transaction and immediately returns transaction hash.broadcast_tx_async[SignedTransaction encoded in base64][deprecated] Send transaction (await)
Sends a transaction and waits until transaction is fully complete. (Has a 10 second timeout)broadcast_tx_commit[SignedTransaction encoded in base64]Error Handling
Common Error Types
| Error Code | Description | Solution |
|---|---|---|
UnknownTransaction | Transaction not found | Verify transaction hash and sender account |
TimeoutError | Transaction timeout | Use appropriate wait_until parameter or retry |
InvalidTransaction | Invalid transaction format | Check transaction structure and signature |
InvalidAccount | Invalid account format | Use valid account ID format (e.g., account.near) |
InsufficientStake | Not enough stake for operation | Ensure account has sufficient NEAR tokens |
MethodNotFound | Invalid method name | Check method spelling and API version |
ParseError | JSON parsing error | Verify JSON format and structure |
ServerError | Internal server error | Retry 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 scenariosINCLUDED: When you need confirmation the transaction is in a blockEXECUTED_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