BlockPI Network
Search
⌃K
Comment on page

Submit batch transactions

​

This allows you to submit multiple transactions. The response has three outcomes:
  1. 1.
    All transactions succeed, and it will return a 202
  2. 2.
    Some transactions succeed, and it will return the failed transactions and a 206
  3. 3.
    No transactions succeed, and it will also return the failed transactions and a 206
To submit a transaction as JSON, you must submit a SubmitTransactionRequest. To build this request, do the following:
  1. 1.
    Encode the transaction as BCS. If you are using a language that has
native BCS support, make sure to use that library. If not, you may take advantage of /transactions/encode_submission. When using this endpoint, make sure you trust the node you're talking to, as it is possible they could manipulate your request. 2. Sign the encoded transaction and use it to create a TransactionSignature. 3. Submit the request. Make sure to use the "application/json" Content-Type.
To submit a transaction as BCS, you must submit a SignedTransaction encoded as BCS. See SignedTransaction in types/src/transaction/mod.rs. Make sure to use the application/x.aptos.signed_transaction+bcs Content-Type.

Request Body:

array of
sender string<hex> required
A hex encoded 32 byte Aptos account address.
sequence_number string<uint64> required
A string containing a 64-bit unsigned integer.
max_gas_amount string<uint64> required
A string containing a 64-bit unsigned integer.
gas_unit_price string<uint64> required
A string containing a 64-bit unsigned integer.
expiration_timestamp_secs string<uint64> required
A string containing a 64-bit unsigned integer.
payload object required
Payload which runs a single entry function, or
Payload which runs a script that can run multiple functions, or
An enum of the possible transaction payloads
signature object required
A single Ed25519 signature, or
A Ed25519 multi-sig signature, or
Multi agent signature for multi agent transactions

Response Header:

X-APTOS-BLOCK-HEIGHT integer
Current block height of the chain
X-APTOS-CHAIN-ID integer
Chain ID of the current chain
X-APTOS-EPOCH integer
Current epoch of the chain
X-APTOS-LEDGER-OLDEST-VERSION integer
Oldest non-pruned ledger version of the chain
X-APTOS-LEDGER-TIMESTAMPUSEC integer
Current timestamp of the chain
X-APTOS-LEDGER-VERSION integer
Current ledger version of the chain
X-APTOS-OLDEST-BLOCK-HEIGHT integer
Oldest non-pruned block height of the chain

Response Body:

Batch transaction submission result
Tells which transactions failed
transaction_failures array[object] required
Summary of the failed transactions
error object required
This is the generic struct we use for all API errors, it contains a string message and an Aptos API specific error code.
transaction_index integer required
The index of which transaction failed, same as submission order

Example:

// Request
curl -X POST -H 'Content-Type: application/json' https://aptos.blockpi.network/aptos/v1/your_api_key/v1/transactions/batch
--data
'[
{
"sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
"sequence_number": "32425224034",
"max_gas_amount": "32425224034",
"gas_unit_price": "32425224034",
"expiration_timestamp_secs": "32425224034",
"payload": {
"type": "entry_function_payload",
"function": "0x1::aptos_coin::transfer",
"type_arguments": [
"string"
],
"arguments": [
null
]
},
"signature": {
"type": "ed25519_signature",
"public_key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
"signature": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 "
}
}
]'
​
// Result
{
​
}