TRAIT DataGate API
  1. State
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. State

Raw single values of blockchain storage

POST
https://api.trait.tech/state/storage_value
State
The endpoint provides raw values of blockchain state used by internal logic of the blockchain.

Request

Body Params application/json
Request params for the endpoint `/state/storage_value`.
block
Block
optional
ID of the block for which the blockchain state will be provided.
Any of
Block hash.
>= 66 characters<= 66 characters
Default:
blockchain_head
Match pattern:
^0x[0-9abcdefABCDEF]{64}$
storage
Storage
required
Any of
Filter by the name of storage value.
module_name
string 
Module Name
required
Name of the module of blockchain business logic.
>= 1 characters<= 50 characters
Match pattern:
^[a-zA-Z0-9_]{1,50}$
storage_name
string 
Storage Name
required
Name of the blockchain state storage.
>= 1 characters<= 50 characters
Example
{
    "block": "blockchain_head",
    "storage": [
        {
            "module_name": "System",
            "storage_name": "Number"
        }
    ]
}

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/state/storage_value' \
--header 'Content-Type: application/json' \
--data-raw '{
    "block": "blockchain_head",
    "storage": [
        {
            "module_name": "System",
            "storage_name": "Number"
        }
    ]
}'

Responses

🟢200OK
application/json
Successful Response
Body
Response schema for the endpoint `/state/storage_value`.
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
array[object (StorageValueRecord) {4}] 
Data
required
module_name
string 
Module Name
required
Name of the module of blockchain business logic.
>= 1 characters<= 50 characters
Match pattern:
^[a-zA-Z0-9_]{1,50}$
storage_name
string 
Storage Name
required
Name of the blockchain state storage.
>= 1 characters<= 50 characters
storage_value
Storage Value
required
Value stored in the blockchain storage
raw_storage_key
string 
Raw Storage Key
required
The storage key of a value in the blockchain state. The key is used to store/access a value in the blockchain state.
>= 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": [
        {
            "module_name": "System",
            "storage_name": "Number",
            "storage_value": 29702,
            "raw_storage_key": "0x26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"
        }
    ]
}
🟠422Parameter Error
Modified at 2024-11-21 18:59:09
Previous
Info of on-chain entities
Next
Raw collections of blockchain storage
Built with