March 15, 2018
Introducing a Blockchain Explorer for Cosmos
At CyberMiles, we’re not reinventing the wheel in software engineering. In fact, we believe the best software engineering is done via collaboration between expert teams, much like blockchain consensus itself. That’s why our developers participate in and contribute to other open-source blockchain projects such as Ethereum and Cosmos. The CyberMiles blockchain will be built on existing, proven open source frameworks. Contributing to those open source projects we depend on is not only our responsibility but also critical to the quality and success of our own CyberMiles blockchain.
This week, CyberMiles developer Maggie Wang released a blockchain explorer for the upcoming Cosmos Hub blockchain. It currently runs on the Cosmos Gaia testnet. If you’re a developer, you can review and contribute to the source code on Github.
Exploring the Source Code
The Explorer is an EtherScan-like tool for the Cosmos ecosystem, with support for new transaction types related to Bonded BFT (aka Cosmos PoS) operations. Over time, it will become a crucial tool for the CyberMiles blockchain as well. You can see some examples of the tool in action on the live Cosmos test network, including:
- Balances and coin transaction history for an account (example)
- Transactions and validators in a block (example)
- Raw request for each transaction such as coin, stake/declareCandidacy, stake/delegate, stake/unbond
- Recent blocks and transactions (example)
Tackling the Technical Challenges
A key challenge in building a tool like this is to decode the transaction contents recorded in the blockchain. An important benefit of the Tendermint blockchain framework is that it provides a clear separation between the consensus logic and the application logic. However, it also means that transactions recorded in the Tendermint blockchain can only be generic blobs of encoded data.
In order to understand the content of each transaction in the blockchain, we will need to use Cosmos/CyberMiles itself to decode it. Maggie designed a REST service that utilizes the Cosmos SDK functions to decode the transaction content. This has resulted in a new web service that can specifically handle Cosmos data. This REST service by itself is a valuable contribution to the community.
In the future, the same approach can be utilized to decode transactions in a variety of different Tendermint-based blockchains, including the CyberMiles blockchain.