This is minimal cosmos sdk implemented by rust
The final goal is to implement the full function of cosmos sdk
-
mini-cosm: Start command cli
-
modules: Base app and some cosmos modules
Mini-CosmSDK uses the tendermint-abci crate to communicate with a consensus instance which runs as a separate process. Tendermint must be installed and run separately (see instructions below).
- Rust compiler
The minimum supported Rust version is 1.67.1. Follow the installation instructions.
- Tendermint
we uses Tendermint version v0.34.21. After cloning the Tendermint repo checkout v0.34.21 then follow the installation instructions.
- Clone this repo:
git clone https://github.com/VegeBun-csj/Mini-CosmSDK.git
cd Mini-CosmSDK- Initialize a new chain:
make init- Build and start the application:
make runThe application will listen for connections on tcp://127.0.0.1:26658.
- From a different terminal window start Tendermint:
you should have installed the tendermint and set it as the global command.
make tendermint-startTendermint will connect to the application and bind it's RPC server to 127.0.0.1:26657.
The chain (consisting of one node) is now up and running.
use mini-cosm as a client
- Install mini-cosm:
cargo run --releaseset the mini-cosm as the global command.
- Query a balance:
mini-cosm query bank balances cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuuxWhich returns:
{
"balances": [
{
"denom": "uatom",
"amount": "34"
}
],
"pagination": null
}The balance of this address was set to 34 in the genesis file.
- Import the key corresponding to the above address into the mini-cosm key store:
mini-cosm keys add aliceand import with race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow.
- Send tokens:
mini-cosm tx bank send alice cosmos180tr8wmsk8ugt32yynj8efqwg3yglmpwp22rut 10uatom --fee 1uatom- Query the address balance and observe that it has decreased by 11uatom which is the sum of the amount transferred and the fee:
mini-cosm query bank balances cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuuxWhich returns:
{
"balances": [
{
"denom": "uatom",
"amount": "23"
}
],
"pagination": null
}