1前言
搭建好eos的nodeos,api服务中/v1/chain/get_info已经可以,但是/v1/history/get_transaction或者/v1/history/get_actions为空的问题
2修改配置
首先应配置nodeos,修改配置
plugin = eosio::history_api_plugin
plugin = eosio::history_plugin
#读取所有的交易记录,也可以配置为filter-on = eosio.token:transfer:,意思是只读取eosio.token合约的转账记录
filter-on = *
3转账
重启nodeos,使用控制台转一次账,然后查询交易即可获得交易内容
cleos --wallet-url http://127.0.0.1:8900 --url http://127.0.0.1:8888 transfer eosio wjl “1.0000 SYS”
返回
executed transaction: 44e300a3be8733c8db962a317ae1d6528515e5da95611a745dfd9e9f18f9d605 128 bytes 534 us
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"wjl","quantity":"1.0000 SYS","memo":""}
# eosio <= eosio.token::transfer {"from":"eosio","to":"wjl","quantity":"1.0000 SYS","memo":""}
# wjl <= eosio.token::transfer {"from":"eosio","to":"wjl","quantity":"1.0000 SYS","memo":""}
warning: transaction executed locally, but may not be confirmed by the network yet ]
4查询get_transaction
查询api
http://127.0.0.1:8888/v1/history/get_transaction
{
"id":"44e300a3be8733c8db962a317ae1d6528515e5da95611a745dfd9e9f18f9d605"
}
返回
{
"id": "44e300a3be8733c8db962a317ae1d6528515e5da95611a745dfd9e9f18f9d605",
"trx": {
"receipt": {
"status": "executed",
"cpu_usage_us": 534,
"net_usage_words": 16,
"trx": [
1,
{
"signatures": [
"SIG_K1_Kj5pFUm2j7JAPunFMKyqEdKG7P2VbkDqwsdnSp5sUcFmPMFwMJdmGYSbDi5KD3MJ2cZakSxbnV9rDpAs14Ejzg91ox1CaM"
],
"compression": "none",
"packed_context_free_data": "",
"packed_trx": "6044385c1f7f68a0a7b6000000000100a6823403ea3055000000572d3ccdcd010000000000ea305500000000a8ed3232210000000000ea3055000000000000e2e3102700000000000004535953000000000000"
}
]
},
"trx": {
"expiration": "2019-01-11T07:23:12",
"ref_block_num": 32543,
"ref_block_prefix": 3064438888,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [
{
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "wjl",
"quantity": "1.0000 SYS",
"memo": ""
},
"hex_data": "0000000000ea3055000000000000e2e31027000000000000045359530000000000"
}
],
"transaction_extensions": [],
"signatures": [
"SIG_K1_Kj5pFUm2j7JAPunFMKyqEdKG7P2VbkDqwsdnSp5sUcFmPMFwMJdmGYSbDi5KD3MJ2cZakSxbnV9rDpAs14Ejzg91ox1CaM"
],
"context_free_data": []
}
},
"block_time": "2019-01-11T07:22:43.000",
"block_num": 32545,
"last_irreversible_block": 33709,
"traces": [
{
"receipt": {
"receiver": "eosio.token",
"act_digest": "956ecf6ccdf0506e90d0d2329fc78ff4cd9e83e9d64026a7f89009f9bb1967f1",
"global_sequence": 32620,
"recv_sequence": 18,
"auth_sequence": [
[
"eosio",
32615
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "wjl",
"quantity": "1.0000 SYS",
"memo": ""
},
"hex_data": "0000000000ea3055000000000000e2e31027000000000000045359530000000000"
},
"context_free": false,
"elapsed": 4585,
"console": "",
"trx_id": "44e300a3be8733c8db962a317ae1d6528515e5da95611a745dfd9e9f18f9d605",
"block_num": 32545,
"block_time": "2019-01-11T07:22:43.000",
"producer_block_id": null,
"account_ram_deltas": [],
"except": null,
"inline_traces": [
{
"receipt": {
"receiver": "eosio",
"act_digest": "956ecf6ccdf0506e90d0d2329fc78ff4cd9e83e9d64026a7f89009f9bb1967f1",
"global_sequence": 32621,
"recv_sequence": 32588,
"auth_sequence": [
[
"eosio",
32616
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "wjl",
"quantity": "1.0000 SYS",
"memo": ""
},
"hex_data": "0000000000ea3055000000000000e2e31027000000000000045359530000000000"
},
"context_free": false,
"elapsed": 30,
"console": "",
"trx_id": "44e300a3be8733c8db962a317ae1d6528515e5da95611a745dfd9e9f18f9d605",
"block_num": 32545,
"block_time": "2019-01-11T07:22:43.000",
"producer_block_id": null,
"account_ram_deltas": [],
"except": null,
"inline_traces": []
},
{
"receipt": {
"receiver": "wjl",
"act_digest": "956ecf6ccdf0506e90d0d2329fc78ff4cd9e83e9d64026a7f89009f9bb1967f1",
"global_sequence": 32622,
"recv_sequence": 4,
"auth_sequence": [
[
"eosio",
32617
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "wjl",
"quantity": "1.0000 SYS",
"memo": ""
},
"hex_data": "0000000000ea3055000000000000e2e31027000000000000045359530000000000"
},
"context_free": false,
"elapsed": 7,
"console": "",
"trx_id": "44e300a3be8733c8db962a317ae1d6528515e5da95611a745dfd9e9f18f9d605",
"block_num": 32545,
"block_time": "2019-01-11T07:22:43.000",
"producer_block_id": null,
"account_ram_deltas": [],
"except": null,
"inline_traces": []
}
]
}
]
}
5查询get_actions
查询http://127.0.0.1:8888/v1/history/get_actions
参数
{
"pos":0,
"offset":2,
"account_name":"eosio"
}
参数说明
pos:记录的起始位置,相当于一个数组的下标索引,0开始
offset:记录的偏移量,相当于读取数组下标,往后偏移的数量,0开始
account_name:账户名称
返回:
{
"actions": [
{
"global_action_seq": 3872,
"account_action_seq": 0,
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"action_trace": {
"receipt": {
"receiver": "eosio.token",
"act_digest": "e7eea3b6fa4c63955adb7dad48974ef8f1a419277b7f70b71212a17c0216bef2",
"global_sequence": 3872,
"recv_sequence": 3,
"auth_sequence": [
[
"eosio",
3867
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.ram",
"quantity": "19900.0000 SYS",
"memo": "buy ram"
},
"hex_data": "0000000000ea3055000090e602ea3055c07fdc0b000000000453595300000000076275792072616d"
},
"context_free": false,
"elapsed": 145,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [
{
"account": "eosio",
"delta": 240
}
],
"except": null,
"inline_traces": [
{
"receipt": {
"receiver": "eosio",
"act_digest": "e7eea3b6fa4c63955adb7dad48974ef8f1a419277b7f70b71212a17c0216bef2",
"global_sequence": 3873,
"recv_sequence": 3870,
"auth_sequence": [
[
"eosio",
3868
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.ram",
"quantity": "19900.0000 SYS",
"memo": "buy ram"
},
"hex_data": "0000000000ea3055000090e602ea3055c07fdc0b000000000453595300000000076275792072616d"
},
"context_free": false,
"elapsed": 25,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [],
"except": null,
"inline_traces": []
},
{
"receipt": {
"receiver": "eosio.ram",
"act_digest": "e7eea3b6fa4c63955adb7dad48974ef8f1a419277b7f70b71212a17c0216bef2",
"global_sequence": 3874,
"recv_sequence": 1,
"auth_sequence": [
[
"eosio",
3869
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.ram",
"quantity": "19900.0000 SYS",
"memo": "buy ram"
},
"hex_data": "0000000000ea3055000090e602ea3055c07fdc0b000000000453595300000000076275792072616d"
},
"context_free": false,
"elapsed": 4,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [],
"except": null,
"inline_traces": []
}
]
}
},
{
"global_action_seq": 3875,
"account_action_seq": 1,
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"action_trace": {
"receipt": {
"receiver": "eosio.token",
"act_digest": "5a5e56aa75bde3423166ded56735d8cf6bafbb42b81a0c0823dbc80ee91192d6",
"global_sequence": 3875,
"recv_sequence": 4,
"auth_sequence": [
[
"eosio",
3870
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.ramfee",
"quantity": "100.0000 SYS",
"memo": "ram fee"
},
"hex_data": "0000000000ea3055a0d492e602ea305540420f000000000004535953000000000772616d20666565"
},
"context_free": false,
"elapsed": 145,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [
{
"account": "eosio",
"delta": 240
}
],
"except": null,
"inline_traces": [
{
"receipt": {
"receiver": "eosio",
"act_digest": "5a5e56aa75bde3423166ded56735d8cf6bafbb42b81a0c0823dbc80ee91192d6",
"global_sequence": 3876,
"recv_sequence": 3871,
"auth_sequence": [
[
"eosio",
3871
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.ramfee",
"quantity": "100.0000 SYS",
"memo": "ram fee"
},
"hex_data": "0000000000ea3055a0d492e602ea305540420f000000000004535953000000000772616d20666565"
},
"context_free": false,
"elapsed": 27,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [],
"except": null,
"inline_traces": []
},
{
"receipt": {
"receiver": "eosio.ramfee",
"act_digest": "5a5e56aa75bde3423166ded56735d8cf6bafbb42b81a0c0823dbc80ee91192d6",
"global_sequence": 3877,
"recv_sequence": 1,
"auth_sequence": [
[
"eosio",
3872
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.ramfee",
"quantity": "100.0000 SYS",
"memo": "ram fee"
},
"hex_data": "0000000000ea3055a0d492e602ea305540420f000000000004535953000000000772616d20666565"
},
"context_free": false,
"elapsed": 4,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [],
"except": null,
"inline_traces": []
}
]
}
},
{
"global_action_seq": 3879,
"account_action_seq": 2,
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"action_trace": {
"receipt": {
"receiver": "eosio.token",
"act_digest": "86f65c597ed270e33f09aa6bfb1fbae14077bda1fa611c483ffe56b0bfed8a3c",
"global_sequence": 3879,
"recv_sequence": 5,
"auth_sequence": [
[
"eosio",
3874
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.stake",
"quantity": "200000000.0000 SYS",
"memo": "stake bandwidth"
},
"hex_data": "0000000000ea30550014341903ea305500204aa9d101000004535953000000000f7374616b652062616e647769647468"
},
"context_free": false,
"elapsed": 144,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [
{
"account": "eosio",
"delta": 240
}
],
"except": null,
"inline_traces": [
{
"receipt": {
"receiver": "eosio",
"act_digest": "86f65c597ed270e33f09aa6bfb1fbae14077bda1fa611c483ffe56b0bfed8a3c",
"global_sequence": 3880,
"recv_sequence": 3873,
"auth_sequence": [
[
"eosio",
3875
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.stake",
"quantity": "200000000.0000 SYS",
"memo": "stake bandwidth"
},
"hex_data": "0000000000ea30550014341903ea305500204aa9d101000004535953000000000f7374616b652062616e647769647468"
},
"context_free": false,
"elapsed": 23,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [],
"except": null,
"inline_traces": []
},
{
"receipt": {
"receiver": "eosio.stake",
"act_digest": "86f65c597ed270e33f09aa6bfb1fbae14077bda1fa611c483ffe56b0bfed8a3c",
"global_sequence": 3881,
"recv_sequence": 1,
"auth_sequence": [
[
"eosio",
3876
]
],
"code_sequence": 1,
"abi_sequence": 1
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio",
"permission": "active"
}
],
"data": {
"from": "eosio",
"to": "eosio.stake",
"quantity": "200000000.0000 SYS",
"memo": "stake bandwidth"
},
"hex_data": "0000000000ea30550014341903ea305500204aa9d101000004535953000000000f7374616b652062616e647769647468"
},
"context_free": false,
"elapsed": 4,
"console": "",
"trx_id": "81c74c04beb3475dd911759bb50dc7698b7bb335cd51900b89f04cfdb27027e6",
"block_num": 3852,
"block_time": "2019-01-11T02:23:07.000",
"producer_block_id": "00000f0c7ada628ac7ffda0c4611e609b71978133c7ce9f0a4962d24a7d07a7e",
"account_ram_deltas": [],
"except": null,
"inline_traces": []
}
]
}
}
],
"last_irreversible_block": 33496
}