Libra客户端使用

Libra CLI

Posted by hello2mao on December 29, 2019

1. libra net

1.1. test net

简单版,有脚本:

sh scripts/cli/start_cli_testnet.sh

实际执行的命令是:

cargo run -p client -- --host ac.testnet.libra.org --port 8000 -r

也就是说测试网的AC地址是:ac.testnet.libra.org:8000

1.2. local net

通过swarm启动本地libra节点。

cargo run -p libra-swarm -- -s

指定节点数据目录:

cargo run -p libra-swarm -- -s -c ~/libra/swarmTmpDir -l

注:每次重启的时候,数据目录都会被自动清空。

2. CLI cmd

2.1. client help

cargo run --bin client -- -h                                    
libra-client 0.1.0
The Libra Association
Libra client to connect to a specific validator

USAGE:
    client [FLAGS] [OPTIONS] --host <host>

FLAGS:
    -h, --help       Prints help information
    -r, --sync       If set, client will sync with validator during wallet recovery.
    -V, --version    Prints version information
    -v, --verbose    Verbose output.

OPTIONS:
    -m, --faucet-key-file-path <faucet-account-file>
            Path to the generated keypair for the faucet account. The faucet account can be used to mint coins. If not
            passed, a new keypair will be generated for you and placed in a temporary directory. To manually generate a
            keypair, use generate-keypair: `cargo run -p generate-keypair -- -o <output_file_path>`
    -f, --faucet-server <faucet-server>
            Host that operates a faucet service If not passed, will be derived from host parameter

    -a, --host <host>                                   Host address/name to connect to.
    -n, --mnemonic-file <mnemonic-file>
            File location from which to load mnemonic word for user account address/key generation. If not passed, a new
            mnemonic file will be generated by libra-wallet in the current directory.
    -p, --port <port>                                   Admission Control port to connect to. [default: 8000]
    -w, --waypoint <waypoint>
            If set, a client uses the waypoint parameter for its initial LedgerInfo verification.

2.2. client example

cargo run --bin client -- -a localhost -p 57313 -m "./mint.key"

2.3. CLI cmd

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 140000)] Suffix 'b' is for blocking. 
        Transfer coins (in libra) from account to another.
dev 
        Local move development
help | h 
        Prints this help
quit | q! 
        Exit this client
  • account:账户相关
  • query:查询相关
  • transfer:转账相关
  • dev:Move开发相关

3. account

3.1. account help

usage: account <arg>

Use the following args for this command:

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
  • create:创建账户
  • list:账户列表
  • recover:从助记词恢复钱包
  • write:备份钱包到本地
  • mint:给账户挖矿

3.2. account create

创建账户:

libra% account c
>> Creating/retrieving next account from wallet
Created/retrieved account #1 address 777e2e4c9148f11e173785de6a48c8033c55c34a3bf127993a6aea5391aff506

3.3. account list

查询账户列表:

libra% account la
User account index: 0, address: 9680e6a31f7fb0248f31044f4c410035c7eff2dff53b585f4d82d04df9ce3fcb, sequence number: 0, status: Persisted
User account index: 1, address: 777e2e4c9148f11e173785de6a48c8033c55c34a3bf127993a6aea5391aff506, sequence number: 0, status: Local
User account index: 2, address: 9e3a218a3c7713565ee02f394b490f8beb5acc927107ddc6fdfa2a8c0baa0e6a, sequence number: 0, status: Unknown

注意,账户有三种状态:

  • Local:还没发生过交易的账户,只存在于本地
  • Persisted:已经发生过交易的账户,已经入链了
  • Unknown:状态未知,可以通过后续操作恢复状态

3.4. account write

保存账户助记词:

libra% account w /Users/mhb/libra/testnet/mnemonic.txt
>> Saving Libra wallet mnemonic recovery seed to disk
Saved mnemonic seed to disk

3.5. account recover

恢复钱包:

libra% account la
No user accounts
libra% account r /Users/mhb/libra/testnet/mnemonic.txt
>> Recovering Wallet
Wallet recovered and the first 4 child accounts were derived
#0 address 9680e6a31f7fb0248f31044f4c410035c7eff2dff53b585f4d82d04df9ce3fcb
#1 address 777e2e4c9148f11e173785de6a48c8033c55c34a3bf127993a6aea5391aff506
#2 address 9e3a218a3c7713565ee02f394b490f8beb5acc927107ddc6fdfa2a8c0baa0e6a
#3 address 38edd85181c93fbc50d189d24efccdb372c118a7ad73bf92777cec2be4f60537
libra% account la
User account index: 0, address: 9680e6a31f7fb0248f31044f4c410035c7eff2dff53b585f4d82d04df9ce3fcb, sequence number: 0, status: Local
User account index: 1, address: 777e2e4c9148f11e173785de6a48c8033c55c34a3bf127993a6aea5391aff506, sequence number: 0, status: Local
User account index: 2, address: 9e3a218a3c7713565ee02f394b490f8beb5acc927107ddc6fdfa2a8c0baa0e6a, sequence number: 0, status: Local
User account index: 3, address: 38edd85181c93fbc50d189d24efccdb372c118a7ad73bf92777cec2be4f60537, sequence number: 0, status: Local

可以看到,恢复钱包后,账户的status都是Local
如果在启动client的时候指定-r参数,那么在recovery的时候才会与验证节点同步数据,status才会符合实际情况。

3.6. account mint

给账户挖矿奖励:

libra% account mint 0 100
>> Minting coins
Mint request submitted
libra% query balance 0
Balance is: 100.000000

4. query

4.1. query help

usage: query <arg>

Use the following args for this command:

balance | b <account_ref_id>|<account_address>
        Get the current balance of an account
sequence | s <account_ref_id>|<account_address> [reset_sequence_number=true|false]
        Get the current sequence number for an account, and reset current sequence number in CLI (optional, default is false)
account_state | as <account_ref_id>|<account_address>
        Get the latest state for an account
txn_acc_seq | ts <account_ref_id>|<account_address> <sequence_number> <fetch_events=true|false>
        Get the committed transaction by account and sequence number.  Optionally also fetch events emitted by this transaction.
txn_range | tr <start_version> <limit> <fetch_events=true|false>
        Get the committed transactions by version range. Optionally also fetch events emitted by these transactions.
event | ev <account_ref_id>|<account_address> <sent|received> <start_sequence_number> <ascending=true|false> <limit>
        Get events by account and event type (sent|received).

有六个功能,分别是:

  • balance:查询账户余额
  • sequence:查询seq
  • account_state:查询账户状态
  • txn_acc_seq:根据账户和seq查询交易
  • txn_range:根据version查询交易
  • event:查询事件

4.2. query balance

查询账户余额:

libra% query balance 0
Balance is: 100.000000

4.3. query sequence

查询账号的sequence num,类似eth的nonce。

libra% query sequence 0
>> Getting current sequence number
Sequence number is: 0

4.4. query account_state

查询账户的状态:

libra% query account_state 0
>> Getting latest account state
Latest account state is: 
 Account: d847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef
 State: Some(
    AccountStateBlob { 
     Raw: 0x01000000210000000116608f05d24742a043e6fd12d3b32735f6bfcba287bea92b28a175cd4f3eee32a600000020000000d847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef804a5d050000000000000100000000000000280000000000000000000000d847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef0100000000000000280000000100000000000000d847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef01000000000000000200000000000000 
     Decoded: AccountResource {
        authentication_key: 0xd847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef,
        balance: 90000000,
        delegated_key_rotation_capability: false,
        delegated_withdrawal_capability: false,
        received_events: EventHandle {
            count: 1,
            key: EventKey([0, 0, 0, 0, 0, 0, 0, 0, 216, 71, 247, 209, 165, 242, 180, 214, 109, 189, 194, 182, 169, 250, 225, 104, 162, 99, 59, 99, 49, 81, 111, 56, 51, 115, 31, 55, 155, 234, 189, 239]),
        },
        sent_events: EventHandle {
            count: 1,
            key: EventKey([1, 0, 0, 0, 0, 0, 0, 0, 216, 71, 247, 209, 165, 242, 180, 214, 109, 189, 194, 182, 169, 250, 225, 104, 162, 99, 59, 99, 49, 81, 111, 56, 51, 115, 31, 55, 155, 234, 189, 239]),
        },
        sequence_number: 1,
        event_generator: 2,
    } 
     },
)
 Blockchain Version: 2141

4.5. query txn_acc_seq

查询交易:

  • 根据<Address, seq_number>二元组查询tx
  • 可以看出,Libra中把(Address,seq_number)二元组作为Tx唯一的ID
libra% query txn_acc_seq 0 2 true
>> Getting committed transaction by account and sequence number
Committed transaction: SignedTransaction { 
 raw_txn: RawTransaction { 
        sender: 6709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd5, 
        sequence_number: 2, 
        payload: {, 
                transaction: peer_to_peer_transaction, 
                args: [ 
                        {ADDRESS: 4f016b080d7c0893c3373ddcd03b0222cb9c1b1ecc0eefe6497ac0b9d0c11105},
                        {U64: 10000000}, 
                ]
        }, 
        max_gas_amount: 140000, 
        gas_unit_price: 0, 
        expiration_time: 1577595210s, 
}, 
 public_key: Ed25519PublicKey(
    PublicKey(CompressedEdwardsY: [6, 25, 23, 161, 62, 96, 242, 1, 190, 135, 58, 168, 108, 65, 173, 220, 59, 187, 51, 34, 35, 0, 183, 53, 210, 12, 143, 190, 108, 178, 3, 39]), EdwardsPoint{
        X: FieldElement51([1550094164466190, 1679413114278021, 1093569941537171, 1278451711145295, 1681010043602425]),
        Y: FieldElement51([668772060305670, 1571233539276862, 227517024875781, 1804413932933521, 686349309700336]),
        Z: FieldElement51([1, 0, 0, 0, 0]),
        T: FieldElement51([2041895757514092, 1504823390022451, 1372279050267214, 799755937010041, 711304873513269])
    }),
), 
 signature: Ed25519Signature(
    Signature( R: CompressedEdwardsY: [127, 239, 185, 74, 75, 140, 104, 154, 248, 173, 196, 141, 113, 77, 216, 162, 159, 199, 205, 175, 240, 191, 18, 220, 91, 70, 44, 27, 53, 5, 208, 205], s: Scalar{
        bytes: [139, 212, 175, 90, 8, 98, 249, 199, 234, 36, 154, 51, 20, 130, 86, 142, 53, 38, 244, 199, 116, 81, 213, 135, 36, 39, 224, 4, 95, 169, 56, 3],
    } ),
), 
 }
Events: 
ContractEvent { key: 01000000000000006709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd5, index: 1, type: Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000000, module: Identifier("LibraAccount"), name: Identifier("SentPaymentEvent"), type_params: [] }), event_data: SentPaymentEvent { amount: 10000000, receiver: 4f016b080d7c0893c3373ddcd03b0222cb9c1b1ecc0eefe6497ac0b9d0c11105, metadata: [] } }
ContractEvent { key: 00000000000000004f016b080d7c0893c3373ddcd03b0222cb9c1b1ecc0eefe6497ac0b9d0c11105, index: 0, type: Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000000, module: Identifier("LibraAccount"), name: Identifier("ReceivedPaymentEvent"), type_params: [] }), event_data: ReceivedPaymentEvent { amount: 10000000, sender: 6709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd5, metadata: [] } }

4.6. query txn_range

查询指定版本范围内的tx,类似eth中查询某个块内的交易,但这个是返回一个范围内的块内的所有交易。

例如下面是查询0~5内的交易:

libra% query txn_range 0 5 true
>> Getting committed transaction by range
Transaction at version 0: SignedTransaction { 
 raw_txn: RawTransaction { 
        sender: 000000000000000000000000000000000000000000000000000000000a550c18, 
        sequence_number: 0, 
        payload: {, 
                transaction: genesis, 
                args: [  
                ]
        }, 
        max_gas_amount: 0, 
        gas_unit_price: 0, 
        expiration_time: 18446744073709551615s, 
}, 
 public_key: Ed25519PublicKey(
    PublicKey(CompressedEdwardsY: [120, 21, 52, 114, 228, 128, 224, 34, 44, 228, 154, 192, 72, 233, 201, 21, 188, 251, 78, 70, 156, 179, 136, 141, 105, 218, 48, 246, 83, 169, 17, 185]), EdwardsPoint{
        X: FieldElement51([2002632779867105, 1665763369976085, 1537667075492595, 840678826865876, 1978844676009126]),
        Y: FieldElement51([141718656914808, 307946412409948, 347372397209509, 1465403185942051, 1003968289268493]),
        Z: FieldElement51([1, 0, 0, 0, 0]),
        T: FieldElement51([515806118991800, 142632258185741, 1353427249662376, 1220398131471166, 994198507612271])
    }),
), 
 signature: Ed25519Signature(
    Signature( R: CompressedEdwardsY: [40, 52, 110, 161, 71, 165, 192, 148, 246, 212, 43, 4, 198, 233, 68, 178, 53, 163, 80, 186, 64, 222, 9, 162, 14, 65, 183, 39, 124, 139, 137, 225], s: Scalar{
        bytes: [146, 245, 129, 211, 61, 58, 221, 114, 93, 138, 138, 161, 102, 166, 206, 47, 19, 255, 0, 178, 20, 175, 69, 151, 184, 113, 249, 113, 158, 206, 92, 0],
    } ),
), 
 }
ContractEvent { key: 0000000000000000000000000000000000000000000000000000000000000000000000000a550c18, index: 0, type: Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000000, module: Identifier("LibraAccount"), name: Identifier("SentPaymentEvent"), type_params: [] }), event_data: SentPaymentEvent { amount: 1000000000, receiver: 000000000000000000000000000000000000000000000000000000000a550c18, metadata: [] } }
ContractEvent { key: 0100000000000000000000000000000000000000000000000000000000000000000000000a550c18, index: 0, type: Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000000, module: Identifier("LibraAccount"), name: Identifier("ReceivedPaymentEvent"), type_params: [] }), event_data: ReceivedPaymentEvent { amount: 1000000000, sender: 000000000000000000000000000000000000000000000000000000000a550c18, metadata: [] } }
ContractEvent { key: EventKey([2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 216]), index: 0, type: Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000000, module: Identifier("LibraSystem"), name: Identifier("ValidatorSetChangeEvent"), type_params: [] }), event_data: "01000000f3616cc079c0be423d52a6eb5de329515698e540405c309b50bbe3c613fdea5e200000002b02bc1fd8f130a89a3e7af992313719b22435992967d660ad091a2e142506e801000000000000002000000062e6ba0565068f78864a79a124e5ffb8e0fe5b835eb0ba3db35ad337add1edb82000000045671fd489b12176799c765fb78e851240505132a4bb6e6b739e151cfb84185c" }
ContractEvent { key: EventKey([2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 21, 192]), index: 0, type: Struct(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000000, module: Identifier("LibraSystem"), name: Identifier("DiscoverySetChangeEvent"), type_params: [] }), event_data: "01000000f3616cc079c0be423d52a6eb5de329515698e540405c309b50bbe3c613fdea5e2000000045671fd489b12176799c765fb78e851240505132a4bb6e6b739e151cfb84185c08000000047f0000010604d2200000007f937fcb47c4184cd5798b9a345e372c15326b30a0d0c7bc87887be204c1914708000000047f0000010604d2" }
Transaction at version 1: block_metadata
No events returned
Transaction at version 2: block_metadata
No events returned
Transaction at version 3: block_metadata
No events returned
Transaction at version 4: block_metadata
No events returned

4.7. query event

查询event:

libra% query event 0 sent 2 true 10
>> Getting events by account and event type.
No events returned
Last event state: AccountStateWithProof {
    version: 6022,
    blob: Some(
        AccountStateBlob { 
         Raw: 0x02000000210000000045d8ba175ed28d8bbd0c9a41b6a3a97d67d1b6a2a83e8a9aa3c2b16fd128a594cb000000a11ceb0b010008014f000000040000000253000000040000000357000000030000000c5a0000000a0000000d64000000050000000569000000180000000481000000400000000ac10000000a0000000000010101020100000300020108000001080000000301080000084d794d6f64756c65094c69627261436f696e01540269646709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd50000000000000000000000000000000000000000000000000000000000000000000100010002000b0002210000000116608f05d24742a043e6fd12d3b32735f6bfcba287bea92b28a175cd4f3eee32a6000000200000006709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd5804a5d0500000000000002000000000000002800000000000000000000006709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd502000000000000002800000001000000000000006709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd503000000000000000200000000000000 
         Decoded: AccountResource {
            authentication_key: 0x6709671732de4366d7b8c5d8a777c906f70cbab033fbb580a5ea1f64f4a59bd5,
            balance: 90000000,
            delegated_key_rotation_capability: false,
            delegated_withdrawal_capability: false,
            received_events: EventHandle {
                count: 2,
                key: EventKey([0, 0, 0, 0, 0, 0, 0, 0, 103, 9, 103, 23, 50, 222, 67, 102, 215, 184, 197, 216, 167, 119, 201, 6, 247, 12, 186, 176, 51, 251, 181, 128, 165, 234, 31, 100, 244, 165, 155, 213]),
            },
            sent_events: EventHandle {
                count: 2,
                key: EventKey([1, 0, 0, 0, 0, 0, 0, 0, 103, 9, 103, 23, 50, 222, 67, 102, 215, 184, 197, 216, 167, 119, 201, 6, 247, 12, 186, 176, 51, 251, 181, 128, 165, 234, 31, 100, 244, 165, 155, 213]),
            },
            sequence_number: 3,
            event_generator: 2,
        } 
         },
    ),
    proof: AccountStateProof {
        ledger_info_to_transaction_info_proof: AccumulatorProof { siblings: [HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000), HashValue(3355e1f0bcd170a3c5fa12942fca41adefa40fd9c4c16d572b5b44af7d09de7f), HashValue(16f32e51d747628047bce3ac3272409f9724ca8fc5ca6ff860b183f481919754), HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000), HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000), HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000), HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000), HashValue(a4e16e947688a6ac31c12d040457f3af601d39b22cea9043f578a52d500c1487), HashValue(93253ebebbf18e03239ef77c27f60b5d8752d32a4151fd306e6f071f40c26b3c), HashValue(c6b94437d0a5fd6c35cf5cab56af36403b9ea5f14fb56aea29481c2b67f2f2a3), HashValue(5f5c13446adcfd5662f845723201b5ef3bb75ed5a70943d81cbc7005b2ee8fc4), HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000), HashValue(39a1debd6ca2b355209542c933b7a5458959b9ca82d6df7f4a56f173a9be53d1)] },
        transaction_info: TransactionInfo {
            transaction_hash: HashValue(c82cd8d4c58f2a0e93ef63b703f1a26e5442f0cb059f7bff1ca69b04356e9e41),
            state_root_hash: HashValue(e84cb99086b44995d70602f4bcf4567ed1d8fd031b6b88796f2a140d476a5fa8),
            event_root_hash: HashValue(414343554d554c41544f525f504c414345484f4c4445525f4841534800000000),
            gas_used: 0,
            major_status: EXECUTED,
        },
        transaction_info_to_account_proof: SparseMerkleProof {
            leaf: Some(
                (
                    HashValue(8be2bee1b61fb7991c2752c1654895414582d104967e87495c3fd5b6205a6a97),
                    HashValue(0c8d8a4b6a1aacee5e2172cbdbc8e57d0d393cae523e641ff37635725c612e1e),
                ),
            ),
            siblings: [
                HashValue(caa3b3e6eb63f680ef23af0b52b9f83009ca98511a4845e9f10dd56d93f97aaf),
                HashValue(5350415253455f4d45524b4c455f504c414345484f4c4445525f484153480000),
                HashValue(c2e8bd85170c9da3c652c711086e9ec650e6c59764d971efd65c5b8589bf73c0),
                HashValue(30ed8c58ca5a421657140cb31ddb977c9c460227212d0fc27b5750ffcffd4dfa),
            ],
        },
    },
}

5. transfer

5.1. transfer help

transfer
Invalid number of arguments for transfer
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 140000)] Suffix 'b' is for blocking. 

转账功能。

5.2. transfer

转账,从0账户给1账户转10个币

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>

6. dev

6.1. dev help

usage: dev <arg>

Use the following args for this command:

compile | c <sender_account_address>|<sender_account_ref_id> <file_path> <module|script> [output_file_path (compile into tmp file by default)]
        Compile move program
publish | p <sender_account_address>|<sender_account_ref_id> <compiled_module_path>
        Publish move module on-chain
execute | e <sender_account_address>|<sender_account_ref_id> <compiled_module_path> [parameters]
        Execute custom move script
add_validator <validator_account_address>
        Add an account address to the validator set
remove_validator <validator_account_address>
        Remove an existing account address from the validator set
gen_waypoint 
        Generate a waypoint for the latest epoch change LedgerInfo

6.2. dev compile

6.2.1. Compile Move Module

libra% dev compile 0 /Users/mhb/libra/move/my_module.mvir module
>> Compiling program
    Finished dev [unoptimized + debuginfo] target(s) in 0.79s
     Running `target/debug/compiler -l /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/a2349d08558aaa879642188a9fd45061.mvir -m`
    Finished dev [unoptimized + debuginfo] target(s) in 1.41s
     Running `target/debug/compiler /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/a2349d08558aaa879642188a9fd45061.mvir -a d847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef -m`
Successfully compiled a program at /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/a2349d08558aaa879642188a9fd45061.mv

6.2.2. Compile Transaction Script

libra% dev compile 0 /Users/mhb/libra/move/custom_script.mvir script
>> Compiling program
    Finished dev [unoptimized + debuginfo] target(s) in 0.49s
     Running `target/debug/compiler -l /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/e4fc5822da70b1cd3ab6f639c86c311a.mvir`
    Finished dev [unoptimized + debuginfo] target(s) in 1.20s
     Running `target/debug/compiler /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/e4fc5822da70b1cd3ab6f639c86c311a.mvir -a d847f7d1a5f2b4d66dbdc2b6a9fae168a2633b6331516f3833731f379beabdef --deps=/var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/aee5bff9370e1fc1945f1f1a5fb5dd1f`
Successfully compiled a program at /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/e4fc5822da70b1cd3ab6f639c86c311a.mv

6.3. dev publish

发布Move模块

libra% dev publish 0 /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/a2349d08558aaa879642188a9fd45061.mv
waiting ............................transaction is stored!
no events emitted
Successfully published module

6.4. dev execute

执行Move脚本

libra% dev execute 0 /var/folders/tw/zcq5f7lj3hqbsg0n2zgv9jtr0000gn/T/373572df4993d62be5e0b0845a23d137.mv 10
waiting ................................transaction is stored!
Successfully finished execution

6.5. dev add_validator

增加验证节点

libra% dev add_validator 9e3a218a3c7713565ee02f394b490f8beb5acc927107ddc6fdfa2a8c0baa0e6a
waiting ..........................transaction is stored!
no events emitted
Successfully finished execution

6.6. dev remove_validator

删除验证节点

libra% dev remove_validator 9e3a218a3c7713565ee02f394b490f8beb5acc927107ddc6fdfa2a8c0baa0e6a
waiting ...........................transaction is stored!
no events emitted
Successfully finished execution

6.7. dev gen_waypoint

生成waypoint

libra% dev remove_validator 9e3a218a3c7713565ee02f394b490f8beb5acc927107ddc6fdfa2a8c0baa0e6a
waiting ...........................transaction is stored!
no events emitted
Successfully finished execution
libra% dev gen_waypoint
Retrieving the uptodate ledger info...
Waypoint (end of epoch 0, time 1970-01-01 00:00:00 UTC): 0:150d058cd1940999a1d9d30705316f90d1aabc66688898311e8731fe302dd0b8