Visualize Zcash Blockchain Data with Zebra + Elasticsearch + Kibana

by Alfredo Garcia

The Zcash blockchain history is big and rich—any block explorer application can just call RPC methods from a zcashd node and present the data in the desired way. Data analysis is hard in this context, on the one hand, you can just do what a specific application will allow you to do, or on the other hand if you need different visualization you have to create your own app.

As an alternative, we can export and index all block (header and transaction) data fields into an elasticsearch database and use Kibana as a front end to do some analysis.

The possibilities of data visualization are huge with Kibana and all we need to do to create them is to feed an elasticsearch database with valid JSON block data.

When the elasticsearch feature is enabled, each block is sent from Zebra into elasticsearch; this is in addition to saving the block in the internal rocksdb database. We can then guarantee Zebra’s correct ongoing functionality and storage in the desired external database at the cost of more hard drive storage and a longer synchronization time.

Once the data has been inserted into the database, the Kibana part is easy. It may be able to provide many answers to existential questions our community deserves to know, for example:

  • How many Orchard transactions have we had since its introduction? (Adoption)
  • How many shielded coinbase transactions have we had since its introduction? (Adoption)
  • How many Sprout transactions did we have in the last X period? (Deprecation)
  • How many transactions per block have we had on average since the start of the blockchain? (Information)
  • Which hours of the day are more transactions executed? (User distribution)
  • What is the average size of a block or transaction? (Parameters)
  • What is the distribution between Orchard, Sapling, Sprout and transparent transactions? (Information)
  • And many, many others.
A screenshot of a Kibana dashboard showing Zcash blockchain data.
The Zebra elasticsearch feature has only been tested on Testnet so far. Here is a guide on how to set it up; it is pretty easy. What I think is needed next:
  • Deploy the Mainnet in the cloud
  • Setup Kibana for listening to an external IP address. Optionally attach a domain name to it.
  • Create and share Kibana usernames and passwords between people interested in creating visualizations
  • Create dashboards with Zcash data
  • Share links to visualization in forums, twitter, news, etc. (external users do not need Kibana access to see shared visualizations)

If you want to collaborate on any of these, please let us know by posting to the Zcash Community Forum!