目前只支持Linux 和MacOS
1梅垄、配置libra 開發(fā)環(huán)境
clone 開源代碼
$ git clone https://github.com/libra/libra.git
切換到testnet 分支
$ cd libra
$ git checkout testnet
安裝依賴
$ ./scripts/dev_setup.sh
啟動客戶端
$ ./scripts/cli/start_cli_testnet.sh
如果能接入testnet,會出現(xiàn)如下提示蔬咬,libra% 后面可以直接輸入命令乾巧。
$ ./scripts/cli/start_cli_testnet.sh
Building and running client in debug mode.
Finished dev [unoptimized + debuginfo] target(s) in 1.04s
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:
libra%
2、賬戶操作
創(chuàng)建兩個賬戶
libra% account create
>> Creating/retrieving next account from wallet
Created/retrieved account #0 address 629b769c93a77eeae0e646d25a26f17e080a0b57166feb21f7c2c82fd8306540
libra% account create
>> Creating/retrieving next account from wallet
Created/retrieved account #1 address 9f41fe295dfa16c4a63b54a5f82e5985de48f18687cfc8fd6c8a1d7f791683c3
查看賬戶列表
libra% account list
User account index: 0, address: 629b769c93a77eeae0e646d25a26f17e080a0b57166feb21f7c2c82fd8306540, sequence number: 1, status: Persisted
User account index: 1, address: 9f41fe295dfa16c4a63b54a5f82e5985de48f18687cfc8fd6c8a1d7f791683c3, sequence number: 0, status: Persisted
鑄幣
目標賬戶#0,鑄幣額100
libra% account mint 0 100
>> Minting coins
Mint request submitted
查詢賬戶余額
目標賬戶#0
libra% query balance 0
Balance is: 100.000000
目標賬戶#1
libra% query balance 1
Balance is: 0.000000
轉(zhuǎn)賬交易
轉(zhuǎn)出賬戶#0洁桌,轉(zhuǎn)入賬戶#1,金額10
libra% transfer 0 1 10
>> Transferring
Transaction submitted to validator
To query for transaction status, run: query txn_acc_seq 0 1 <fetch_events=true|false>
再次查詢賬戶余額
libra% query balance 0
Balance is: 90.000000
libra% query balance 1
Balance is: 10.000000