Parser Series (Part 1): Setting Up your own Indexer Using Unmarshal Parser

What is the Tool?

So, you’re a DApp Developer who’s looking for ways to gain access to all of your smart contract’s data but you don’t know how? Or you’re researching a project and want to gauge interest in it by monitoring events and function calls in their smart contract? There could be any number of reasons you have for wanting specific data from the blockchain. There’s been no usable, non technically invasive way to do this… until now.

Presenting, The Unmarshal Parser

The Parser allows a user to index or save all transactions relating to any contract filtered by its events or function calls. This unique system saves you the time and resources required in developing a watcher service to filter this data, not to mention the headache of using an external node service to get this data from in the first place.

The tool lets users access data in two formats — Metabase Dashboards and GraphQL APIs, which we will get into later in this guide.

Now we come to the meat of the matter. How do you set up this indexer? Well, fear not. The process has been streamlined to such an extent that you essentially don’t need any technical know-how to have it up and running and gain access to your data.

Setting up your Indexer

To start with, you will need to head to Unmarshal’s Unified Console.

  1. Login/Create an account

To use the <Project Name>, you will need an Unmarshal account. The account is free to create and lends you access to Unmarshal’s world-class APIs across over 7 chains.

2. Click on the Parser Tab on the sidebar to your left. Click on “Create New”

3. Select the chain your contract is deployed on. We support a generous number of EVM based chains including testnets.

4. Contract Address

Paste in your smart contract’s address here.

5. Fetching ABI

The ABI is a JSON<ref> that holds the available list of functions and events in a contract that can be accessed and their respective signatures. The form will auto-fetch a verified ABI from <>scan if available. You are also free to paste in the ABI of the contract if you wish to.

6. Events/Functions

Events are logs which are emitted from your smart contract. The data of each event is saved in a separate table for easier access.

Pick the events or functions you are interested in indexing or monitoring. Indexing functions will increase the time the indexer takes to come in “sync” with the node.

7. Add Plugins
Plugins let you enhance the parser aggregated on-chain data with off-chain data like price and token details. Refer to plugin documentation for more. details.

8. Start Block

This item tells your indexer the block number to start indexing from. If available, it points by default to the block number your contract was deployed in. You are also free to enter a custom start block. The later your start block is, the faster the indexer will be in sync with the chain at the cost of excluding transactions from older blocks. You could also enter a block in the future to begin indexing from. (Bear in mind that that indexer will lag behind the node by <Indexing Lag> blocks. This ensures, all transactions are a part of the node with a high probability)

9. Enter a name to identify your parser

Name your indexer and give a description. This will help you identify and more clearly differentiate between multiple indexers.
Pick a schema name for your indexer. If you wish, you could reuse a schema name across multiple indexers as long as each is indexing a different contract. You could also have multiple indexers indexing the same contract as long as they use different schemas.

10. Pick/Enter a schema name

Pick a schema name for your indexer. If you wish, you could reuse a schema name across multiple indexers as long as each is indexing a different contract. You could also have multiple indexers indexing the same contract as long as they use different schemas.

Submit your request!

Click on “Create Parser”, and Et voilà, your indexer is up and running!! No worrying about instances or compute units, manifests or any of that technical gobbledygook.

Now that you have an indexer running and in-sync, you might be wondering how you gain access to that data? Unmarshal provides you with two easy ways to either visualise or query all that data.

Accessing your data

The Parser provides two ways of accessing the data that you have indexed.

Metabase

What exactly is it?

Metabase is analogous to a GUI for a Database that gives you full access to your data. Apart from the ability to see data in a tabulate format, it allows you to run SQL queries to access your data. It also provides you with the ability to create dashboards like the one here, created for Unmarshal’s very own staking platform.

You can read more about Metabase here.

Who is it for?

Metabase is a powerful tool for visualising on-chain protocol data which can be used by researchers, dApps, and investors for data analytics.

Check out our webinar to understand how dApp analytics can be used to improve application performance and analyse user behaviour.

How do I access it?

The login credentials for metabase are available on your indexers tab. You can click on the “View Details” button to get the URL, Username and Password. Keep in mind that you are free to change your password after logging in, to whatever you prefer.

GraphQL

What exactly is it?

The service starts a GraphQL server for you with all the schemas and resolvers auto-generated. GraphQL is an easy way to access all data in your database and cherry pick what you want in your response. GraphQL is a “Query Language” that you can submit via post requests to a server that supports it. You can learn more about it here.

Who is it for?

With the help of GraphQL APIs, dApp builders can access on-chain data in the form of APIs that can be integrated into their applications through backend. It is a great querying tool to access highly specific, rich protocol data outside of the one provided by our standard set of Unmarshal APIs. The Unmarshal Parser will automatically deploy a standard Subgraph based on the events and function calls selected while creating the Indexer.

How do I access it?

  1. First, you will have to create a GraphQL server. Click on the “GraphQL: Add New” Button to create it.

2. Once a server has been created, the tab will change. Click on View Details.

3. The PlayGround exposes a schema you can use to test out queries. The GraphQL link allows you to submit “POST” requests with those queries to gain access.

For any queries on using the Parser, reach out to us at support@unmarshal.io. We also have a dedicated developer hive on Discord. Just drop us a message in the “API Support” channel and we’ll get back to you.

About Unmarshal

Unmarshal is a Multi-chain Web 3.0 data network aiming to deliver granular, reliable & real-time data to dApps, DeFi protocols, NFTs, Metaverse and GameFi solutions. Unmarshal provides the easiest way to query Blockchain data from Ethereum, Polygon, BNB Chain, Avalanche, Fantom, Celo, Solana, and XDC Network. Unmarshal network consists of data indexers and transforming tools to power Web 3.0 applications on any chain while providing a latent view of transformed data.

Website|Telegram Chat|Telegram Ann|Twitter|Medium|Discord

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store