Giter VIP home page Giter VIP logo

mini-cosmsdk's Introduction

Mini-CosmSDK

This is minimal cosmos sdk implemented by rust

The final goal is to implement the full function of cosmos sdk

Architecture

  • 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).

Requirements

  • 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.

Running a local chain

  1. Clone this repo:
git clone https://github.com/VegeBun-csj/Mini-CosmSDK.git
cd Mini-CosmSDK
  1. Initialize a new chain:
make init
  1. Build and start the application:
make run

The application will listen for connections on tcp://127.0.0.1:26658.

  1. From a different terminal window start Tendermint:

you should have installed the tendermint and set it as the global command.

make tendermint-start

Tendermint 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.

Querying the chain

use mini-cosm as a client

  1. Install mini-cosm:
cargo run --release

set the mini-cosm as the global command.

  1. Query a balance:
mini-cosm query bank balances cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuux

Which returns:

{
  "balances": [
    {
      "denom": "uatom",
      "amount": "34"
    }
  ],
  "pagination": null
}

The balance of this address was set to 34 in the genesis file.

  1. Import the key corresponding to the above address into the mini-cosm key store:
mini-cosm keys add alice

and 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.

  1. Send tokens:
mini-cosm tx bank send alice cosmos180tr8wmsk8ugt32yynj8efqwg3yglmpwp22rut 10uatom --fee 1uatom
  1. 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 cosmos1syavy2npfyt9tcncdtsdzf7kny9lh777pahuux

Which returns:

{
  "balances": [
    {
      "denom": "uatom",
      "amount": "23"
    }
  ],
  "pagination": null
}

mini-cosmsdk's People

Contributors

vegebun-csj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.