Libra 开发指引

目前只支持Linux 和MacOS

1、配置libra 开发环境

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,会出现如下提示,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:  

Use the following commands:

account | a
    Account operations
query | q
    Query operations
transfer | transferb | t | tb
    | |  [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
    |  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、账户操作

创建两个账户

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

转账交易

转出账户#0,转入账户#1,金额10

libra% transfer 0 1 10
>> Transferring
Transaction submitted to validator
To query for transaction status, run: query txn_acc_seq 0 1 

再次查询账户余额

libra% query balance 0
Balance is: 90.000000
libra% query balance 1
Balance is: 10.000000

你可能感兴趣的:(Libra 开发指引)