How to Integrate Blockchain Data with other Applications

Blockchain applications rarely run in isolation. Smart contracts may define the logic of activities that take place on the blockchain. However, there are always other systems required to integrate with the blockchain itself.

This could be in the form of user interfaces or simply integrations that connect blockchain data with other systems.

The challenges of extracting blockchain data

Developers creating decentralised applications write them using smart contracts on a blockchain such as Ethereum. They deploy and interact with smart contracts they have written using blockchain integration libraries such as Web3j.

 

Using Web3j to deploy smart contracts on Ethereum

 

These libraries are useful for developers wishing to interface directly with a blockchain. However, should other systems wish to consume data about these smart contracts or assets it usually also requires custom integration code to be written.

 This type of development is usually achieved using one of two approaches:

  1. This integration code is usually tightly coupled with the underlying smart contracts which creates dependencies between the smart contract developers and downstream applications. 
  2. A general-purpose blockchain data ingestion or indexing layer is written which is non-trivial to achieve due to the manner in which data is stored on blockchains.

However, both of these approaches require a high level of ongoing maintenance, especially for those systems that only need to be notified of certain activities taking place.

An API for blockchain data

Chainlens is a blockchain explorer and analytics platform that provides information about on-chain activity taking place with tokens, assets and smart contracts. Chainlens takes care of all of the complex blockchain data interpretation and makes it readily available to its users.

Chainlens Holesky Explorer Dashboard

This data is made available not just via Chainlens' user interface, but also via its backend API. This API makes available blockchain data spanning tokens, accounts, smart contracts, events, transactions and the blocks themselves.

Chainlens Blockchain Explorer backend API

 

What this means is that by accessing the Chainlens API service, you can easily integrate other services with your blockchain applications via Chainlens, instead of having to write bespoke code for specific applications.

To access the API backend via Chainlens you can append /api to the address of your Chainlens instance. For example, the URL holesky.chainlens.com/dashboard will take you to the API for the Holesky testnet instance of Chainlens.

 

Chainlens Blockchain Explorer API

 

This page uses the OpenAPI specification to list all of the available entry points Chainlens can provide for easily integrating blockchain data with other applications.

The below video provides a walkthrough of how to access Chainlens' APIs.

 

Listening for token events

Imagine you want to create an integration that listens for specific token-related events taking place on the blockchain. Going through the list of available services, you will see there is a token-events-controller which makes such an integration seamless. 

A developer writing an integration simply needs to poll the provided /tokens/{addressHash}/events endpoint with a token contract address to get this information in real-time.

token-events-controller Chainlens Blockchain Explorer

 This functionality significantly simplifies integrating blockchain activity with other applications, saving development teams a lot of time in the process. 

This example demonstrates the ease with which blockchain data can be accessed via well-defined API calls defined by Chainlens. There are similar calls for accessing a very broad range of activity from the blockchain, including account information, internal transactions and details of the underlying node Chainlens is using.

 
A unified data platform

Chainlens doesn’t just integrate with bespoke applications, it can also seamlessly integrate with business intelligence reporting tools. This will be the subject of a future post, in the meantime, you can refer to the Chainlens docs for further information.

Using Chainlens' API-based integration service is a powerful mechanism to connect blockchain native applications with off-chain applications. By utilising all of the powerful indexing and interpretation functionality of Chainlens, projects working with blockchains can save a lot of time by being able to focus primarily on what their applications need to do, rather than how to integrate with them.

If you’d like to learn more about how to get started with Chainlens reach out to the Web3 Labs team by email or join our Discord if you have any questions.

News & Insights