Chain State

Querying current state and events in the Enjin Platform
The chain state of a blockchain refers to the current state of all data and information stored within the blockchain. The chain state includes details such as account balances, minted digital assets, ownership records, and any other relevant information that is stored on-chain. This state is continuously updated and maintained by the network's consensus algorithm, ensuring the integrity and accuracy of the data stored.
There are multiple ways of querying the chain state of our blockchain for learning purposes we will demonstrate the most common method, using the Enjin Console, and using Enjin Platform.

Enjin Console

Connecting to the Enjin Console

Open the Enjin Console, you can connect to the network by clicking on the following URL:

Querying the data

To query any pallet storage on the Chainstate page, simply select the desired pallet and the specific storage you are interested in. For instance, if you want to retrieve information about collection ID 2000, you can follow these steps:
If you do not enter the block hash to query, the chain state displayed to you will always represent the latest block created in the network.

Enjin Platform

The Enjin Platform leverages anIndexer as explained inOverview
The main objective of the indexer is to provide the most up-to-date chain state as quickly as possible. While it is technically possible to directly query the chain state from an RPC node, such queries can be resource-intensive and overload the node if there are too many concurrent queries. This is where indexers play a crucial role.
Using the Enjin Platform, you can leverage the power of multiple relationships in a single query to retrieve the desired data much faster. This capability is not achievable directly through RPC nodes.
Below, you will find a sample query made on the GraphiQL playground, showcasing the state of collection ID 2000:
It is crucial to understand that the Enjin Platform exclusively indexes the current chain state. This implies that you cannot query the state of the chain in previous blocks. The platform focuses on providing real-time access to the most recent state of the chain rather than historical data.
Last modified 2mo ago
© 2023 Enjin Pte. Ltd.