1 unstable release
0.0.3 | Feb 14, 2021 |
---|
#9 in #abci
5KB
60 lines
Substrate Node with Cosmos ABCI pallet
A new FRAME-based Substrate node with Cosmos ABCI.
Documentation
Documentation for this project is here
Build
Install Rust:
curl https://sh.rustup.rs -sSf | sh
Initialize your Wasm Build environment:
./scripts/init.sh
Build Wasm and native code:
cargo build
For building node with selected consensus
- cargo build -Z package-features --package pallet-cosmos-abci --features "std <consensus_pallet_name>" --no-default-features
- cargo build -Z package-features --package runtime --features "std <consensus_pallet_name>" --no-default-features
- cargo build --workspace --features "<consensus_pallet_name>" --no-default-features
Run
Before running substrate node, you should build and start cosmos node. Go to the our fork of the cosmos-sdk, switch to the branch feature/add_nameservice, then just follow instractions.
To run node locally you will need to specify the environment variables for cosmos-abci pallet.
export ABCI_SERVER_URL=tcp://localhost:26658
export ABCI_GENESIS_STATE_PATH=$HOME/.nsd/config/genesis.json
# or
export ABCI_GENESIS_STATE=$(cat $HOME/.nsd/config/genesis.json)
After any updating of the genesis.json file should specify following encironment variable
export ABCI_GENESIS_STATE=$(cat $HOME/.nsd/config/genesis.json)
Tests
Pallets tests
To run tests from local use commands:
# pallet-cosmos-abci
cargo test --test cosmos_abci_unit_test
# pallet-abci
cargo test --test abci_integration_test
cargo test --test abci_unit_test
sh integration tests
Follow to the scripts/integration_tests directory
Single Node Development Chain
Purge any existing developer chain state:
rm -rf abci_storage_rocksdb
./target/release/node-template purge-chain --dev
Start a development chain with:
./target/release/node-template --dev
Detailed logs may be shown by running the node with the following environment variables set: RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- --dev
.
Run in Docker
First, install Docker and Docker Compose.
Then run the following command to start a single node development chain. Also, sometimes you have to share permission for the .maintain
folder in Docker settings.
./scripts/docker_run.sh
Or:
docker-compose up -d
CosmosRPC REST calls
- Request to CosmosRPC API:
{ "jsonrpc": "2.0", "method": <method_name>, "id": 0, "params": <method_params> }
Dependencies
~33MB
~654K SLoC