1. 前言
前面的文章陆续提到过EOS中的三种资源:内存、CPU和NET。一个账户如果要进行某些操作,例如转账,必须要有足够的资源,才能进行操作。
这篇文章对内存资源进行一个大概的讲解,并通过实例演示如何通过RPC API,操作内存的购买/出售。
我们依然在测试网络http://jungle.cryptolions.io:18888
上,使用Postman
对API进行测试。
2. 内存
内存资源是通过使用EOS Token购买获得的,可以由其他账户为你购买,也可以自己购买。不管是前面哪种形式为你购买的内存,都是属于你的,可以出售,获得的EOS Token也都会立刻打入到你的账户。
本质上,购买和出售内存,都是通过eosio.token
的transfer
方法,与系统账户eosio.ram
相互转账。同时,系统会在每次交易中(包括购买和出售)收取本次交易中EOS总额的5%
作为手续费,也就是向eosio.ramfee
转账。需要注意的是,内存资源是不可自动恢复的。
3. 购买内存
这里演示的是为自己购买内存。如果需要为他人购买内存,只需要将接收者改为他人的账户
购买内存是可以根据单位调用不同的方法:按bytes购买的buyrambytes
和按EOS购买的buyram
。我们这里使用buyram
3.1 查看账户内存总量
我们将使用账户testnetyy111
为自己购买内存,先查看该账户的内存及EOS情况:
api
http://jungle.cryptolions.io:18888/v1/chain/get_account
params
{"account_name":"testnetyy111"}
return
{
"account_name": "testnetyy111",
"head_block_num": 14124958,
"head_block_time": "2018-09-13T03:24:53.000",
"privileged": false,
"last_code_update": "2018-09-06T01:34:04.500",
"created": "2018-09-05T02:26:09.000",
"core_liquid_balance": "9361.6587 EOS",
"ram_quota": 1919695,
"net_weight": 1000000,
"cpu_weight": 1000000,
"net_limit": {
"used": 670,
"available": 19175369,
"max": 19176039
},
"cpu_limit": {
"used": 14318,
"available": 3637066,
"max": 3651384
},
"ram_usage": 194996,
"permissions": [
{
"perm_name": "active",
"parent": "owner",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6Z7mUQeFC2cQTT3xMyZh2wsLQoHih1bTMgRhr3dbichprTi7Rc",
"weight": 1
}
],
"accounts": [],
"waits": []
}
},
{
"perm_name": "owner",
"parent": "",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6cnhSLTn4eSUEqS4nC8frYTsVsjeH2M3hos1TUeCgme2Yim5Q5",
"weight": 1
}
],
"accounts": [],
"waits": []
}
}
],
"total_resources": {
"owner": "testnetyy111",
"net_weight": "100.0000 EOS",
"cpu_weight": "100.0000 EOS",
"ram_bytes": 1919695
},
"self_delegated_bandwidth": {
"from": "testnetyy111",
"to": "testnetyy111",
"net_weight": "100.0000 EOS",
"cpu_weight": "100.0000 EOS"
},
"refund_request": null,
"voter_info": {
"owner": "testnetyy111",
"proxy": "",
"producers": [],
"staked": 4800000,
"last_vote_weight": "0.00000000000000000",
"proxied_vote_weight": "0.00000000000000000",
"is_proxy": 0
}
}
显示内存总量为1919695
bytes
3.2 准备钱包和钱包服务
打开钱包服务keosd
,这里我们指定其服务IP为8899
:
yuyangdeMacBook-Pro:keosd yuyang$ keosd --http-server-address=localhost:8899
通过调用钱包的RPC API,我们打开并解锁钱包,保证钱包中有testnetyy111
的active
权限的公私钥。这部分不明白可以先看前面的文章
3.3 生成购买内存的bin字符串
调用eosio合约的
buyram
方法传入购买者账户名称和接收者账户名称
购买价值
100
EOS的内存
api
http://jungle.cryptolions.io:18888/v1/chain/abi_json_to_bin
params
{
"code": "eosio",
"action": "buyram",
"args": {
"payer": "testnetyy111",
"receiver": "testnetyy111",
"quant": "100.0000 EOS",
}
}
return
{
"binargs": "1042f03eab99b1ca1042f03eab99b1ca40420f000000000004454f5300000000"
}
3.4 获取当前最新的区块号
api
http://jungle.cryptolions.io:18888/v1/chain/get_info
params
无
return
{
"server_version": "08819aae",
"chain_id": "038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca",
"head_block_num": 14126837,
"last_irreversible_block_num": 14126505,
"last_irreversible_block_id": "00d78da96ec833f8a8ef539056aabd769ee8b1b122618567273e03ab6a814c3d",
"head_block_id": "00d78ef5f5ea4aa0a6ff406852a7fd225a4371fb772ca2f8d204478a8d57f5c4",
"head_block_time": "2018-09-13T03:40:34.500",
"head_block_producer": "komododragon",
"virtual_block_cpu_limit": 200000000,
"virtual_block_net_limit": 1048576000,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v1.2.5-dirty"
}
获取到区块号"head_block_num": 14126837
3.5 获取当前区块详情
api
http://jungle.cryptolions.io:18888/v1/chain/get_block
params
{"block_num_or_id":"14126837"}
return
{
"timestamp": "2018-09-13T03:40:34.500",
"producer": "komododragon",
"confirmed": 0,
"previous": "00d78ef47fb97a4af14294789e0854c50908460dcbc1d460b83722a9de213cab",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "bf137b5a5cacf10ae0aa6fd08018208712e5a3981c9a3729fbeb8d7adb0dcdbf",
"schedule_version": 222,
"new_producers": null,
"header_extensions": [],
"producer_signature": "SIG_K1_KhP3DQaX83gY3AKXSE89VZBZu6Z8jowsCybe7Monno24zWqXmyAZmmVPD78DgMR3UBYGE9BZa59jaZ36jk2v6GiUbogpbq",
"transactions": [],
"block_extensions": [],
"id": "00d78ef5f5ea4aa0a6ff406852a7fd225a4371fb772ca2f8d204478a8d57f5c4",
"block_num": 14126837,
"ref_block_prefix": 1749090214
}
获取到"timestamp": "2018-09-13T03:40:34.500"
和"ref_block_prefix": 1749090214
3.6 签署交易
过期时间我这里加了15分钟。
2018-09-13T03:40:34.500
==>2018-09-13T03:55:34.500
注意这里钱包服务的端口为
8899
api
http://127.0.0.1:8899/v1/wallet/sign_transaction
params
[{
"ref_block_num": 14126837,
"ref_block_prefix": 1749090214,
"expiration": "2018-09-13T03:55:34.500",
"actions": [{
"account": "eosio",
"name": "buyram",
"authorization": [{
"actor": "testnetyy111",
"permission": "active"
}],
"data": "1042f03eab99b1ca1042f03eab99b1ca40420f000000000004454f5300000000"
}],
"signatures": []
},
["EOS6Z7mUQeFC2cQTT3xMyZh2wsLQoHih1bTMgRhr3dbichprTi7Rc"], "038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca"
]
return
{
"expiration": "2018-09-13T03:55:34",
"ref_block_num": 36597,
"ref_block_prefix": 1749090214,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [
{
"account": "eosio",
"name": "buyram",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": "1042f03eab99b1ca1042f03eab99b1ca40420f000000000004454f5300000000"
}
],
"transaction_extensions": [],
"signatures": [
"SIG_K1_Keg3tfhNa7PBFpbQAEwf4g4hFtr4aMjyE4DUZEVf9LoeGQ8M7RbKM3yV5fM4adX9vaYQcjxPuccx5Vkbs6FTGn5GEAaqbf"
],
"context_free_data": []
}
获取到signatures
3.7 提交交易
api
http://jungle.cryptolions.io:18888/v1/chain/push_transaction
params
{
"compression": "none",
"transaction": {
"expiration": "2018-09-13T03:55:34.500",
"ref_block_num": 14126837,
"ref_block_prefix": 1749090214,
"context_free_actions": [],
"actions": [
{
"account": "eosio",
"name": "buyram",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": "1042f03eab99b1ca1042f03eab99b1ca40420f000000000004454f5300000000"
}
],
"transaction_extensions": []
},
"signatures": [
"SIG_K1_Keg3tfhNa7PBFpbQAEwf4g4hFtr4aMjyE4DUZEVf9LoeGQ8M7RbKM3yV5fM4adX9vaYQcjxPuccx5Vkbs6FTGn5GEAaqbf"
]
}
return
{
"transaction_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"processed": {
"id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"receipt": {
"status": "executed",
"cpu_usage_us": 5137,
"net_usage_words": 16
},
"elapsed": 5137,
"net_usage": 128,
"scheduled": false,
"action_traces": [
{
"receipt": {
"receiver": "eosio",
"act_digest": "4e5dc9b3eb3dc6c195e1eae6f707a7726c7d1b37ed5a21e60d4c9d86650b580b",
"global_sequence": 33524785,
"recv_sequence": 15582921,
"auth_sequence": [
[
"testnetyy111",
66
]
],
"code_sequence": 12,
"abi_sequence": 13
},
"act": {
"account": "eosio",
"name": "buyram",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"payer": "testnetyy111",
"receiver": "testnetyy111",
"quant": "100.0000 EOS"
},
"hex_data": "1042f03eab99b1ca1042f03eab99b1ca40420f000000000004454f5300000000"
},
"elapsed": 2899,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": [
{
"receipt": {
"receiver": "eosio.token",
"act_digest": "221ad33543cd80f6c7881fe0bbaf6f07f50f7a5b69d6eb7f305743f1e01a57d8",
"global_sequence": 33524786,
"recv_sequence": 1728346,
"auth_sequence": [
[
"eosio.ram",
240865
],
[
"testnetyy111",
67
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
},
{
"actor": "eosio.ram",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ram",
"quantity": "99.5000 EOS",
"memo": "buy ram"
},
"hex_data": "1042f03eab99b1ca000090e602ea3055b82e0f000000000004454f5300000000076275792072616d"
},
"elapsed": 857,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": [
{
"receipt": {
"receiver": "testnetyy111",
"act_digest": "221ad33543cd80f6c7881fe0bbaf6f07f50f7a5b69d6eb7f305743f1e01a57d8",
"global_sequence": 33524787,
"recv_sequence": 24,
"auth_sequence": [
[
"eosio.ram",
240866
],
[
"testnetyy111",
68
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
},
{
"actor": "eosio.ram",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ram",
"quantity": "99.5000 EOS",
"memo": "buy ram"
},
"hex_data": "1042f03eab99b1ca000090e602ea3055b82e0f000000000004454f5300000000076275792072616d"
},
"elapsed": 101,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": []
},
{
"receipt": {
"receiver": "eosio.ram",
"act_digest": "221ad33543cd80f6c7881fe0bbaf6f07f50f7a5b69d6eb7f305743f1e01a57d8",
"global_sequence": 33524788,
"recv_sequence": 268055,
"auth_sequence": [
[
"eosio.ram",
240867
],
[
"testnetyy111",
69
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
},
{
"actor": "eosio.ram",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ram",
"quantity": "99.5000 EOS",
"memo": "buy ram"
},
"hex_data": "1042f03eab99b1ca000090e602ea3055b82e0f000000000004454f5300000000076275792072616d"
},
"elapsed": 11,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": []
}
]
},
{
"receipt": {
"receiver": "eosio.token",
"act_digest": "ffaa2ca1c668c416c80fe1f1603071a8755da3dbdd6de54114a34d95474d2d0b",
"global_sequence": 33524789,
"recv_sequence": 1728347,
"auth_sequence": [
[
"testnetyy111",
70
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ramfee",
"quantity": "0.5000 EOS",
"memo": "ram fee"
},
"hex_data": "1042f03eab99b1caa0d492e602ea3055881300000000000004454f53000000000772616d20666565"
},
"elapsed": 655,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": [
{
"receipt": {
"receiver": "testnetyy111",
"act_digest": "ffaa2ca1c668c416c80fe1f1603071a8755da3dbdd6de54114a34d95474d2d0b",
"global_sequence": 33524790,
"recv_sequence": 25,
"auth_sequence": [
[
"testnetyy111",
71
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ramfee",
"quantity": "0.5000 EOS",
"memo": "ram fee"
},
"hex_data": "1042f03eab99b1caa0d492e602ea3055881300000000000004454f53000000000772616d20666565"
},
"elapsed": 85,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": []
},
{
"receipt": {
"receiver": "eosio.ramfee",
"act_digest": "ffaa2ca1c668c416c80fe1f1603071a8755da3dbdd6de54114a34d95474d2d0b",
"global_sequence": 33524791,
"recv_sequence": 267971,
"auth_sequence": [
[
"testnetyy111",
72
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ramfee",
"quantity": "0.5000 EOS",
"memo": "ram fee"
},
"hex_data": "1042f03eab99b1caa0d492e602ea3055881300000000000004454f53000000000772616d20666565"
},
"elapsed": 19,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "13f0c5cb007117eba96ec4173441d03cc95b6f463bfc8af41f532540510762ee",
"inline_traces": []
}
]
}
]
}
],
"except": null
}
}
3.8 查询内存
api
http://jungle.cryptolions.io:18888/v1/chain/get_account
params
{"account_name":"testnetyy111"}
return
{
"account_name": "testnetyy111",
"head_block_num": 14128474,
"head_block_time": "2018-09-13T03:54:22.500",
"privileged": false,
"last_code_update": "2018-09-06T01:34:04.500",
"created": "2018-09-05T02:26:09.000",
"core_liquid_balance": "9261.6587 EOS",
"ram_quota": 3550705,
"net_weight": 1000000,
"cpu_weight": 1000000,
"net_limit": {
"used": 286,
"available": 19175747,
"max": 19176033
},
"cpu_limit": {
"used": 4901,
"available": 3646482,
"max": 3651383
},
"ram_usage": 194996,
"permissions": [
{
"perm_name": "active",
"parent": "owner",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6Z7mUQeFC2cQTT3xMyZh2wsLQoHih1bTMgRhr3dbichprTi7Rc",
"weight": 1
}
],
"accounts": [],
"waits": []
}
},
{
"perm_name": "owner",
"parent": "",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6cnhSLTn4eSUEqS4nC8frYTsVsjeH2M3hos1TUeCgme2Yim5Q5",
"weight": 1
}
],
"accounts": [],
"waits": []
}
}
],
"total_resources": {
"owner": "testnetyy111",
"net_weight": "100.0000 EOS",
"cpu_weight": "100.0000 EOS",
"ram_bytes": 3549305
},
"self_delegated_bandwidth": {
"from": "testnetyy111",
"to": "testnetyy111",
"net_weight": "100.0000 EOS",
"cpu_weight": "100.0000 EOS"
},
"refund_request": null,
"voter_info": {
"owner": "testnetyy111",
"proxy": "",
"producers": [],
"staked": 4800000,
"last_vote_weight": "0.00000000000000000",
"proxied_vote_weight": "0.00000000000000000",
"is_proxy": 0
}
}
显示内存总量为3550705
bytes
4. 出售内存
4.1 生成出售内存的bin字符串
调用
eosio
合约的sellram
方法传入出售者账户名称
出售
10000
bytes的内存
api
http://jungle.cryptolions.io:18888/v1/chain/abi_json_to_bin
params
{
"code": "eosio",
"action": "sellram",
"args": {
"account": "testnetyy111",
"bytes": 10000,
}
}
return
{
"binargs": "1042f03eab99b1ca1027000000000000"
}
4.2 获取当前最新的区块号
api
http://jungle.cryptolions.io:18888/v1/chain/get_info
params
无
return
{
"server_version": "08819aae",
"chain_id": "038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca",
"head_block_num": 14146004,
"last_irreversible_block_num": 14145678,
"last_irreversible_block_id": "00d7d88e22b1824240ed00b50ffbd6875f59c473f49a2b38aae53c4687351689",
"head_block_id": "00d7d9d4226a32bfc96c4b7e8f844f2a9d8b7c8cea6fcdbcbb941bd5969c2c4b",
"head_block_time": "2018-09-13T06:22:12.500",
"head_block_producer": "komododragon",
"virtual_block_cpu_limit": 200000000,
"virtual_block_net_limit": 1048576000,
"block_cpu_limit": 199900,
"block_net_limit": 1048576,
"server_version_string": "v1.2.5-dirty"
}
获取到区块号"head_block_num": 14146004
4.3 获取当前区块详情
api
http://jungle.cryptolions.io:18888/v1/chain/get_block
params
{"block_num_or_id":"14146004"}
return
{
"timestamp": "2018-09-13T06:22:12.500",
"producer": "komododragon",
"confirmed": 0,
"previous": "00d7d9d3f6cc0c36f97f489450de29cd632a1764bd43012736217bba4be86439",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "cf0060f7ce2d95320aa0552ef2f7dac6b54100d06b48571e8444732f13570ff5",
"schedule_version": 222,
"new_producers": null,
"header_extensions": [],
"producer_signature": "SIG_K1_KbqquTNuMAGA6c6tzQ4cWWyfMB6fpg7YMYcZ4uKX1sXAGAff4x5SDe9vHAWNth2tPm4e2zrxSN9Vn78QBAQ4MtUi58L6yQ",
"transactions": [],
"block_extensions": [],
"id": "00d7d9d4226a32bfc96c4b7e8f844f2a9d8b7c8cea6fcdbcbb941bd5969c2c4b",
"block_num": 14146004,
"ref_block_prefix": 2118872265
}
获取到"timestamp": "2018-09-13T06:22:12.500"
和"ref_block_prefix": 2118872265
4.4 签署交易
过期时间我这里加了
20
分钟。2018-09-13T06:22:12.500
==>2018-09-13T06:42:12.500
注意这里钱包服务的端口为
8899
api
http://127.0.0.1:8899/v1/wallet/sign_transaction
params
[{
"ref_block_num": 14146004,
"ref_block_prefix": 2118872265,
"expiration": "2018-09-13T06:42:12.500",
"actions": [{
"account": "eosio",
"name": "sellram",
"authorization": [{
"actor": "testnetyy111",
"permission": "active"
}],
"data": "1042f03eab99b1ca1027000000000000"
}],
"signatures": []
},
["EOS6Z7mUQeFC2cQTT3xMyZh2wsLQoHih1bTMgRhr3dbichprTi7Rc"], "038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca"
]
return
{
"expiration": "2018-09-13T06:42:12",
"ref_block_num": 55764,
"ref_block_prefix": 2118872265,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [
{
"account": "eosio",
"name": "sellram",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": "1042f03eab99b1ca1027000000000000"
}
],
"transaction_extensions": [],
"signatures": [
"SIG_K1_K2cRQHroiLofk1tXrKy1w5XzwnC5CAYNjmzEx6aFgVUq8WjKapXXbrBjUF5RrRaUAQnb2zLVMbRS2sGUogTNV9k31SoxhM"
],
"context_free_data": []
}
获取到signatures
4.5 提交交易
api
http://jungle.cryptolions.io:18888/v1/chain/push_transaction
params
{
"compression": "none",
"transaction": {
"expiration": "2018-09-13T06:42:12",
"ref_block_num": 14146004,
"ref_block_prefix": 2118872265,
"context_free_actions": [],
"actions": [
{
"account": "eosio",
"name": "sellram",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": "1042f03eab99b1ca1027000000000000"
}
],
"transaction_extensions": []
},
"signatures": [
"SIG_K1_K2cRQHroiLofk1tXrKy1w5XzwnC5CAYNjmzEx6aFgVUq8WjKapXXbrBjUF5RrRaUAQnb2zLVMbRS2sGUogTNV9k31SoxhM"
]
}
return
{
"transaction_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"processed": {
"id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"receipt": {
"status": "executed",
"cpu_usage_us": 4282,
"net_usage_words": 14
},
"elapsed": 4282,
"net_usage": 112,
"scheduled": false,
"action_traces": [
{
"receipt": {
"receiver": "eosio",
"act_digest": "005d6606ee653aed9ef8751fcfbdbfd559b94b77651bd929089471ee879d0989",
"global_sequence": 33547236,
"recv_sequence": 15602221,
"auth_sequence": [
[
"testnetyy111",
73
]
],
"code_sequence": 12,
"abi_sequence": 13
},
"act": {
"account": "eosio",
"name": "sellram",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"account": "testnetyy111",
"bytes": 10000
},
"hex_data": "1042f03eab99b1ca1027000000000000"
},
"elapsed": 2288,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": [
{
"receipt": {
"receiver": "eosio.token",
"act_digest": "dbc41f680656ded6386b573f3f8c8047fa48f27981abe8a58359fdba772701ff",
"global_sequence": 33547237,
"recv_sequence": 1728649,
"auth_sequence": [
[
"eosio.ram",
240961
],
[
"testnetyy111",
74
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio.ram",
"permission": "active"
},
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "eosio.ram",
"to": "testnetyy111",
"quantity": "0.6114 EOS",
"memo": "sell ram"
},
"hex_data": "000090e602ea30551042f03eab99b1cae21700000000000004454f53000000000873656c6c2072616d"
},
"elapsed": 762,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": [
{
"receipt": {
"receiver": "eosio.ram",
"act_digest": "dbc41f680656ded6386b573f3f8c8047fa48f27981abe8a58359fdba772701ff",
"global_sequence": 33547238,
"recv_sequence": 268087,
"auth_sequence": [
[
"eosio.ram",
240962
],
[
"testnetyy111",
75
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio.ram",
"permission": "active"
},
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "eosio.ram",
"to": "testnetyy111",
"quantity": "0.6114 EOS",
"memo": "sell ram"
},
"hex_data": "000090e602ea30551042f03eab99b1cae21700000000000004454f53000000000873656c6c2072616d"
},
"elapsed": 10,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": []
},
{
"receipt": {
"receiver": "testnetyy111",
"act_digest": "dbc41f680656ded6386b573f3f8c8047fa48f27981abe8a58359fdba772701ff",
"global_sequence": 33547239,
"recv_sequence": 26,
"auth_sequence": [
[
"eosio.ram",
240963
],
[
"testnetyy111",
76
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "eosio.ram",
"permission": "active"
},
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "eosio.ram",
"to": "testnetyy111",
"quantity": "0.6114 EOS",
"memo": "sell ram"
},
"hex_data": "000090e602ea30551042f03eab99b1cae21700000000000004454f53000000000873656c6c2072616d"
},
"elapsed": 86,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": []
}
]
},
{
"receipt": {
"receiver": "eosio.token",
"act_digest": "59ff848057e6835eee282488257c6fbaff7e70f8372de647ceba8b348f5ef943",
"global_sequence": 33547240,
"recv_sequence": 1728650,
"auth_sequence": [
[
"testnetyy111",
77
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ramfee",
"quantity": "0.0031 EOS",
"memo": "sell ram fee"
},
"hex_data": "1042f03eab99b1caa0d492e602ea30551f0000000000000004454f53000000000c73656c6c2072616d20666565"
},
"elapsed": 625,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": [
{
"receipt": {
"receiver": "testnetyy111",
"act_digest": "59ff848057e6835eee282488257c6fbaff7e70f8372de647ceba8b348f5ef943",
"global_sequence": 33547241,
"recv_sequence": 27,
"auth_sequence": [
[
"testnetyy111",
78
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ramfee",
"quantity": "0.0031 EOS",
"memo": "sell ram fee"
},
"hex_data": "1042f03eab99b1caa0d492e602ea30551f0000000000000004454f53000000000c73656c6c2072616d20666565"
},
"elapsed": 77,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": []
},
{
"receipt": {
"receiver": "eosio.ramfee",
"act_digest": "59ff848057e6835eee282488257c6fbaff7e70f8372de647ceba8b348f5ef943",
"global_sequence": 33547242,
"recv_sequence": 268003,
"auth_sequence": [
[
"testnetyy111",
79
]
],
"code_sequence": 4,
"abi_sequence": 4
},
"act": {
"account": "eosio.token",
"name": "transfer",
"authorization": [
{
"actor": "testnetyy111",
"permission": "active"
}
],
"data": {
"from": "testnetyy111",
"to": "eosio.ramfee",
"quantity": "0.0031 EOS",
"memo": "sell ram fee"
},
"hex_data": "1042f03eab99b1caa0d492e602ea30551f0000000000000004454f53000000000c73656c6c2072616d20666565"
},
"elapsed": 30,
"cpu_usage": 0,
"console": "",
"total_cpu_usage": 0,
"trx_id": "47c4e5a627645880beb7a9985e20f4e46bbd14a1db72a80784703cd18c14520e",
"inline_traces": []
}
]
}
]
}
],
"except": null
}
}
4.6 查询内存
api
http://jungle.cryptolions.io:18888/v1/chain/get_account
params
{"account_name":"testnetyy111"}
return
{
"account_name": "testnetyy111",
"head_block_num": 14148102,
"head_block_time": "2018-09-13T06:39:43.000",
"privileged": false,
"last_code_update": "2018-09-06T01:34:04.500",
"created": "2018-09-05T02:26:09.000",
"core_liquid_balance": "9262.2670 EOS",
"ram_quota": 3540705,
"net_weight": 1000000,
"cpu_weight": 1000000,
"net_limit": {
"used": 366,
"available": 19175646,
"max": 19176012
},
"cpu_limit": {
"used": 15543,
"available": 3635835,
"max": 3651378
},
"ram_usage": 194996,
"permissions": [
{
"perm_name": "active",
"parent": "owner",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6Z7mUQeFC2cQTT3xMyZh2wsLQoHih1bTMgRhr3dbichprTi7Rc",
"weight": 1
}
],
"accounts": [],
"waits": []
}
},
{
"perm_name": "owner",
"parent": "",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6cnhSLTn4eSUEqS4nC8frYTsVsjeH2M3hos1TUeCgme2Yim5Q5",
"weight": 1
}
],
"accounts": [],
"waits": []
}
}
],
"total_resources": {
"owner": "testnetyy111",
"net_weight": "100.0000 EOS",
"cpu_weight": "100.0000 EOS",
"ram_bytes": 3539305
},
"self_delegated_bandwidth": {
"from": "testnetyy111",
"to": "testnetyy111",
"net_weight": "100.0000 EOS",
"cpu_weight": "100.0000 EOS"
},
"refund_request": null,
"voter_info": {
"owner": "testnetyy111",
"proxy": "",
"producers": [],
"staked": 4800000,
"last_vote_weight": "0.00000000000000000",
"proxied_vote_weight": "0.00000000000000000",
"is_proxy": 0
}
}
显示内存总量为3540705
bytes