/ternoa-subql-dictionary

Ternoa dictionary to query substrate on-chain data 🚚

Primary LanguageTypeScript

🚚 Ternoa Dictionary

Ternoa Dictionary records all the native substrate on-chain data of the Ternoa blockchain: blocks, extrinsics, and events. It is a glossary of data that pre-indexes chain events, drastically improving the overall indexing performance.

Don't forget to have fun with it, Cheers 🍻

Table of Contents:

Introduction

Ternoa is a Decentralised, Open source, NFT-centric Layer 1 blockchain that is multi-chain by design and aims to provide a technical stack to build scalable and secure NFTs with native support for advanced features.

For Builders By Builders

NFTs native to our chain can be minted using High-level programming languages and doesn't require smart contract functionality.

Native support for Advanced Features

With native support for Secret NFTs, Delegating and Lending, Transaction Batching and much more, you might want to give it a try.

Dictionary

The Dictionary acts as the middleman between the Blockchain and the Indexer. This allows the Indexer to query a block’s metadata from the dictionary, allowing one to query blocks for specific events and only return the required blocks. For example: If one wants to fetch NFT creation events only, the Indexer will ask the dictionary for the corresponding blocks, returning only the blocks where NFT creation took place (for example: 5, 9, 32, etc.) instead of all of the blocks (lets say 1 - 100).

Error Reporting

If you encounter any errors along the way, technical or otherwise. Let us know and we'll deal with it swiftly. It'll help us further improve the overall experience for our users.

  • Open a discussion of type General in the discussions section if you encounter any unexpected behaviour.
  • Open a Bug report using the bug template if the bug persists.
  • If you can, suggest a fix in a pull request to resolve that issue.

Make sure to document the error properly, keeping in mind that the better you describe it, the easier it is to deal with.

Installation

1. Clone the Repository

Clone this repository by running this command:

git clone https://github.com/capsule-corp-ternoa/ternoa-subql-dictionary

2. Change Directory

Change the Directory for desired results:

cd ternoa-subql-dictionary

3. Select Network Environment

Move to the appropriate branch depending on the targeted network environment:

  • v43/mainnet for Mainnet
  • v43/alphanet for Alphanet

For example:

git checkout v40/testnet
# The indexer and dictionary should be on same version.

4. Install Dependencies

Install the required dependencies for the project using:

yarn install

5. Generate GraphQL Types

Generate types from your GraphQL schema and Operations:

yarn codegen

6. Build your implementation

Create an Executable version of your project:

yarn build

7. Docker pull

Pull the latest versions of the Docker image using:

docker-compose pull

8. Run

Run your compiled app with Docker using:

docker-compose up

Wait a couple of seconds for the indexing to start, after that you can access the Blockchain data in your local GraphQL playground

Using the Dictionary

You can significantly improve the indexation performance by using a dictionary endpoint instead of targeting the blockchain directly to gather data.

Just make sure to select the correct endpoints for the desired networks:

As you can see that the endpoints for Networks are structured as wss://xxxxxxxx.ternoa.com and https://dictionary-xxxxxxxx.ternoa.com which is replaced by the Network designation.

Supported dictionary environment networks are Mainnet and Alphanet.

Examples

For use on Mainnet:

 genesisHash: '0x6859c81ca95ef624c9dfe4dc6e3381c33e5d6509e35e147092bfbc780f777c4e'
 endpoint: 'wss://mainnet.ternoa.network'

For use on Alphanet:

 genesisHash: '0x18bcdb75a0bba577b084878db2dc2546eb21504eaad4b564bb7d47f9d02b6ace'
 endpoint: 'wss://alphanet.ternoa.com'

Using Dictionary as an Explorer

Ternoa Explorer is an example of a project relying on Ternoa Dictionary. It enables you to visualize the on-chain activity, explore public addresses and their transaction histories, gather information about individual blocks and much more.