TRAIT DataGate

Intro

TRAIT DataGate provides blockchain data, such as token transfers and token balances, via convenient REST API.

API docs

You can find the latest DataGate API docs and make test requests here:

TRAIT DataGate API Portal

Main features

DataGate provides all possible blockchain data:

  • all historical data like blocks / transactions / events / token transfers;

  • current blockchain state like user token balances;

DataGate API provides endpoints for fetching raw blockchain data like blocks / transactions / events / blockchain storage collections. It may be useful for those who needs to fetch some specific blockchain data and is familiar with Substrate-based blockchains.

Also DataGate API provides high-level endpoints to fetch token balances / transfers / info about on-chain entities. It allows to easily fetch most important blockchain info and matadata URLs for on-chain entities.

In addition DataGate API provides endpoints to submit new blockchain transactions.

How to use

DataGate provides all possible blockchain information and is the high-performance service.

Store the IDs of required data in the game' database (hash of block / hash of transaction TX / ID of the event / blockchain address etc.) and fetch blockchain data (token transfers, token balances etc.) from DataGate API every time you need it.

You don't need to build your own indexing solution for the blockchain data - it's a complex and labour-intensive task.

Consistency of the data

TRAIT blockchain generates new block every 6 seconds. And every block can add new information - add a transfer of tokens, change token balance of an address etc.

When an app fetches blockchain data it may execute multiple requests to the DataGate API and shall ensure that the data is consistent. I.e. balances of all addresses are fetched for the same block, history of transfers fetched till the same block etc.

DataGate was built with this requirement in mind and provides great support for it. Please read the corresponding section in docs: Data consistency.

Finality of the data

Blockchain is a complex system - every transaction and every block passes multiple processing stages. During the processing a transaction / block may be rejected for numerous reasons. Also the tip of the chain of blocks may be reorganised due to various reasons.

With DataGate you don't need to worry about it. DataGate API provides only finalised data - it can not change at all. If you receive from DataGate API that a transfer was made - then it's done and irrevocable.

Submitting new transactions

DataGate API provides endpoints to submit new blockchain transactions. The overall flow is the following:

  • App fetches from DataGate API info required to build new blockchain transaction such as hash of the latest block, account nonce etc.

  • App builds the TX and signs it with the private key of blockchain address;

  • App submits the TX to DataGate API and TX gets distributed between blockchain nodes & included into the blockchain;

These endpoints deal with raw blockchain transactions - essentially with hex-encoded binary data. For more convenient REST API to submit new blockchain transactions please see TRAIT ActionGate.

Support

If you need to get some specific on-chan data and doesn't know how build the API request, please send us your question and we will help asap: support@trait.tech

At the moment TRAIT DataGate is in active development. We would be happy to know your ideas how to improve the service, please share with us: support@trait.tech

Last updated