#通过公钥获取账号信息
pprint(gph.wallet.getAccount(pub))

#创建账号
try:
    pprint(
        gph.create_account(account_name="test10",
                           password="******",
                           proxy_account="init14"))
except Exception as e:
    print(repr(e))
    gph.wallet.removeAccount(None)

#转账1
pprint(gph.transfer('test14', 100, "1.3.0", "test memo", 'init0'))
'''
执行结果:
tx.buffer>>>: {'extensions': [], 'ref_block_num': 52379, 'operations': [[0, {'extensions': [], 'from': '1.2.4', 'memo': {'to': 'COCOS8GY2vkoK8gpLTuDxNfzD6JjwqYDmCRnpoUfZ78J4z8ChdcZi6h', 'from': 'COCOS5vzuh6YRRmCjUMeeHLsjnVCdJwqm9WZoUBDDNVp7HTwFM1ZYQT', 'nonce': 5901681697903210751, 'message': '8bb2f19b3a3b57cbbf04e539783f3d62'}, 'to': '1.2.17', 'fee': {'amount': 2089843, 'asset_id': '1.3.0'}, 'amount': {'amount': 10000000, 'asset_id': '1.3.0'}}]], 'signatures': ['1f7ebeba7dd6b0efdb9286260a05c426ab476a3ecb5fc8812ccc5dea826b56c5e76024a526ad510f77ff3fd1ac9f6439d4b40aa4e1099fe3676d322d5ffa1a31eb'], 'expiration': '2019-08-21T04:19:45', 'ref_block_prefix': 2924873733}
tx======>>: {'extensions': [], 'ref_block_num': 52379, 'operations': [[0, {'extensions': [], 'from': '1.2.4', 'memo': {'to': 'COCOS8GY2vkoK8gpLTuDxNfzD6JjwqYDmCRnpoUfZ78J4z8ChdcZi6h', 'from': 'COCOS5vzuh6YRRmCjUMeeHLsjnVCdJwqm9WZoUBDDNVp7HTwFM1ZYQT', 'nonce': 5901681697903210751, 'message': '8bb2f19b3a3b57cbbf04e539783f3d62'}, 'to': '1.2.17', 'fee': {'amount': 2089843, 'asset_id': '1.3.0'}, 'amount': {'amount': 10000000, 'asset_id': '1.3.0'}}]], 'signatures': ['1f7ebeba7dd6b0efdb9286260a05c426ab476a3ecb5fc8812ccc5dea826b56c5e76024a526ad510f77ff3fd1ac9f6439d4b40aa4e1099fe3676d322d5ffa1a31eb'], 'expiration': '2019-08-21T04:19:45', 'ref_block_prefix': 2924873733}
transaction>>>: {'extensions': [], 'ref_block_num': 52379, 'operations': [[0, {'extensions': [], 'from': '1.2.4', 'memo': {'to': 'COCOS8GY2vkoK8gpLTuDxNfzD6JjwqYDmCRnpoUfZ78J4z8ChdcZi6h', 'from': 'COCOS5vzuh6YRRmCjUMeeHLsjnVCdJwqm9WZoUBDDNVp7HTwFM1ZYQT', 'nonce': 5901681697903210751, 'message': '8bb2f19b3a3b57cbbf04e539783f3d62'}, 'to': '1.2.17', 'fee': {'amount': 2089843, 'asset_id': '1.3.0'}, 'amount': {'amount': 10000000, 'asset_id': '1.3.0'}}]], 'signatures': ['1f7ebeba7dd6b0efdb9286260a05c426ab476a3ecb5fc8812ccc5dea826b56c5e76024a526ad510f77ff3fd1ac9f6439d4b40aa4e1099fe3676d322d5ffa1a31eb'], 'expiration': '2019-08-21T04:19:45', 'ref_block_prefix': 2924873733}

['dee8d42d4e49458b54987cf563e82fa3c941e77580981fd4b8893bde9ad62a4d',
 {'block': 52380,
  'expiration': '2019-08-21T04:19:45',
  'extensions': [],
  'operation_results': [[1, {'real_running_time': 198}]],
  'operations': [[0,
                  {'amount': {'amount': 10000000, 'asset_id': '1.3.0'},
                   'extensions': [],
                   'fee': {'amount': 2089843, 'asset_id': '1.3.0'},
Esempio n. 2
0
#account test
pprint(gph.wallet.removeAccount(None))
pprint(gph.wallet.getAccounts())

#创建账号
# try:
#     pprint(gph.create_account(account_name="test3", password="******"))
# except Exception as e:
#     print(repr(e))
#     gph.wallet.removeAccount(None)
#pprint(gph.wallet.getAccounts())
#account="nicotest"
#pprint(gph.register_nh_asset_creator(account))
#pprint(gph.create_world_view("snacktest", account))

#pprint(gph.create_nh_asset(account, "COCOS", "snacktest", '{"name":"test1"}', account))

pprint(
    gph.transfer(to="init7",
                 amount=11,
                 asset="1.3.0",
                 memo=["test memo 0", 0],
                 account="nicotest"))
pprint(
    gph.transfer(to="init8",
                 amount=12,
                 asset="1.3.0",
                 memo=["test memo 1", 1],
                 account="nicotest"))