CelestiaQL's goal is to provide a powerful querying engine and developer-friendly API for accessing payForMessage
data on Celestia. This can allow develoers to easily build dApps with Celestia as the backend. It can also help developers and users debug on-chain activity. Lastly, it enables a birds-eye view into how people are using Celestia.
- Install
celestia-appd
. Instructions are here. - Step 1 might take a while. Once it is done catching up, start Celestia. Do this either one of two ways: start the service (following the above instructions) or run the command
celestia-appd start
. If you were previously catching up, it may already be running. - Install and run MongoDB.
- Clone this Git repo
git clone https://github.com/lzrscg/celestiaql && cd celestiaql
- Make sure you have
nodejs
andnpm
installed. If not, you can use the official website or nvm. npm i
npm start
- (optional) if you want to develop, install the protobuf compiler.
Juno is a Cosmos Hub blockchain data aggregator and exporter that provides the ability for developers and clients to query for indexed chain data. Celestia uses a forked version of Juno by Forbole.
Juno is great! However, CelestiaQL has a different goals and a different approach.
Juno previously used MongoDB, but now it exclusively uses PostgreSQL. While PG is a great database, it is not optimal for storing payForMessage
data. This is because payForMessage
data is unstructured and is better stored in a document database. MongoDB allows for rich and complex queries aggregating and filtering through many varied documents.
There isn't a very good justification for this. In fact, this would have been easier in Go. I started developing this in Node because I am quicker at experimenting in it. Then, after going down the rabbit hole, I did too much in Node to want go back.
Node does have one advantage over Go. In my opinion, there is better tooling for providing nice APIs to users.
CelesJS (name inspired by CosmJS) is a collection of JS classes and functions that help JavaScript projects work with Celestia. It is basically a reimplementation of parts of celestia-app in pure JS as well as some tendermint data structures.
At this time, the functionality wholely revolves around building up the namespaced merkel tree to generate commitment share hashes. In CelestiaQL, this is used to match block data with the messages inside of the transactions.
CelestiaQL does not store the same data that Juno does. Both can be run alongside each other and would compliment each other nicely. Juno does not index the data inside of the blocks, whereas that is the only thing that CelestiaQL indexes (along with a minimal amount of metadata). CelestiaQL also makes much less requests than Juno, pulling just the blocks and not every individual transaction.
In Development
Currently, it will start syncing blocks and successfully add messages to MongoDB. GraphQL API coming soon.
- Listen for new blocks
- Preventing syncing history multiple times
- Custom parsers (this will allow you to parse every message inside of a namespace to check for validity and serialize it to JSON so that it can be queried on the DB)
- Custom reducers (this will allow you to calculate state over time by processing messages in order)
- GraphQL API
- Block explorer UI
- Subscriptions
- Send
payForMessages
using the API