-
执行
cleos get transaction
出现以下错误root@iZj6cbx3duprxf6dasczbpZ:~/eosio-wallet# cleos get transaction 17b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a72 Error 3200006: invalid http request Error Details: The server has rejected the request as invalid! Please verify this url is valid: http://127.0.0.1:8888/v1/history/get_transaction If the condition persists, please contact the RPC server administrator for 127.0.0.1!
-
换在eosjs下执行
const wif = '私钥' eos = Eos({ httpEndpoint: '上面cleos所在服务器提供的Rpc地址', chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', keyProvider: wif, verbose: true }) eos.getTransaction("17b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a72").then(result => { console.log(result); })
-
返回结果如下
{ "code": 400, "message": "Bad Request", "error": { "code": 3040011, "name": "tx_not_found", "what": "The transaction can not be found", "details": [ { "message": "Transaction 17b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a72 not found in history and no block hint was given", "file": "history_plugin.cpp", "line_number": 396, "method": "get_transaction" } ] } }
这个
17b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a72
并不存在。 -
在eosjs中执行
eos.getActions("bcskillsurou").then(result => { console.log(result); })
-
再返回的数据中
{"actions":[{"global_action_seq":2569366,"account_action_seq":304,"block_num":2568738,"block_time":"2018-08-02T10:32:46.500","action_trace":{"receipt":{"receiver":"dapp.exec","act_digest":"b6902e4919fe2e03e5be0bd8dd01659a5e6dca58fc4d6c9e873de56c54f75a36","global_sequence":2569366,"recv_sequence":101,"auth_sequence":[["dapp.exec",288]],"code_sequence":1,"abi_sequence":1},"act":{"account":"eosio.token","name":"transfer","authorization":[{"actor":"dapp.exec","permission":"active"}],"data":{"from":"dapp.exec","to":"eosio.ram","quantity":"0.9950 EOS","memo":"buy ram"},"hex_data":"000040aa2b50ab49000090e602ea3055de2600000000000004454f5300000000076275792072616d"},"elapsed":62,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"c7b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a7d","inline_traces":[]}},
-
随便找一个trx_id
"trx_id":"c7b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a7d"
-
然后在终端执行
root@iZj6cbx3duprxf6dasczbpZ:~/eosio-wallet# cleos get transaction c7b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a7d { "id": "c7b8e633dbdc3988fcec671b96ae1ce473bc432568a417a416901b9c01184a7d", "trx": { "receipt": { "status": "executed", "cpu_usage_us": 3077, "net_usage_words": 16, "trx": [ 1,{ "signatures": [ "SIG_K1_KbeYYa3kW3izWvmHoRjUSCSSckGWzwuRi3ZJ8pPKnjJigGsUSE3aRKnmZDNhgULCou7aYTgyYeTs95f9RMKik7LTMPHX3p" ], "compression": "none", "packed_context_free_data": "", "packed_trx": "08de625bf43153f4344400000000010000000000ea3055000000004873bd3e01000040aa2b50ab4900000000a8ed323220000040aa2b50ab49000040aa2b50ab49102700000000000004454f530000000000" } ] }, "trx": {
正确返回交易信息。
结论
至此得出结论,在终端中cleos get transaction 本地数据不存在的trx_id
,出现Error 3200006 错误,
此错误信息并不准确,建议EOSIO能和eosjs返回的错误一致,方便分析问题。