How we built a multi-blockchain explorer in 3 weeks

Today we launched the hybrix Explorer that allows you to browse the transaction history of pretty much every major blockchain. Currently that’s 26 supported blockchains! The project is fully open source and built on top of the hybrix API. In this blog we would like to share with you our development process, give a little insight how easy it was to build using the hybrix API.

The challenge

The story of this project begins when Sander of our marketing team unsuspectingly asked whether it would be possible to use hybrix to create a multi ledger block explorer. Rouke, one of our developers, answered: “Sure, everything is possible, but…”

The idea to build a human readable interface on top of the hybrix API was pretty cool, obvious even. But the hard part lies in making something a polished product. The first 80% is quickly made, but the hard part is finishing the final 20%. And for a small team with already big ambitions time is a very precious resource.

But after a good night’s sleep we accepted the challenge. The scope was clear: a very thin, lean, front-end layer on top of our API. Nothing would be implemented that was not already supported by the back-end. We firmly agreed to keep the scope small, keeping some space for a kick-ass design.

Watch our team talk About the development proces

A welcoming design for users

We started off by analyzing the designs of the competition and wanted to create something simpler, cleaner and more accessible for users. Inspired by the simplicity of DuckDuckGo we designed our frontpage to be distraction free and continued to design the transaction pages with clear elements that guide the user and explain the transactions. Overall we wanted to create a blockchain explorer that anyone can use for all the cryptocurrencies and tokens that they own.

Connecting the front-end to the back-end

Our API already had the necessary endpoints to retrieve information on address balances, histories and transactions.

Will get you the details for an ethereum transaction

Will get you the last 10 transactions from a lisk address

Will get you the balance for a bitcoin address.

It’s as simple as that. Within a few hours the first prototype was up and running, and integrated in our CI/CD automatic deployment pipelines.

If you’d like to learn more about the hybrix API, there are more examples in the API documentation.

Help | hybrix - Build flexible blockchain solutions

A small dive into the back-end

To glimpse into how these calls are handled in the backend, here is a small example of our code. Written in the qrtz (Quartz) scripting language:

poke count $2 12
poke offset $3 0
curl asset://$symbol /api/transactions?recipientId=$1&offset=$offset&limit=$count GET {Accept:’application/json’,’Content-Type’:’application/json’}
tran .data 2 1
fail ‘Cannot get transaction history!’
sort [‘.height’,num,desc]
tran [].id

This code example is from the Lisk recipe and handles the call: 

Where $1 is the address, $2 the count, and $3 the offset. The data is retrieved from the lisk blockchain nodes. The resulting data is transformed, sorted and returned, or an error is thrown if something fails.

The power of qrtz lies in its simplicity, the robustness in error handling and the fact that many qrtz processes can be run, introspected and managed simultaneously. Something that is near impossible to do with Javascript.

Limitations of the explorer

Our API as of yet does not include details on specific blocks as you may might find in other explorers. Nor does it automatically provide all tokens balances for an address. We are aware of the limitations and have a vast wish list of enhancements ourselves.

We are immensely proud of the explorer that we built in such short amount of time and provides a basis to continue building on.

Build with us!

Hybrix already supports 26 different blockchains and more than 400 tokens. We will continue adding coins and features. With our API-first design methodology all the newly added coins will automatically find their way into all projects and products built on hybrix. The Internet of Coins wallet, the brand new hybrix Explorer, command-line tools and basically anything that you and others build with hybrix.

Would you like to add support for your token in the hybrix Explorer? This is possible with just a few lines of code. Checkout our token support guide to learn more.

It’s even possible to download our node and host your very own multi-ledger block explorer.

You can find the project’s open source code on Github and you can reach us on Telegram if you would like to contribute to the project.

We would love it if you want to try our Explorer, and let us know what you think!

How we built a multi-blockchain explorer in 3 weeks was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.

Publication date: 
06/19/2019 - 20:32

The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.