Introducing the block explorer for VSC, an interface for the Hive layer 2 (L2) smart contract platform.
This has been in the works in the last months, and I would like to thank @vaultec for the opportunity for me to develop the frontend.
API
Before going into the specifics of the block explorer, an API is required to fetch the relevant data to be displayed. As we are still in the very early stages of VSC, data from the API provided by a standard VSC node are currently very limited.
I have created a non-forking HAF app to index VSC-related operations from layer 1 (L1) into its own schema that the block explorer can use to display the data. The HAF API currently used by the block explorer may be accessed here. The API method details are available here, where each PL/pgSQL function is a GET API method.
For example:
$ curl -s https://vsc-haf.techcoderx.com/rpc/get_l1_operations_by_l1_blocks?l1_blk_start=77300782\&l1_blk_count=1000 | jq
[
{
"id": 5343,
"ts": "2023-08-07T08:14:33",
"type": 6,
"payload": {
"action": "announce_block",
"net_id": "testnet/d12e6110-9c8c-4498-88f8-67ddf90d451c",
"block_hash": "bafyreiei4mktbbzxb3q5ntprtypl7pgoilj3kdvd5spfqwlpqhu7keutqa"
},
"l1_block": 77300782,
"username": "avalonreport"
},
{
"id": 5344,
"ts": "2023-08-07T08:21:36",
"type": 6,
"payload": {
"action": "announce_block",
"net_id": "testnet/d12e6110-9c8c-4498-88f8-67ddf90d451c",
"block_hash": "bafyreih2636gia2wcd7shees7qerkmv57ko3shkxev6czttskiixuzqexi"
},
"l1_block": 77300923,
"username": "k2x"
},
...(remaining ops goes here)
]
Frontend
Unlike my other frontends, the VSC block explorer is a single page application (SPA) developed with Vite and React using Chakra UI for UI component library.
As of now, it displays the data from the HAF API node which are L1 data. L2 data on IPFS (i.e. contract execution) are not displayed, however it may be accessed by clicking on the IPFS hashes on VSC block pages and latest contracts page.
The pages that you may be interested are as follows:
- Witnesses: https://vsc.techcoderx.com/witnesses
- Latest blocks: https://vsc.techcoderx.com/blocks
- Latest L1 transactions: https://vsc.techcoderx.com/transactions
- Latest deployed contracts: https://vsc.techcoderx.com/contracts
- Single VSC block: https://vsc.techcoderx.com/block/331
- Single VSC L1 transaction: https://vsc.techcoderx.com/tx/68622a8d9f687b37ddfca181b29f8f893f9afe39
- Single VSC L1 user (replace with your username): https://vsc.techcoderx.com/@avalonreport
Roadmap
Much of the roadmap are primarily driven by the development of VSC network itself. Things that will need some work on the block explorer are:
- L2 execution data
- Search (for blocks, transactions, DID keys, contracts etc.)
- Homepage, currently only shows overall state of HAF app
- Broadcast tool
Links
Block explorer: https://vsc.techcoderx.com
Source code: https://github.com/techcoderx/vsc-explorer
HAF API: https://vsc-haf.techcoderx.com
HAF app source code: https://github.com/techcoderx/vsc-haf