res = client.getBlockNumber() print("getBlockNumber", res) except BcosError as e: print("bcos client error,", e.info()) print( "\n>>---------------------------------------------------------------------" ) print("getPeers", client.getPeers()) print( "\n>>---------------------------------------------------------------------" ) print("getBlockByNumber", client.getBlockByNumber(50)) print( "\n>>---------------------------------------------------------------------" ) print("getBlockHashByNumber", client.getBlockHashByNumber(50)) print( "\n>>---------------------------------------------------------------------" ) print( "getBlockByHash", client.getBlockByHash( "0xe7588bf4ee5a6fb5aae9bdcc2c4f3c58cf7a789b15a4daa6617ed594b5ba3951" )) print( "\n>>---------------------------------------------------------------------" ) print( "getTransactionByHash", client.getTransactionByHash( "0x41fa9a0ce36d486ee2bf6d2219b68b44ca300ec7aeb07f8f2aa9c225655d2b61"
print("\n>>---------------------------------------------------------------------") res = client.getNodeVersion() print("\n>>---------------------------------------------------------------------") print("getClientVersion", res) print("\n>>---------------------------------------------------------------------") try: res = client.getBlockNumber() print("getBlockNumber", res) except BcosError as e: print("bcos client error,", e.info()) print("\n>>---------------------------------------------------------------------") print("getPeers", client.getPeers()) print("\n>>---------------------------------------------------------------------") print("getBlockByNumber", client.getBlockByNumber(1)) print("\n>>---------------------------------------------------------------------") blockhash = client.getBlockHashByNumber(1) print("getBlockHashByNumber", blockhash) print("\n>>---------------------------------------------------------------------") block = client.getBlockByHash(blockhash) print("getBlockByHash", block) if isinstance(block, dict) and "transactions" in block.keys(): txhash = block['transactions'][0]["hash"] print("\n>>---------------------------------------------------------------------") print("getTransactionByHash", client.getTransactionByHash(txhash)) print("\n>>---------------------------------------------------------------------") print("getTransactionByBlockHashAndIndex", client.getTransactionByBlockHashAndIndex(blockhash, 0)) print("\n>>---------------------------------------------------------------------") print("getTransactionByBlockNumberAndIndex", client.getTransactionByBlockNumberAndIndex(1, 0)) print("\n>>---------------------------------------------------------------------")