A Rust application that queries the Tendermint APIs via both RPC and socket connections and updates a Postgres database with relevant information.
This codebase is under heavy development. You're welcome to it, of course (it's MIT and all) but it's not a production solution yet. If you ARE a Rust developer interested in indexing cosmwasm/cosmos blockchain messages into a database, we welcome your pull requests.
Assuming you have installed postgres (via apt, homebrew, etc.) you will need to create the indexer's root database. (we use "daodaoindexer" in the examples below but you can call it whatever you like).
createdb --host=localhost --port=5432 --username=$USER --no-password daodaoindexer
dao-indexer uses the Diesel[https://diesel.rs/] ORM for Postgres as well as the complementary SeaORM[https://www.sea-ql.org/SeaORM/] crate. In addition
to the crates in Cargo.toml, you'll want to install the diesel_cli
tool:
cargo install diesel_cli --no-default-features --features postgres
Note: this requires that the postgres libraries are on your link path already. You'll also want to add ~/.cargo/bin
to your local $PATH
variable.
Copy .env.example
to .env
on your local system and edit the DATABASE_URL
value to match your target postgres instance:
DATABASE_URL=postgres://dbusername@localhost:5432/dbname
Example of what james has:
inside: example .env file
DATABASE_URL=postgres://james:MY_PASSWORD@localhost:5432/rustindexer
Below will run the actual migrations into your database and create tables.
diesel migration run
Below will run the actual program.
cargo run
A major project currently in progress uses the JsonShema
trait all CosmWasm messages derive in order to automatically construct and populate various database tables for the contract messages. This is currently disabled by default as the code doesn't function yet. We hope to make the schema indexer the primary mechanism for mapping contract messages into database tables by the time of our production releases.
akash
CLI tool installed locally- funded wallet with sufficient
$AKT
[[./akash.yaml]]
This follows an adjusted https://docs.akash.network/guides/cli/streamlined-steps
- Ensure all the images referenced by deployment are in the registries
- Add keys to funded wallet to
akash
- can be checked withakash keys list
- Generate one-time certificate for the keys using
akash tx cert
akash tx cert generate client --from $AKASH_KEY_NAME
akash tx cert publish client --chain-id akashnet-2 --from $AKASH_WALLET --gas-prices="0.025uakt" --gas="auto" --gas-adjustment=1.15
- Create deployment
akash tx --chain-id akashnet-2 --node "http://akash.c29r3.xyz:80/rpc" --from akash1rj4kqeayjz0cls95jj6jf8uzay7pnj4244zjaz deployment create indexer-akash.yaml
- Examine bids for hosting the workload
akash query --chain-id akashnet-2 --node "http://akash.c29r3.xyz:80/rpc" market bid list > bids.txt
- After identifying
provider
that meets needs, create a lease:
akash --chain-id akashnet-2 --dseq 1337 --node "http://akash.c29r3.xyz:80/rpc" tx market lease create --provider akash1vppf2922vuzgxc2jgetxtx7uxqfss59e7gha3g