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.
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:
- This integration code is usually tightly coupled with the underlying smart contracts which creates dependencies between the smart contract developers and downstream applications.
- 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
Sirato is a blockchain explorer and analytics platform that provides information about on-chain activity taking place with tokens, assets and smart contracts. Sirato takes care of all of the complex blockchain data interpretation and makes it readily available to its users.
This data is made available not just via Sirato’s 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.
What this means is that by accessing the Sirato API service, you can easily integrate other services with your blockchain applications via Sirato, instead of having to write bespoke code for specific applications.
To access the API backend via Sirato you can append /api to the address of your Sirato instance. For example, the URL goerli.sirato.xyz/api will take you to the API for the Goerli testnet instance of Sirato.
This page uses the OpenAPI specification to list all of the available entry points Sirato can provide for easily integrating blockchain data with other applications.
The below video provides a walkthrough of how to access Sirato’s 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.
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 Sirato. 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 Sirato is using.
A unified data platform
Sirato 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 Sirato docs for further information.
Using Sirato’s 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 Sirato, 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.