How to Query Historical Hedera Data with the DragonGlass REST API

This post was authored by Sreejith Kaimal and Ashu Mahajan, Application Architects at OpenCrowd. OpenCrowd is a design and technology firm that provides custom blockchain development and consulting services to enterprise clients and startups.





Coming to Hedera from a traditional blockchain background, one of the first things users must wrap their heads around is how the network handles state. As a development partner since 2017, we at OpenCrowd are keenly aware that companies building on Hedera need a seamless way to access all of their live and historical data in an operational data store. Additionally, users of these applications may want to access any relevant information about them. These issues are what led us to create the DragonGlass platform.

Accessing Historical Data with DragonGlass

The DragonGlass API is a REST API that allows you to query historical data by transactions and accounts on both the testnet and mainnet.



For instance, if you’d like to query the balance of a given account at a certain point in time you can use the following:

https://api.dragonglass.me/hedera/api/accounts/{accountID}/balances/(asOfInEpoch}

As you can imagine this makes it easy to incorporate into your application. We’ll demonstrate how to in a few quick examples within a JavaScript environment.



If you’re trying to follow along you’ll need:

Hedera mainnet or testnet account [Docs]

DragonGlass access key [Generate key]

Hedera JS SDK [GitHub]

I’d also suggest using Postman to make it easy to format. After obtaining a DragonGlass access key, it’s straightforward to retrieve data from DragonGlass. We will start by first submitting a transaction to Hedera.



Create a client

For the JS SDK, the sample client is available on the public repo at github.com/hashgraph/hedera-sdk-js. You could always build a custom client using the protobuf definitions for the Hedera APIs, but we’ll stick to JS SDK for this example.

