TRAIT DataGate API
  1. Submit new transaction
TRAIT DataGate API
  • Intro
  • History
    • Blocks
      POST
    • Transactions
      POST
    • Events
      POST
  • State
    • Info of on-chain entities
      POST
    • Raw single values of blockchain storage
      POST
    • Raw collections of blockchain storage
      POST
  • Tokens
    • Balances of tokens
      POST
    • Transfers of tokens
      POST
  • Submit new transaction
    • Validate transfer of token TRAIT
      POST
    • Validate transfer of fungible tokens
      POST
    • Validate transfer of nft tokens
      POST
    • Validate clearing transaction of an AppAgent
      POST
    • Build info for new transaction
      POST
    • Submit transaction
      POST
    • Get transaction status
      POST
  1. Submit new transaction

Build info for new transaction

POST
https://api.trait.tech/tx/build_info
Submit new transaction
The endpoint provides all the required info to build and sign a new transaction.
This allows to create new transactions without connection to a blockchain node.

Request

Body Params application/json
Request params for the endpoint `/tx/build_info`.
context
object (BuildInfoContext) 
required
information about the transaction to be created.
tx_origin
string 
Tx Origin
required
Blockchain address that will sign the transaction.
>= 47 characters<= 49 characters
Match pattern:
^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{47,49}$
Example
{
    "context": {
        "tx_origin": "ttrENnXUfsdTDFwweKjK1dSvCXcAtVVQ9xgARy8iBisAFfc5e"
    }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.trait.tech/tx/build_info' \
--header 'Content-Type: application/json' \
--data-raw '{
    "context": {
        "tx_origin": "ttrENnXUfsdTDFwweKjK1dSvCXcAtVVQ9xgARy8iBisAFfc5e"
    }
}'

Responses

🟢200OK
application/json
Successful Response
Body
Response schema for the endpoint `/tx/build_info`.
metadata
object (ResponseMetadata) 
required
Metadata for the generated response.
request_context
object (ResponseBlockId) 
required
For the endpoints with historical data: the last block, the data from which is included in the response. For the endpoints with blockchain state data: the block whose state is provided in the response. Request context remains the same for all data pages in the series for the initial request.
blockchain_head
object (ResponseBlockId) 
required
The latest blockchain block currently available.
data
object (TxBuildInfo) 
required
Information to build a new blockchain transaction
tx_origin
string 
Tx Origin
required
Blockchain address.
>= 47 characters<= 49 characters
Match pattern:
^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{47,49}$
tx_origin_next_tx_index
integer 
Tx Origin Next Tx Index
required
Nonce (ordinal number) of the next transaction to be created by the blockchain address. This value doesn't take into account submitted to the network but not finalised transaction.
>= 0<= 4294967295
tx_origin_free_native_token_balance
integer 
Tx Origin Free Native Token Balance
required
Balance of TRAIT token.
>= 0<= 3.402823669209385e+38
chain_genesis_block_hash
string 
Chain Genesis Block Hash
required
Block hash.
>= 66 characters<= 66 characters
Match pattern:
^0x[0-9abcdefABCDEF]{64}$
chain_name
string 
Chain Name
required
Name of the blockchain.
>= 1 characters<= 50 characters
chain_ss58_format
integer 
Chain Ss58 Format
required
Identifier of the address type used to encode the blockchain address in SS58 format.
>= 0<= 16383
block_hash
string 
Block Hash
required
Hash of the latest finalised block.
>= 66 characters<= 66 characters
Match pattern:
^0x[0-9abcdefABCDEF]{64}$
block_index
integer 
Block Index
required
Index of the latest finalised block.
>= 0<= 4294967295
block_timestamp
integer 
Block Timestamp
required
Timestamp of the latest finalised block.
>= 0<= 18446744073709552000
runtime_spec_name
string 
Runtime Spec Name
required
The identifier for the current Substrate runtime.
>= 1 characters<= 50 characters
runtime_spec_version
integer 
Runtime Spec Version
required
The version of the runtime specification.
>= 0<= 4294967295
runtime_transaction_version
integer 
Runtime Transaction Version
required
The version of the interface for handling transactions.
>= 0<= 4294967295
runtime_metadata_raw
string 
Runtime Metadata Raw
required
HEX-encoded runtime metadata.
>= 18 characters
Match pattern:
^0x[0-9abcdefABCDEF]{16,}$
Example
{
    "metadata": {
        "request_context": {
            "block_hash": "0xab8006019066f080402ab43da043127b930ef0ffb3349a333222d67c0f542338",
            "block_index": 29702,
            "block_timestamp": 1727581488000
        },
        "blockchain_head": {
            "block_hash": "0xab8006019066f080402ab43da043127b930ef0ffb3349a333222d67c0f542338",
            "block_index": 29702,
            "block_timestamp": 1727581488000
        }
    },
    "data": {
        "tx_origin": "ttrENnXUfsdTDFwweKjK1dSvCXcAtVVQ9xgARy8iBisAFfc5e",
        "tx_origin_next_tx_index": 1,
        "tx_origin_free_native_token_balance": 1000000000000000000,
        "chain_genesis_block_hash": "0x806dec5d0216895474ef81e2c61dd0cd3e8bc2a7eabb1eb76cdf8e18ad2b49be",
        "chain_name": "Trait Asset Hub",
        "chain_ss58_format": 5335,
        "block_hash": "0xab8006019066f080402ab43da043127b930ef0ffb3349a333222d67c0f542338",
        "block_index": 29702,
        "block_timestamp": 1727581488000,
        "runtime_spec_name": "trait-asset-hub-runtime",
        "runtime_spec_version": 1000,
        "runtime_transaction_version": 1,
        "runtime_metadata_raw": "0x6d6574610e6d0800"
    }
}
🟠422Parameter Error
Modified at 2024-11-21 18:59:09
Previous
Validate clearing transaction of an AppAgent
Next
Submit transaction
Built with