Querying Hedera Transaction History on Arkhia - Arkhitect Awareness Series
Arkhia
Feb 07, 2023
by Arkhia Team
Image2

In this tutorial-styled blog post, you will learn how to leverage Arkhia to efficiently call transaction data from the Hedera network for use on your dApp. Using Arkhia as your middleware solution ensures critical data is consistently available. Let’s get started.

But First - What are Mirror Nodes?

Mirror nodes on Hedera operate separately from nodes actively participating in reaching consensus. Since Hedera can process an incredibly high number of transactions, having dedicated nodes keeping the full transaction history of the network relieves this burden from the consensus nodes, allowing them to achieve consensus as efficiently as possible (3-5 seconds with finality). 

With the consensus nodes focusing on consensus, this leaves mirror nodes to handle queries, analytics, audit support, and monitoring. Arkhia functions as a reliable, available solution ensuring your dApp has uninterrupted access to all of these mirror node functions.

Getting Started with Arkhia

Not already registered on Arkhia? Visit the “Getting Started” section and follow the various steps to sign up and confirm your account, then get an explanation about the functionalities of your personalised dashboard.

Accessing Mirror Node Data Through Arkhia

Arkhia utilises the Hedera Mirror Node REST API to provide users with the data of their various queries on both mainnet and testnet.

When using the REST API, you use a standard set of URLs with variations specific to your query. When querying transaction history, you can filter by account, balance, transaction type, topic, token, NFT, smart contract, and more.

It is important to note that you need an API key to query the Hedera network using Arkhia, but not to worry as this can be done easily and for free. The process is outlined in the Getting Started section of the Arkhia documentation. Once generated, you can see example code snippets involving the REST API here.

How to make a query on Arkhia

Paid Version

It is important to note that the above URLs and examples below are for paid tiers only, if you are using the free version, please use the URLs just below this.

Free Version

Specific queries can be found here. Simply replace the URL with Arkhia URLs for seamless integration.

Example Queries on Arkhia

Pulling Accounts with Specific Balances

Users who wish to locate all accounts on Hedera with a specific balance, such as all balances with 5000 tinybar or less in ascending order, would use this URL.

https://hedera.mainnet.arkhia.io/api/v1/accounts?account.balance=gt:5000&order=asc

First image

Pulling Accounts with Specific Hedera IDs

For querying Hedera accounts within a specific range, say you’re looking for early Hedera accounts with an ID less than 0.0.10 in descending ID order, you can use this URL.

https://hedera.mainnet.arkhia.io/api/v1/balances?account.id=lt:0.0.10&order=desc

Second image specific ids

Pulling a Specific Number of Accounts with Specific IDs

Now, let’s see how we can pull a specific number of accounts within a specific, desired balance. In this example, let’s say we want to pull the first 5 accounts with an ID after 0.0.10 in ascending order. The URL would be:

https://hedera.mainnet.arkhia.io/api/v1/balances?account.id=mt:0.0.10&order=asc&limit=5

Third image specifc amount by ids

Pulling Specific NFTs

Querying NFTs on Hedera is just as easy as any other. For example, you can query the first NFT in a specific collection under the Hedera ID 0.0.1232177.

https://hedera.mainnet.arkhia.io/api/v1/tokens/0.0.1232177/nfts/1

Image 4 specific nfts

Pulling Specific Smart Contracts

For our example, let's query specific smart contracts on Hedera using Arkhia. 

https://mainnet-public.mirrornode.hedera.com/api/v1/contracts/0.0.1276886

Image 5

Conclusion

We hope this blog has helped you learn how to utilise Arkhia to query various types of transactions on the Hedera network. If you do not already subscribe to Arkhia and it’s suite of services, visit Arkhia.io to learn about the various benefits it brings to builders on Hedera. We look forward to providing you with reliable, high quality data while you work to empower Web3.

About ARKHIA

Arkhia is an enterprise-grade Infrastructure-as-a-Service (IaaS) provider for decentralised technologies. We are empowering organisations, teams, and individuals to build fast, modular, and scalable solutions in our high-availability environments for Web3 applications. Purposely built for reliability, resilience, and high throughput on a multi-chain network, the Arkhia API suite benefits anyone needing ultra-reliable network uptime for mission-critical applications. To learn more about how we provide enterprise-grade infrastructure, visit arkhia.io, subscribe to our newsletter, and follow us on Twitter (@arkhia_io), LinkedIn and Reddit.