DEV Community

CoinMonks
CoinMonks

Posted on • Originally published at bitquery.io on

The complexity of working with blockchain data

Note: In this article, Robert (Lead developer, XENTAVO) shares his experience of working with the blockchain data APIs and the problems he faced along the way. Robert is a Bitquery API user.

Most of our clients need customized reports measuring, for example, the current value of their tokens or the value of their portfolio combined with some key indicators. These reports rely on real-time data. For us, the best way to manage these reports is to use a Raspberry Pi device connected to a Hyperpixel 4 display. Our clients can simply place the Raspberry Pi device right on their desk, making it easy for us to collect real-time data and maintain individual reports remotely. Our developers have designed robust checks and balances system to ensure this data is accurate and reliable. We code primarily in Python.

crypto dashboard

Dealing with Cryptocurrency API

When creating blockchain reports, we do need an API for every new application. In some cases, we are using up to 20 different APIs, all with different settings and from different providers.

Not all APIs are created equal. For any specific task you can likely find multiple competing APIs that use different approaches and provide varying levels of documentation and support. The selection of the API is one of the key issues leading to success or failure of any implementation.

Selecting the correct API is time-consuming, and when the wrong API is chosen, it can lead to unnecessary processing time and costs. The criteria to select the correct API is cost (cost to develop and run the API), quality (incidents, code quality and automated error handling) and output (reuse of API and performance).

Error HandlIng

Additionally, APIs in our industry are not always reliable. There is often at least one API that is causing some sort of issue. In particular, Error 502 or 504 Gateway Errors pop up frequently.

Error codes are almost the last thing that you want to see in an API response. Generally speaking, it means one of two things: something was so wrong in your request or your handling that the API simply couldn’t parse the passed data, or the API itself has so many problems that even the most well-formed request is going to fail. In either situation, traffic comes crashing to a halt, and the troubleshooting process begins.

Data accuracy

Even when there isn’t an error, an API can deliver an incorrect value. This can happen, for example, when looking at transaction hashes of rebase tokens (such as Ampleforth). If token quantities are changed without being marked by a transaction hash, the values will not add up.

For example, let’s look at the Ampleforth in the address 0x82Eaa009E9CAE43955a3EF9D1DE3bF68f5154200. At the time of this writing, this address has 2193.34 AMPL. However, if you analyze the individual transactions, the sum is 8326.64 AMPL. The difference is coming from the rebase of AMPL. For developers, this discrepancy makes it difficult to know when to rely on the value presented by an API.

Multiple providers

It is easier to manage your APIs if they are coming from a single vendor. There is a lot of knowledge involved in selecting and managing even one API, let alone several.

Questions you will have to ask for each API include: Do we need an API key? Is a billing account attached to the project? Is the provided billing method valid (for example, an expired credit card)? Is there an exceeded self-imposed daily limit on the API? Does your API key have an IP address restriction? Keeping track of these details with several different API vendors can be a huge headache.

python code

Bitquery API and Explorer

The above-mentioned issues are the main reasons we started using Bitquery APIs. Bitquery offers a set of tools that make it easy to plug and play, and we know their data is reliable. We use the Bitquery explorer to plan and configure the accessing of specific data. This tool allows us to effectively test the structure and result of our calls. Once we finish configuring our script, we plug the new script into our code. This process helps us significantly reduce the development time for our applications. In terms of speed, reliability, and simplified error handling, we find the Bitquery solution unbeatable.

Note : This article is contributed by Roberto Rey, a Lead Developer at XENTAVO, a Bitquery API user.

You might also be interested in:

About Bitquery

Bitquery is a set of software tools that parse, index, access, search, and use information across blockchain networks in a unified way. Our products are:

  • Coinpath® APIs provide blockchain money flow analysis for more than 24 blockchains. With Coinpath’s APIs, you can monitor blockchain transactions, investigate crypto crimes such as bitcoin money laundering, and create crypto forensics tools. Read this to get started with Coinpath®.

  • Digital Assets API provides index information related to all major cryptocurrencies, coins, and tokens.

  • DEX API provides real-time deposits and transactions, trades, and other related data on different DEX protocols like Uniswap, Kyber Network, Airswap, Matching Network, etc.

If you have any questions about our products, ask them on our Telegram channel or email us at hello@bitquery.io. Also, subscribe to our newsletter below, we will keep you updated with the latest in the cryptocurrency world.

The post The complexity of working with blockchain data appeared first on Bitquery.

Top comments (0)