Package: violas-client
ViolasClient是工具集合，他提供以下两种方式与Violas Network进行交互:1.violas_shell, 与violas交互的shell程序2.python api, 客户端访问Violas的api集合。python程序员使用此客户端来与violas network进行交互安装$pip3installviolas-clientviolas_shell的使用方式:搭建一个violas节点,终端输入"violas_shell"命令,如下本地搭建所示:$violas_shell-alocalhost-p36723-s"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml"-m"/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys"-a: host  -p: port  -s: 共识节点的基本信息  -m: mint许可地址的相关信息连接Violas Network成功后如下:查看关于violas的指令:创建第一笔violas交易第一步:创建两个账户violas%accountcreate
>>Creating/retrievingnextaccountfromwallet
Created/retrievedaccount#0 address 6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627aviolas%accountcreate
>>Creating/retrievingnextaccountfromwallet
Created/retrievedaccount#1 address bce9dece4f3cb14374993421a5e2095f25552e3528f007cbd91ad214ab752a50第二步:向两个账户mint平台币violas%accountmint0100>>Mintingcoinsargs=[<libra.transaction.transaction_argument.TransactionArgumentobjectat0x7f512ee635c0>,<libra.transaction.transaction_argument.TransactionArgumentobjectat0x7f512ee63588>]Mintrequestsubmitted
violas%accountmint1100>>Mintingcoinsargs=[<libra.transaction.transaction_argument.TransactionArgumentobjectat0x7f512ee63d68>,<libra.transaction.transaction_argument.TransactionArgumentobjectat0x7f512ee63a20>]Mintrequestsubmitted第三步:一个账户发布稳定币violas%vp0>>Publishingmodule
Publishrequestsubmitted
violas%qas0>>Gettinglatestaccountstate
Latestaccountstateis:Account:6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627aState:{ordered_map:{b'\x00\xdai\xc8]\xe1\xd9^\nDz}\xa3\x9e|2X\xa2\xc0\xa7\x02=9\x9d\x9bg=\x96,&8\xb6=':4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e746f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a00000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102,b'\x01!}\xa6\xc6\xb3\xe1\x9f\x18%\xcf\xb2gm\xae\xcc\xe3\xbf=\xe0<\xf2fG\xc7\x8d\xf0\x0b7\x1b%\xcc\x97':200000006f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a00e1f505000000000000010000000000000020000000799ef8e880dc7e37b1c223d0a84f0dbdba709dcc7a725747b519db33e487fe400000000000000000200000001b70c022d0c185e449f859da24825ae4c67de7675e4a47ec04f7c97cb986f8850100000000000000,},}Decoded:{authentication_key:6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a,balance:100000000,delegated_key_rotation_capability:False,delegated_withdrawal_capability:False,received_events:{count:1,key:799ef8e880dc7e37b1c223d0a84f0dbdba709dcc7a725747b519db33e487fe40,},sent_events:{count:0,key:1b70c022d0c185e449f859da24825ae4c67de7675e4a47ec04f7c97cb986f885,},sequence_number:1,}BlockchainVersion:3第四步:两个账户对该币初始化：violas%vi00>>Initingmodule
initrequestsubmitted
violas%vi10>>Initingmodule
initrequestsubmitted第五步:发送mint交易到一账户:violas%vm01000>>Mintingcoins
Mintrequestsubmitted
violas%vb00Balanceis:100.0第六步:发送交易violas%vt01200>>Transferring
Transactionsubmittedtovalidator
Toqueryfortransactionstatus,run:querytxn_acc_seq00<fetch_events=true|false>
violas%violas%vb00Balanceis:80.0
violas%vb10Balanceis:20.0python api使用创建和导入钱包importlibra# Create a new random walletwallet=libra.WalletLibrary.new()# Create a new wallet from mnemonic wordswallet=libra.WalletLibrary.new_from_mnemonic(mnemonic,child_count)# Recover wallet from a offical Libra CLI backup filewallet=libra.WalletLibrary.recover(filename)创建账户print(wallet.child_count)account1=wallet.new_account()print(wallet.child_count)print(account1.address)print(account1.public_key)print(account1.private_key)客户端连接节点fromlibraimportClientclient2=Client.new('localhost',8000,"validator_file_path")# Client connecting to a local node获取地址的账户信息# An account stores its data in a directory structure, for example:
#   <Alice>/balance:   10
#   <Alice>/a/b/mymap: {"Bob" => "abcd", "Carol" => "efgh"}
#   <Alice>/a/myint:   20
#   <Alice>/c/mylist:  [3, 5, 7, 9]
#
# If someone needs to query the map above and find out what value associated with "Bob" is,
# `address` will be set to Alice and `path` will be set to "/a/b/mymap/Bob".
#
# On the other hand, if you want to query only <Alice>/a/*, `address` will be set to Alice and
# `path` will be set to "/a" and use the `get_prefix()` method from statedb获取地址的账户状态块fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml")blob,version=client.get_account_blob("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a")print(type(version),version)print(type(blob),blob)输出<class 'int'> 7
<class 'account_state_blob_pb2.AccountStateBlob'> blob: "\006\000\000\000!\000\000\000\000\332i\310]\341\331^\nDz}\243\236|2X\242\300\247\002=9\235\233g=\226,&8\266=h\004\000\000LIBRAVM\n\001\000\013\001n\000\000\000\014\000\000\000\002z\000\000\000\031\000\000\000\003\223\000\000\000\036\000\000\000\014\261\000\000\000\022\000\000\000\r\303\000\000\0006\000\000\000\016\371\000\000\000N\000\000\000\005G\001\000\000.\001\000\000\004u\002\000\000@\000\000\000\t\265\002\000\000\024\000\000\000\n\311\002\000\000\030\000\000\000\013\341\002\000\000\207\001\000\000\000\000\001\001\001\002\001\003\001\004\001\005\000\006\001\000\000\007\001\000\000\010\001\000\000\t\002\000\000\n\002\000\002\026\001\001\002\000\013\000\000\014\000\000\r\000\000\016\001\000\017\002\000\020\003\000\021\001\000\022\004\002\033\005\002\034\006\001\002\001\007\005\001\007\003\000\001\007\005\001\007\004\000\001\004\002\000\000\000\002\001\007\001\000\001\002\000\002\001\002\000\000\002\000\002\004\007\001\000\000\002\000\002\004\002\000\002\001\007\005\001\t\000\000\001\002\002\000\002\006\007\005\001\t\000\t\000\001\002\003\001\004\003\000\003\001\007\003\000\003\001\007\004\000\003\002\004\001\003\001\002\003\003\004\005\007\001\000\002\003\005\004\007\001\000\006\007\001\000\002\002\003\004\002\004\006\007\001\000\002\003\n\004\002\007\001\000\004\006\007\002\000\006\007\002\000\007\003\000\007\004\000\002\006\007\002\000\006DToken\004Hash\005Event\007U64Util\013AddressUtil\rBytearrayUtil\005Owner\001T\004Info\020SentPaymentEvent\024ReceivedPaymentEvent\032make_sure_sender_published\007publish\rrequire_owner\004mint\007balance\007deposit\010withdraw\017pay_from_sender\005value\017sequence_number\013sent_events\006Handle\017received_events\005payee\006amount\005payer\020new_event_handle\nemit_evento\t\036p\345\263,L\364s\327\250\375[H\3552$<\'\004- B)\351\354\202=\372bz\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\001\002\001\000\002\002\003\001\003\002\002\004\004\002\002\006\001\023\000\002\024\000\002\025\001\002\027\002\003\030\003\003\031\000\004\032\003\004\031\000\000\001\000\001\000\010\000-\r\000\014\000.\001\001\"\004\007\000\023\001\001\002\001\001\000\007\000\021\000-\r\000\014\000\007\000#\004\010\000\024\000\0012\000\001\006\000\000\000\000\000\000\000\000\024\001\0012\001\001\006\000\000\000\000\000\000\000\000\023\010\002\023\010\003\024\002\0012\002\001\002\002\001\000\001\004\013\000-\r\000\014\000.\000\001\r\001\014\001\"\004\n\000\006\000\000\000\000\000\000\000\000)\002\003\001\000\002\005\004\000\023\002\001\014\000\024\001\001\002\004\001\001\001\001\006\013\000-\r\000\014\0000\001\001\r\001\014\001\021\000\026\r\002\014\002\002\005\001\001\001\002\007\021\000\014\000/\001\001\r\002\013\002\021\000\026\r\003\014\001\025\001\001\r\004\014\003\014\004\030\014\002\020\000\027\002\006\001\001\001\002\010\031\000-\r\001\014\001/\001\001\r\002\013\002\021\000\026\r\003\013\003\013\000(\"\004\020\000\006\001\000\000\000\000\000\000\000)\014\003\013\000\031\014\002\020\000\027\014\000\024\001\001\002\007\001\002\001\002\005\t8\000-\r\003\013\001\023\006\001\r\002\013\000\014\002\023\005\001\t\004\025\000\013\003/\002\001\r\004\013\000\013\001\024\003\001\r\006\014\004\020\002\014\006\023\t\002\t\004\"\000\013\000/\002\001\r\005\013\003\013\001\024\004\001\r\007\014\005\020\003\014\007\023\t\003\t\0041\000\013\003/\002\001\r\t\013\t\020\001\026\r\010\014\010\006\001\000\000\000\000\000\000\000\030\014\t\020\001\027\014\003\001\014\000\001\014\001\001\002!\000\000\000\001\005\271\307X^\034\031w\201\024-\205%sNN.\322\021\207)\337.\017\376\214\3456\177\262\366\274\010\000\000\000\000\264\304\004\000\000\000\000!\000\000\000\001!}\246\306\263\341\237\030%\317\262gm\256\314\343\277=\340<\362fG\307\215\360\0137\033%\314\227\216\000\000\000 \000\000\000o\t\036p\345\263,L\364s\327\250\375[H\3552$<\'\004- B)\351\354\202=\372bz\000\341\365\005\000\000\000\000\000\000\001\000\000\000\000\000\000\000 \000\000\000y\236\370\350\200\334~7\261\302#\320\250O\r\275\272p\235\314zrWG\265\031\3333\344\207\376@\000\000\000\000\000\000\000\000 \000\000\000\033p\300\"\320\301\205\344I\370Y\332$\202Z\344\306}\347g^JG\354\004\367\311|\271\206\370\205\004\000\000\000\000\000\000\000!\000\000\000\001\317\202^\244 /c\322\374\n\253>C-\027\223\306\263\346\260\341\342\007\302\031t\317oq\215\034\246\000\000\000\000!\000\000\000\001\352T\323q\005\014\2662\027\371z\223*\372\017\314R\305\n\314A\353*I\264\032\376\207\300\360\242\363`\000\000\000\001\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000 \000\000\0005F\350l\221>\342\323|[\351I\332\272/\273\355\346\221b\301\322\210\262\343GJ\2462\212\261\001\000\000\000\000\000\000\000\000 \000\000\000\236\232@\202+O\206\236\240\376\2203\000\203\317\032\361\"\033U\274K\031\026CD\2073v\247\376\275!\000\000\000\001\374|\332\315\261\271\265\373\356\336ak*\240-\254\235\210Uq\371\264\2418H\270\326\031K\201\211#\010\000\000\000\002\000\000\000\000\000\000\000"获取地址的账户状态fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml")amap=client.get_account_state("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a")print(type(amap))print(amap.to_json())输出<class 'libra.account_resource.AccountState'> 
{
    "ordered_map": {
        "00da69c85de1d95e0a447a7da39e7c3258a2c0a7023d399d9b673d962c2638b63d": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e746f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a00000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102",
        "0105b9c7585e1c197781142d8525734e4e2ed2118729df2e0ffe8ce5367fb2f6bc": "00b4c40400000000",
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000006f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a00e1f505000000000000010000000000000020000000799ef8e880dc7e37b1c223d0a84f0dbdba709dcc7a725747b519db33e487fe400000000000000000200000001b70c022d0c185e449f859da24825ae4c67de7675e4a47ec04f7c97cb986f8850400000000000000",
        "01cf825ea4202f63d2fc0aab3e432d1793c6b3e6b0e1e207c21974cf6f718d1ca6": "",
        "01ea54d371050cb63217f97a932afa0fcc52c50acc41eb2a49b41afe87c0f0a2f3": "01000000000000000100000000000000200000003546e86c913ee2d37c5be949daba2fbbede69162c1d288b2e3474aa6328ab1010000000000000000200000009e9a40822b4f869ea0fe90330083cf1af1221b55bc4b19164344873376a7febd",
        "01fc7cdacdb1b9b5fbeede616b2aa02dac9d885571f9b4a13848b8d6194b818923": "0200000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a",
        "balance": 100000000,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "799ef8e880dc7e37b1c223d0a84f0dbdba709dcc7a725747b519db33e487fe40"
        },
        "sent_events": {
            "count": 0,
            "key": "1b70c022d0c185e449f859da24825ae4c67de7675e4a47ec04f7c97cb986f885"
        },
        "sequence_number": 4
    }
}获取地址的平台币资源fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml")resource=client.get_account_resource("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a")print(type(resource))print(resource.to_json())输出<class 'libra.account_resource.AccountResource'>
{
    "authentication_key": "6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a",
    "balance": 100000000,
    "delegated_key_rotation_capability": false,
    "delegated_withdrawal_capability": false,
    "received_events": {
        "count": 1,
        "key": "799ef8e880dc7e37b1c223d0a84f0dbdba709dcc7a725747b519db33e487fe40"
    },
    "sent_events": {
        "count": 0,
        "key": "1b70c022d0c185e449f859da24825ae4c67de7675e4a47ec04f7c97cb986f885"
    },
    "sequence_number": 4
}获取地址的平台币余额fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml")balance=client.get_balance("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a")print(type(balance))print(balance)输出<class 'int'>
100000000获取地址发送交易的序列号fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml")seq=client.get_sequence_number("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a")print(type(seq))print(seq)输出<class 'int'>
4mint平台币fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")print(client.get_balance("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a"))balance=client.mint_coins("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a",100,True)print(client.get_balance("6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a"))输出100000000
args =  [<libra.transaction.transaction_argument.TransactionArgument object at 0x7f01a0a7b9e8>, <libra.transaction.transaction_argument.TransactionArgument object at 0x7f01a0a7bbe0>]
waiting
transaction is stored!
100000100发送平台币交易fromlibraimportClientfromlibraimportWalletLibrarywallet=WalletLibrary.new()a1=wallet.new_account()a2=wallet.new_account()client=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")client.mint_coins(a1.address,100,True)print("before: a1 balance = ",client.get_balance(a1.address))print("before: a2 balance = ",client.get_balance(a2.address))client.transfer_coin(a1,a2.address,20,is_blocking=True)print("after: a1 balance = ",client.get_balance(a1.address))print("after: a2 balance = ",client.get_balance(a2.address))输出waiting
transaction is stored!
before: a1 balance =  100
before: a2 balance =  0
waiting
transaction is stored!
after: a1 balance =  80
after: a2 balance =  20发送原始交易fromlibraimportClientfromlibra.proto.admission_control_pb2importSubmitTransactionRequestimporttimeclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")request=SubmitTransactionRequest()print("before: 3c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728 balance = ",client.get_balance("3c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728"))print("before: 84e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412 balance = ",client.get_balance("84e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412"))request.signed_txn.signed_txn=bytes.fromhex("200000003c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728000000000000000002000000b80000004c49425241564d0a010007014a00000004000000034e000000060000000d54000000060000000e5a0000000600000005600000002900000004890000002000000008a90000000f00000000000001000200010300020002040200030204020300063c53454c463e0c4c696272614163636f756e74046d61696e0f7061795f66726f6d5f73656e6465720000000000000000000000000000000000000000000000000000000000000000000100020004000c000c011301010202000000010000002000000084e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412000000001400000000000000e0220200000000000000000000000000da5db15d000000002000000069e26a3fe50acf1432a349d1051a38eb8ab1a433cda2e1014df63c645fac704940000000b0e63709b76ad19e7b79e395f70be0569b724c9ed7a372442d07cf051d85b93c58b0ce5232774c2e2e93fddcda27dd71e358be888b8cf4a23a93fb98891cd70a")client.submit_signed_txn(request)time.sleep(2)print("after: 3c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728 balance = ",client.get_balance("3c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728"))print("after: 84e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412 balance = ",client.get_balance("84e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412"))输出before: 3c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728 balance =  200
before: 84e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412 balance =  200
after: 3c6e62667ab1fe77a360023f2298fc0b74b16673f35de56f949cae51437b0728 balance =  180
after: 84e44483d4ca55cdedb8dd609116b63a3d59f1c9e66327944ed37a580980f412 balance =  220查询交易通过版本查询交易:fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")tr=client.get_transaction(1)print(type(tr))print(tr.to_json())输出<class 'libra.transaction.signed_transaction.SignedTransaction'>
{
    "raw_txn": {
        "sender": "000000000000000000000000000000000000000000000000000000000a550c18",
        "sequence_number": 1,
        "payload": {
            "Script": {
                "code": "4c49425241564d0a010007014a000000060000000350000000060000000d56000000060000000e5c0000000600000005620000003300000004950000002000000008b50000000f000000000000010002000300010400020002040200030204020300063c53454c463e0c4c696272614163636f756e74094c69627261436f696e046d61696e0f6d696e745f746f5f616464726573730000000000000000000000000000000000000000000000000000000000000000000100020004000c000c0113010102",
                "args": [
                    {
                        "Address": "6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a"
                    },
                    {
                        "U64": 100000000
                    }
                ]
            }
        },
        "max_gas_amount": 140000,
        "gas_unit_price": 0,
        "expiration_time": 1571896599
    },
    "public_key": "664f6e8f36eacb1770fa879d86c2c1d0fafea145e84fa7d671ab7a011a54d509",
    "signature": "e2c71ccb24d00e1e01795346084f62e6c7de409ce6fc9bd2226ca6c0ab531e25ec15c4d78d25344158f63500f42c75f9afefe82e36716c7cbcd635fc5e76ea00"
}获取一系列交易:fromlibraimportClientclient=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")trs=client.get_transactions(1,3)print(len(trs))fortrintrs:print(type(tr))print(tr.to_json())输出3
<class 'libra.transaction.signed_transaction.SignedTransaction'>
{
    "raw_txn": {
        "sender": "000000000000000000000000000000000000000000000000000000000a550c18",
        "sequence_number": 1,
        "payload": {
            "Script": {
                "code": "4c49425241564d0a010007014a000000060000000350000000060000000d56000000060000000e5c0000000600000005620000003300000004950000002000000008b50000000f000000000000010002000300010400020002040200030204020300063c53454c463e0c4c696272614163636f756e74094c69627261436f696e046d61696e0f6d696e745f746f5f616464726573730000000000000000000000000000000000000000000000000000000000000000000100020004000c000c0113010102",
                "args": [
                    {
                        "Address": "6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a"
                    },
                    {
                        "U64": 100000000
                    }
                ]
            }
        },
        "max_gas_amount": 140000,
        "gas_unit_price": 0,
        "expiration_time": 1571896599
    },
    "public_key": "664f6e8f36eacb1770fa879d86c2c1d0fafea145e84fa7d671ab7a011a54d509",
    "signature": "e2c71ccb24d00e1e01795346084f62e6c7de409ce6fc9bd2226ca6c0ab531e25ec15c4d78d25344158f63500f42c75f9afefe82e36716c7cbcd635fc5e76ea00"
}
<class 'libra.transaction.signed_transaction.SignedTransaction'>
{
    "raw_txn": {
        "sender": "000000000000000000000000000000000000000000000000000000000a550c18",
        "sequence_number": 2,
        "payload": {
            "Script": {
                "code": "4c49425241564d0a010007014a000000060000000350000000060000000d56000000060000000e5c0000000600000005620000003300000004950000002000000008b50000000f000000000000010002000300010400020002040200030204020300063c53454c463e0c4c696272614163636f756e74094c69627261436f696e046d61696e0f6d696e745f746f5f616464726573730000000000000000000000000000000000000000000000000000000000000000000100020004000c000c0113010102",
                "args": [
                    {
                        "Address": "bce9dece4f3cb14374993421a5e2095f25552e3528f007cbd91ad214ab752a50"
                    },
                    {
                        "U64": 100000000
                    }
                ]
            }
        },
        "max_gas_amount": 140000,
        "gas_unit_price": 0,
        "expiration_time": 1571896602
    },
    "public_key": "664f6e8f36eacb1770fa879d86c2c1d0fafea145e84fa7d671ab7a011a54d509",
    "signature": "da8e4da1578f2840d25377ab07380a2a8e9a8e338b3112cd6a701308fdd54a37c17f83518c0746fa033c1b04ec79287c062155f22c9ab3529535faf8a874ff06"
}
<class 'libra.transaction.signed_transaction.SignedTransaction'>
{
    "raw_txn": {
        "sender": "6f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a",
        "sequence_number": 0,
        "payload": {
            "Module": {
                "code": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e746f091e70e5b32c4cf473d7a8fd5b48ed32243c27042d204229e9ec823dfa627a00000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102"
            }
        },
        "max_gas_amount": 140000,
        "gas_unit_price": 0,
        "expiration_time": 1571896722
    },
    "public_key": "495f9df06e9abad96e7a90c034ecc242f9caf349dbfdeb45e475ee2cc8eb5c2a",
    "signature": "42b2b13ed6e93cd5f3f268dc3c92f9983245c5a1bdb53de1c3fa4bfb8a15be0f1da1014b50b198000d08f91f2b458107d6f6a025306025139c7426d70e71e50c"
}稳定币发布合约from libra import Client
from libra import WalletLibrary


wallet = WalletLibrary.new()
ac = wallet.new_account()
client = Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")
client.mint_coins(ac.address,100,True)
print("before: state = ",client.get_account_state(ac.address).to_json())
client.publish_violas_coin(ac,True)
print("after: state = ",client.get_account_state(ac.address).to_json())
wallet.write_recovery(".wallet/module")输出waiting
transaction is stored!
before: state =  {
    "ordered_map": {
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000002ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0640000000000000000000100000000000000200000002a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e690000000000000000200000001ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b0000000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "2ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0",
        "balance": 100,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "2a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e69"
        },
        "sent_events": {
            "count": 0,
            "key": "1ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b"
        },
        "sequence_number": 0
    }
}
waiting
transaction is stored!
no events emitted
after: state =  {
    "ordered_map": {
        "0090dc055eeba74a7c832ed4f72b6ee9ccf80db743408b7b4641b00ea2e7fab853": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e742ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd000000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102",
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000002ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0640000000000000000000100000000000000200000002a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e690000000000000000200000001ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b0100000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "2ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0",
        "balance": 100,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "2a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e69"
        },
        "sent_events": {
            "count": 0,
            "key": "1ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b"
        },
        "sequence_number": 1
    }
}初始化账户在使用每个稳定币的时候都需要这个过程fromlibraimportClientfromlibraimportWalletLibrarymodule_account=WalletLibrary.recover(".wallet/module").accounts[0]client=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")print("before: state = ",client.get_account_state(module_account.address).to_json())client.init_violas_coin(module_account,module_account.address,True)print("after: state = ",client.get_account_state(module_account.address).to_json())输出before: state =  {
    "ordered_map": {
        "0090dc055eeba74a7c832ed4f72b6ee9ccf80db743408b7b4641b00ea2e7fab853": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e742ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd000000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102",
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000002ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0640000000000000000000100000000000000200000002a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e690000000000000000200000001ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b0100000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "2ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0",
        "balance": 100,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "2a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e69"
        },
        "sent_events": {
            "count": 0,
            "key": "1ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b"
        },
        "sequence_number": 1
    }
}
waiting
transaction is stored!
no events emitted
after: state =  {
    "ordered_map": {
        "0090dc055eeba74a7c832ed4f72b6ee9ccf80db743408b7b4641b00ea2e7fab853": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e742ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd000000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102",
        "0117396040a90aa651a09762b97478f0b31aaf8df5845e1c4097137facc3a25c15": "",
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000002ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0640000000000000000000100000000000000200000002a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e690000000000000000200000001ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b0200000000000000",
        "0137200349bc88eb3d4689856a93a2c11fa4d85402bdeafb0bd962b957e1a4be7d": "00000000000000000000000000000000200000001e8125f1d73ee5c0ef51a3570ebfe37a452ff8255785801ff33474351ef96a9b0000000000000000200000008e78101a64339c2df951effe6e47324ba59037965b0452c3bdeade57aaf600ae",
        "016e598c3746edfe81d7a3bdb690b6dce90f02a392357f530ceb40a947df42017a": "0000000000000000",
        "01fc7cdacdb1b9b5fbeede616b2aa02dac9d885571f9b4a13848b8d6194b818923": "0200000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "2ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0",
        "balance": 100,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "2a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e69"
        },
        "sent_events": {
            "count": 0,
            "key": "1ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b"
        },
        "sequence_number": 2
    }
}发币只有owner账户才可以发币fromlibraimportClientfromlibraimportWalletLibrarymodule_account=WalletLibrary.recover(".wallet/module").accounts[0]client=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")print("before: state = ",client.get_account_state(module_account.address).to_json())print("before: balance = ",client.get_violas_balance(module_account.address,module_account.address))client.mint_violas_coins(module_account.address,100,module_account,True)print("after: state = ",client.get_account_state(module_account.address).to_json())print("after: balance = ",client.get_violas_balance(module_account.address,module_account.address))输出before: state =  {
    "ordered_map": {
        "0090dc055eeba74a7c832ed4f72b6ee9ccf80db743408b7b4641b00ea2e7fab853": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e742ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd000000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102",
        "0117396040a90aa651a09762b97478f0b31aaf8df5845e1c4097137facc3a25c15": "",
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000002ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0640000000000000000000100000000000000200000002a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e690000000000000000200000001ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b1100000000000000",
        "0137200349bc88eb3d4689856a93a2c11fa4d85402bdeafb0bd962b957e1a4be7d": "00000000000000000000000000000000200000001e8125f1d73ee5c0ef51a3570ebfe37a452ff8255785801ff33474351ef96a9b0000000000000000200000008e78101a64339c2df951effe6e47324ba59037965b0452c3bdeade57aaf600ae",
        "016e598c3746edfe81d7a3bdb690b6dce90f02a392357f530ceb40a947df42017a": "dc05000000000000",
        "01fc7cdacdb1b9b5fbeede616b2aa02dac9d885571f9b4a13848b8d6194b818923": "0200000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "2ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0",
        "balance": 100,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "2a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e69"
        },
        "sent_events": {
            "count": 0,
            "key": "1ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b"
        },
        "sequence_number": 17
    }
}
before: balance =  1500
waiting
transaction is stored!
no events emitted
after: state =  {
    "ordered_map": {
        "0090dc055eeba74a7c832ed4f72b6ee9ccf80db743408b7b4641b00ea2e7fab853": "4c49425241564d0a01000b016e0000000c000000027a0000001900000003930000001e0000000cb1000000120000000dc3000000360000000ef90000004e00000005470100002e01000004750200004000000009b5020000140000000ac9020000180000000be10200008701000000000101010201030104010500060100000701000008010000090200000a02000216010102000b00000c00000d00000e01000f02001003001101001204021b05021c06010201070501070300010705010704000104020000000201070100010200020102000002000204070100000200020402000201070501090000010202000206070501090009000102030104030003010703000301070400030204010301020303040507010002030504070100060701000202030402040607010002030a040207010004060702000607020007030007040002060702000644546f6b656e0448617368054576656e74075536345574696c0b416464726573735574696c0d4279746561727261795574696c054f776e6572015404496e666f1053656e745061796d656e744576656e741452656365697665645061796d656e744576656e741a6d616b655f737572655f73656e6465725f7075626c6973686564077075626c6973680d726571756972655f6f776e6572046d696e740762616c616e6365076465706f7369740877697468647261770f7061795f66726f6d5f73656e6465720576616c75650f73657175656e63655f6e756d6265720b73656e745f6576656e74730648616e646c650f72656365697665645f6576656e747305706179656506616d6f756e74057061796572106e65775f6576656e745f68616e646c650a656d69745f6576656e742ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd000000000000000000000000000000000000000000000000000000000000000000002000001020100020203010302020404020206011300021400021501021702031803031900041a03041900000100010008002d0d000c002e01012204070013010102010100070011002d0d000c000700230408001400013200010600000000000000001401013201010600000000000000001308021308031402013202010202010001040b002d0d000c002e00010d010c0122040a000600000000000000002902030100020504001302010c00140101020401010101060b002d0d000c003001010d010c011100160d020c020205010101020711000c002f01010d020b021100160d030c011501010d040c030c04180c021000170206010101020819002d0d010c012f01010d020b021100160d030b030b002822041000060100000000000000290c030b00190c021000170c00140101020701020102050938002d0d030b011306010d020b000c02130501090415000b032f02010d040b000b011403010d060c0410020c06130902090422000b002f02010d050b030b011404010d070c0510030c07130903090431000b032f02010d090b091001160d080c08060100000000000000180c091001170c03010c00010c010102",
        "0117396040a90aa651a09762b97478f0b31aaf8df5845e1c4097137facc3a25c15": "",
        "01217da6c6b3e19f1825cfb2676daecce3bf3de03cf26647c78df00b371b25cc97": "200000002ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0640000000000000000000100000000000000200000002a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e690000000000000000200000001ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b1200000000000000",
        "0137200349bc88eb3d4689856a93a2c11fa4d85402bdeafb0bd962b957e1a4be7d": "00000000000000000000000000000000200000001e8125f1d73ee5c0ef51a3570ebfe37a452ff8255785801ff33474351ef96a9b0000000000000000200000008e78101a64339c2df951effe6e47324ba59037965b0452c3bdeade57aaf600ae",
        "016e598c3746edfe81d7a3bdb690b6dce90f02a392357f530ceb40a947df42017a": "4006000000000000",
        "01fc7cdacdb1b9b5fbeede616b2aa02dac9d885571f9b4a13848b8d6194b818923": "0200000000000000"
    },
    "Decoded_resource": {
        "authentication_key": "2ef00c60174ae8fbfd5db2920fabdde0349aab56e3b45a4e873e11401303afd0",
        "balance": 100,
        "delegated_key_rotation_capability": false,
        "delegated_withdrawal_capability": false,
        "received_events": {
            "count": 1,
            "key": "2a18b30138fc36f7eb8e311b0a8559fb97aced8530cb675d760286af01348e69"
        },
        "sent_events": {
            "count": 0,
            "key": "1ab028d81656e724fdad8e540513020b0e130b5d0ff5979576be1ec1887e228b"
        },
        "sequence_number": 18
    }
}
after: balance =  1600交易fromlibraimportClientfromlibraimportWalletLibrarymodule_account=WalletLibrary.recover(".wallet/module").accounts[0]wallet=WalletLibrary.new()a1=wallet.new_account()a2=wallet.new_account()client=Client.new('localhost',36723,"/tmp/bf17da3786467620a4aa3f3082ecff91/0/consensus_peers.config.toml","/tmp/a3929e4a2b99505e00fa8385a4fe8b18/temp_faucet_keys")client.mint_coins(a1.address,100,True)client.mint_coins(a2.address,100,True)client.init_violas_coin(a1,module_account.address,True)client.init_violas_coin(a2,module_account.address,True)client.mint_violas_coins(a1.address,100,module_account,True)print("before: a1 violas balance = ",client.get_violas_balance(a1.address,module_account.address))print("before: a2 violas balance = ",client.get_violas_balance(a2.address,module_account.address))client.transfer_violas_coin(a1,a2.address,20,module_account.address,is_blocking=True)print("after: a1 violas balance = ",client.get_violas_balance(a1.address,module_account.address))print("after: a2 violas balance = ",client.get_violas_balance(a2.address,module_account.address))输出waiting
transaction is stored!
waiting
transaction is stored!
waiting
transaction is stored!
no events emitted
waiting
transaction is stored!
no events emitted
waiting
transaction is stored!
no events emitted
before: a1 violas balance =  100
before: a2 violas balance =  0
waiting
transaction is stored!
after: a1 violas balance =  80
after: a2 violas balance =  20