Skip to content

dcgraph/bvs-cosmos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bvs-cosmos

BVS demo using cosmos-sdk

work logs

  1. Copied basecoin example from cosmos-sdk
  2. Rebranding: Basecoin → BVS or Bvs
  3. Added test-purpose genesis.json with pre-allocated assets
  4. Added Travis CI configuration (build only for now, no deploy)
  5. Added several types for BVS application

build and install

  1. install golang (see cosmos doc)
  2. install dep command go get dep
  3. clone this repo into $GOPATH/src/github.com/dcgraph/bvs-cosmos
  4. cd to $GOPATH/src/github.com/dcgraph/bvs-cosmos
  5. run dep ensure -v
  6. run make (build and test)
  7. run make install (build and install)

bvsd test run

  1. run bvsd init
  2. copy testdata/genesis.json to $HOME/.bvsd/config/genesis.json or simply run make install again
  3. run bvsd start
  4. wait until the first block generated and committed
  5. press ^C to stop bvsd
  6. run bvsd export to see internal state of bvsd

cli test

In one terminal:

  1. run bvsd start (leave this terminal)

In another terminal:

  1. run bvscli status
  2. run bvscli account ...
  3. run bvscli codex ...
  4. run bvscli voucher ...
  5. run bvscli send ...
  6. ...

See Gaia CLI document for more information.

notes on codes

  • BvsApp in app/app.go is a fork of Basecoin example, which implements ABCI application in cosmos terms.
  • types:
    • UserAccount means every user account associated with a private key.
      • UserAccount is an extension of BaseAccount. So, in order to handle genesis state this type needs GenesisAccount which has flat member fields.
      • UserAccount has Address(type sdk.AccAddress) member to handle operations associated with digital signatures.
      • UserAccount also has Id(type string) member to handle BVS-related operations.
    • Codex and Voucher are system account without private key associated.
      • They are simple structs and do not need GenesisSomething struct to handle genesis state.
      • Codex and Voucher have Id member to handle BVS-related operations.
  • data stores:
    • Account KVStore stores user accounts with the help of AccountMapper.
    • Codex KVStore stores codex accounts with the help of CodexMapper.
    • Voucher KVStore stores vouchers with the help of VoucherMapper.
  • BVS asset
    • BvsAsset in types/voucher.go represent arbitrary asset in BVS environment.
    • BvsAsset shall be moved into types/asset.go.
    • UserAccount and Codex can hold coins, which are handled as sdk.Coins.
    • UserAccount and Codex use cosmos-sdk/x/bank module in order to handle sdk.Coins.

About

BVS on Cosmos Network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors