To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH environment variable. Next time you log in this will be done automatically.
To configure your current shell run source $HOME/.cargo/env info: syncing channel updates for 'stable-x86_64-apple-darwin' info: checking for self-updates
You should now be able to build the project by running: source /Users/xxx/.cargo/env cargo build #如果出现下面的错误,需要安装 protobuf error: failed to run custom build command for `network v0.1.0 brew install protobuf
./scripts/cli/start_cli_testnet.sh #结果 xxxxxxxx Finished dev [unoptimized + debuginfo] target(s) in 3m 31s Running `target/debug/client --host ac.testnet.libra.org --port 8000 -s ./scripts/cli/trusted_peers.config.toml` Connected to validator at: ac.testnet.libra.org:8000 usage: <command> <args>
Use the following commands:
account | a Account operations query | q Query operations transfer | transferb | t | tb <sender_account_address>|<sender_account_ref_id> <receiver_account_address>|<receiver_account_ref_id> <number_of_coins> [gas_unit_price_in_micro_libras (default=0)] [max_gas_amount_in_micro_libras (default 10000)] Suffix 'b' is for blocking. Transfer coins (in libra) from account to another. submit | submitb | s | sb <signer_account_address>|<signer_account_ref_id> <path_to_raw_transaction> Suffix 'b' is for blocking. Load a RawTransaction from file and submit to the network help | h Prints this help quit | q! Exit this client Please, input commands:
create | c Create an account. Returns reference ID to use in other operations list | la Print all accounts that were created or loaded recover | r <file_path> Recover Libra wallet from the file path write | w <file_path> Save Libra wallet mnemonic recovery seed to disk mint | mintb | m | mb <receiver_account_ref_id>|<receiver_account_address> <number_of_coins> Mint coins to the account. Suffix 'b' is for blocking libra% account create >> Creating/retrieving next account from wallet Created/retrieved account #0 address 4be45f015f45a2968d68a2ac56ebd1bfa05a43f87fefb2f5327bea292c354ece libra% account create >> Creating/retrieving next account from wallet Created/retrieved account #1 address b83ef4576f74faa787abc8233a501540dcbb9ede236ee967535051ac8c8f6fab
#0是账户索引,十六进制字符串是账号地址
转账
1 2 3
libra% account mint 0 110 >> Minting coins Mint request submitted
0 是账户索引
110 是往账户添加的金额
第二个账户也进行相同的操作,需要注意的是,只是发出了命令进行增加,还需要确认账户中的金额
1 2 3 4
libra% query balance 0 Balance is: 110.000000 libra% query balance 1 Balance is: 52.000000
可以看到对应的金额已经添加到账户
提交交易
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
libra% query sequence 0 >> Getting current sequence number Sequence number is: 0 libra% query sequence 1 >> Getting current sequence number Sequence number is: 0 libra% transfer 0 1 10 >> Transferring Transaction submitted to validator To query for transaction status, run: query txn_acc_seq 0 0 <fetch_events=true|false> libra% query sequence 0 >> Getting current sequence number Sequence number is: 1 libra% query balance 0 Balance is: 100.000000 libra% query balance 1 Balance is: 62.000000