Querying Hedera Transaction History on Arkhia - Arkhitect Awareness Series
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
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.
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.
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.
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:
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.
Pulling Specific Smart Contracts
For our example, let's query specific smart contracts on Hedera using Arkhia.
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.
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.