Transaction
RPC Endpoints
The RPC API enables you to send transactions and query their status.
Send transaction​
Sends transaction. Returns the guaranteed execution status and the results the blockchain can provide at the moment.
method:
send_tx
params:
signed_tx_base64
: SignedTransaction encoded in base64[Optional]
wait_until
: the required minimal execution level. Read more here. The default value isEXECUTED_OPTIMISTIC
.
Using send_tx
with wait_until = NONE
is equal to legacy broadcast_tx_async
method.
Using send_tx
with finality wait_until = EXECUTED_OPTIMISTIC
is equal to legacy broadcast_tx_commit
method.
Example:
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "send_tx",
"params": {
"signed_tx_base64": "DgAAAHNlbmRlci50ZXN0bmV0AOrmAai64SZOv9e/naX4W15pJx0GAap35wTT1T/DwcbbDwAAAAAAAAAQAAAAcmVjZWl2ZXIudGVzdG5ldNMnL7URB1cxPOu3G8jTqlEwlcasagIbKlAJlF5ywVFLAQAAAAMAAACh7czOG8LTAAAAAAAAAGQcOG03xVSFQFjoagOb4NBBqWhERnnz45LY4+52JgZhm1iQKz7qAdPByrGFDQhQ2Mfga8RlbysuQ8D8LlA6bQE=",
"wait_until": "INCLUDED_FINAL"
}
}
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by broadcast_tx_commit
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
INVALID_TRANSACTION
An error happened during transaction execution
See
error.cause.info
for details
TIMEOUT_ERROR
Transaction was routed, but has not been recorded on chain in 10 seconds.
Re-submit the request with the identical transaction (in ABOGIDA Protocol unique transactions apply exactly once, so if the previously sent transaction gets applied, this request will just return the known result, otherwise, it will route the transaction to the chain once again)
Check that your transaction is valid
Check that the signer account id has enough tokens to cover the transaction fees (keep in mind that some tokens on each account are locked to cover the storage cost)
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
Transaction Status​
Queries status of a transaction by hash and returns the final transaction result.
method:
tx
params:
tx_hash
(see ABOGIDABlocks Explorer for a valid transaction hash)sender_account_id
(used to determine which shard to query for transaction)[Optional]
wait_until
: the required minimal execution level. Read more here. The default value isEXECUTED_OPTIMISTIC
.
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.
Example:
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "tx",
"params": {
"tx_hash": "6zgh2u9DqHHiXzdy9ouTP7oGky2T4nugqzqt9wJZwNFm",
"sender_account_id": "sender.testnet",
"wait_until": "EXECUTED"
}
}
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by tx
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
INVALID_TRANSACTION
An error happened during transaction execution
See
error.cause.info
for details
UNKNOWN_TRANSACTION
The requested transaction is not available on the node since it might have not been recorded on the chain yet or has been garbage-collected
Try again later
If the transaction had been submitted more than 5 epochs ago, try to send your request to an archival node
Check the transaction hash
TIMEOUT_ERROR
It was unable to wait for the transaction status for reasonable time
Send a request to a different node
Try again later
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
Transaction Status with Receipts​
Queries status of a transaction by hash, returning the final transaction result and details of all receipts.
method:
EXPERIMENTAL_tx_status
params:
tx_hash
(see ABOGIDABlocks Explorer for a valid transaction hash)sender_account_id
(used to determine which shard to query for transaction)[Optional]
wait_until
: the required minimal execution level. Read more here. The default value isEXECUTED_OPTIMISTIC
.
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.
Example:
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "EXPERIMENTAL_tx_status",
"params": {
"tx_hash": "HEgnVQZfs9uJzrqTob4g2Xmebqodq9waZvApSkrbcAhd",
"sender_account_id": "bowen",
"wait_until": "EXECUTED"
}
}
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by EXPERIMENTAL_tx_status
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
INVALID_TRANSACTION
An error happened during transaction execution
See
error.cause.info
for details
UNKNOWN_TRANSACTION
The requested transaction is not available on the node since it might have not been recorded on the chain yet or has been garbage-collected
Try again later
If the transaction had been submitted more than 5 epochs ago, try to send your request to an archival node
Check the transaction hash
TIMEOUT_ERROR
It was unable to wait for the transaction status for reasonable time
Send a request to a different node
Try again later
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
Receipt by ID​
Fetches a receipt by it's ID (as is, without a status or execution outcome)
method:
EXPERIMENTAL_receipt
params:
receipt_id
(see ABOGIDABlocks Explorer for a valid receipt id)
Example:
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "EXPERIMENTAL_receipt",
"params": { "receipt_id": "2EbembRPJhREPtmHCrGv3Xtdm3xoc5BMVYHm3b2kjvMY" }
}
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by EXPERIMENTAL_receipt
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
UNKNOWN_RECEIPT
The receipt with the given receipt_id
was never observed on the node
Check the provided
receipt_id
is correctSend a request on a different node
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
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:
broadcast_tx_async
params: [SignedTransaction encoded in base64]
Example:
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "broadcast_tx_async",
"params": [
"DgAAAHNlbmRlci50ZXN0bmV0AOrmAai64SZOv9e/naX4W15pJx0GAap35wTT1T/DwcbbDwAAAAAAAAAQAAAAcmVjZWl2ZXIudGVzdG5ldNMnL7URB1cxPOu3G8jTqlEwlcasagIbKlAJlF5ywVFLAQAAAAMAAACh7czOG8LTAAAAAAAAAGQcOG03xVSFQFjoagOb4NBBqWhERnnz45LY4+52JgZhm1iQKz7qAdPByrGFDQhQ2Mfga8RlbysuQ8D8LlA6bQE="
]
}
Example response:
{
"jsonrpc": "2.0",
"result": "6zgh2u9DqHHiXzdy9ouTP7oGky2T4nugqzqt9wJZwNFm",
"id": "dontcare"
}
Final transaction results can be queried using Transaction Status or AbogidaBlocks Explorer using the above result
hash returning a result similar to the example below.
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by broadcast_tx_async
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
[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:
broadcast_tx_commit
params:
[SignedTransaction encoded in base64]
Example:
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "broadcast_tx_commit",
"params": [
"DgAAAHNlbmRlci50ZXN0bmV0AOrmAai64SZOv9e/naX4W15pJx0GAap35wTT1T/DwcbbDQAAAAAAAAAQAAAAcmVjZWl2ZXIudGVzdG5ldIODI4YfV/QS++blXpQYT+bOsRblTRW4f547y/LkvMQ9AQAAAAMAAACh7czOG8LTAAAAAAAAAAXcaTJzu9GviPT7AD4mNJGY79jxTrjFLoyPBiLGHgBi8JK1AnhK8QknJ1ourxlvOYJA2xEZE8UR24THmSJcLQw="
]
}
What could go wrong?​
When API request fails, RPC server returns a structured error response with a limited number of well-defined error variants, so client code can exhaustively handle all the possible error cases. Our JSON-RPC errors follow verror convention for structuring the error response:
{
"error": {
"name": <ERROR_TYPE>,
"cause": {
"info": {..},
"name": <ERROR_CAUSE>
},
"code": -32000,
"data": String,
"message": "Server error",
},
"id": "dontcare",
"jsonrpc": "2.0"
}
Heads up
The fields
code
,data
, andmessage
in the structure above are considered legacy ones and might be deprecated in the future. Please, don't rely on them.
Here is the exhaustive list of the error variants that can be returned by broadcast_tx_commit
method:
ERROR_TYPE
error.name
ERROR_CAUSE
error.cause.name
Reason
Solution
HANDLER_ERROR
INVALID_TRANSACTION
An error happened during transaction execution
See
error.cause.info
for details
TIMEOUT_ERROR
Transaction was routed, but has not been recorded on chain in 10 seconds.
Re-submit the request with the identical transaction (in ABOGIDA Protocol unique transactions apply exactly once, so if the previously sent transaction gets applied, this request will just return the known result, otherwise, it will route the transaction to the chain once again)
Check that your transaction is valid
Check that the signer account id has enough tokens to cover the transaction fees (keep in mind that some tokens on each account are locked to cover the storage cost)
REQUEST_VALIDATION_ERROR
PARSE_ERROR
Passed arguments can't be parsed by JSON RPC server (missing arguments, wrong format, etc.)
Check the arguments passed and pass the correct ones
Check
error.cause.info
for more details
INTERNAL_ERROR
INTERNAL_ERROR
Something went wrong with the node itself or overloaded
Try again later
Send a request to a different node
Check
error.cause.info
for more details
Last updated