This branch is intended to be used with Cosmos SDK
v0.38.3
and Tendermintv0.33.3
.
Juno is a Cosmos Hub blockchain data aggregator and exporter that provides the ability for developers and clients to query for indexed chain data.
This version of Juno is a fork of FissionLabs's Juno.
The main reason behind the fork what to improve the original project by:
- allowing different databases types as data storage spaces;
- creating a highly modular code that allows for easy customization.
We achieved the first objective by supporting both PostgreSQL and MongoDB. We also reviewed the code design by using a database interface so that you can implement whatever database backend you prefer most.
On the other hand, to achieve a highly modular code, we implemented extension points through the worker.RegisterBlockHandler
, worker.RegisterTxHandler
and worker.RegisterMsgHandler
methods. You can use those to extend the default working of the code (which simply parses and saves the data on the database) with whatever operation you want.
Juno takes a simple configuration. It needs to only know about a database instance and a Tendermint RPC node.
To install the binary run make install
.
Note: Requires Go 1.13+
rpc_node = "<rpc-ip/host>:<rpc-port>"
client_node = "<client-ip/host>:<client-port>"
[database]
type = "mongodb"
[database.config]
host = "<db-host>"
port = <db-port>
name = "<db-name>"
user = "<db-user>"
password = "<db-password>"
ssl_mode = "<ssl-mode>"
rpc_node = "<rpc-ip/host>:<rpc-port>"
client_node = "<client-ip/host>:<client-port>"
[database]
type = "postgresql"
[database.config]
name = "<db-name>"
uri = "<mongodb-uri>"
Juno internally runs a single worker that consumes from a single queue. The queue contains block heights to aggregate and export to a database. Juno will start a new block even listener where for each new block, it will enqueue the height. A worker listens for new heights and queries for various data related to the block height to persist. For each block height, Juno will persist the block, the validators that committed/signed the block, all the pre-commits for the block and the transactions in the block.
In addition, it will also sync missing blocks from --start-height
to the latest known height.
$ juno parse /path/to/config.toml [flags]
The schema definitions are contained in the schema/
directory. Note, these schemas are not necessarily optimal and are subject to change! However, feel free to fork this tool and expand upon the schemas as you see fit. Any tweaks will most likely require adjustments to the database
wrapper.
If you want to know how to run a GraphQL server that allows to expose the parsed data, please refer to the following guides:
If you want to run it as a service, you can follow this guide.
Contributions are welcome! Please open an Issues or Pull Request for any changes.