| Crates.io | chainlib |
| lib.rs | chainlib |
| version | 0.1.1 |
| created_at | 2021-01-21 08:09:35.917053+00 |
| updated_at | 2021-03-10 09:58:59.396815+00 |
| description | A library to help with creating HD wallets and signing Crypto.org Chain transfer transactions offline. |
| homepage | |
| repository | https://github.com/crypto-org-chain/chainlib-rslib-rs |
| max_upload_size | |
| id | 344786 |
| size | 162,923 |
chainlib is a library to help with creating HD wallets and signing Crypto.org Chain transfer transactions offline.
Before a test, we need to send some coin amount to a HD wallet recovered from the mnemonic words.
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.
chain-maind:chain-maind tx bank send \
${from_address} \
${hd_address} \
100cro \
--keyring-backend test \
--chain-id test \
--sign-mode amino-json
cargo build --example amino
or
cargo build --example protobuf --features=grpc
cargo test --lib --all-features