Giter VIP home page Giter VIP logo

chainlib-rs's Introduction

๐Ÿšจ DEPRECATED ๐Ÿšจ

This repo has been deprecated. You can use the "cosmrs" crate of cosmos/cosmos-rust instead. Please reference that repository in the future.


chainlib is a library to help with creating HD wallets and signing Crypto.org Chain transfer transactions offline.

prepare

Before a test, we need to send some coin amount to a HD wallet recovered from the mnemonic words.

  1. transfer some coin to a mnemonic words-recovered account; to get the HD address, you can use the following code:
let words = "dune car envelope chuckle elbow slight proud fury remove candy uphold puzzle call select sibling sport gadget please want vault glance verb damage gown";
let mnemonic = Mnemonic::from_str(words, password)?;
let key_service = PrivateKeyService::new_from_mnemonic(mnemonic)?;
let address = key_service.address()?;
let address_str = address.to_bech32("cro");
println!("{}", address_str);

or you can recover mnemonic to a local storage: chain-maind keys add hd-wallet --keyring-backend test --recover and use chain-maind keys list --keyring-backend test to see the address.

  1. Transfer some coin amount to the recovered HD address using chain-maind:
chain-maind tx bank send \
    ${from_address} \
    ${hd_address} \
    100cro \
    --keyring-backend test \
    --chain-id test \
    --sign-mode amino-json
  1. There are some coins in the HD wallet now, you can test to sign offline and send the signed transaction to Chain API URL. To see the full detail, go to the examples directory.

build examples

cargo build --example amino

or

cargo build --example protobuf --features=grpc

unit test

cargo test --lib --all-features

chainlib-rs's People

Contributors

dependabot[bot] avatar devashishdxt avatar linfeng-crypto avatar tomtau 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.