EOS HTTP API 参数详解CHAIN(一)

EOS HTTP API 参数详解

EOS HTTP API 参数详解 CHAIN(一)

EOS HTTP API CHAIN

get_info

get_info 返回最新区块信息

地址:/v1/chain/get_info
请求方式: POST/GET
参数

请求实例

curl http://127.0.0.1:8888/v1/chain/get_info

返回值

{
	"server_version": "1a14e9cd",//节点版本
	"chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
	"head_block_num": 44045899,//区块高度
	"last_irreversible_block_num": 44045565,//不可逆区块高度
	"last_irreversible_block_id": "02a014fdbee3025104fe4356720f84ee9e7df56d923bc47726df2b7c6a3f8c94",//不可逆区块ID
	"head_block_id": "02a0164ba2f077ecd51c44bc1fde87eb48a945a0563e24dc2e2999b61c529bd2",//区块ID
	"head_block_time": "2019-02-22T03:01:04.500",//区块生产时间
	"head_block_producer": "eoshuobipool",//区块生产者
	"virtual_block_cpu_limit": 200000000,
	"virtual_block_net_limit": 1048576000,
	"block_cpu_limit": 197897,
	"block_net_limit": 1048320,
	"server_version_string": "v1.6.1"
}

get_block

get_block 返回指定区块详细信息

地址:/v1/chain/get_block
请求方式: POSTJSON
参数
block_num_or_id (块ID 或块高度)

请求实例

curl -X POST -H ‘Content-Type:application/json’ --data ‘{“block_num_or_id”:“363484”}’ http://127.0.0.1:8888/v1/chain/get_block

返回值

{
"timestamp": "2019-02-22T03:00:01.000",
"producer": "eosio",
"confirmed": 0,
"previous": "00058bdba15dc41526fc23f4a3633d986ea3098b6108b80f57fc23d2084e48f5",
"transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
"action_mroot": "e3fef3ba74aa2450b1336919e7eb5f4eb2416d32efd3f19a13c5b8194fac2cb9",
"schedule_version": 0,
"new_producers": null,
"header_extensions": [],
"producer_signature": "SIG_K1_K3r6TJUVXs4Y76qg4aQTmLXbtFXxcGtAVXuGheV64wkt67semZchaByW8NtEDDY93UM7yjFoV5yp2dW65iVy4Kp3VK43xt",
"transactions": [],、//区块中的交易,下面会有一些交易的数据 如交易ID等
"block_extensions": [],
"id": "00058bdc0710ff007931bbfdb42e43f42f4153640f5c50d88c2a7ab504ec25ef",
"block_num": 363484,
"ref_block_prefix": 4256903545

}

get_account

get_account 返回指定账户信息

地址:/v1/chain/get_account
请求方式: POSTJSON
参数
account_name (账号名)

请求实例

curl -X POST -H ‘Content-Type:application/json’ --data ‘{“account_name”:“heztanrugege”}’ https://127.0.0.1:8888/v1/chain/get_account

返回值

owner公钥和active公钥 在创建账号时 都会绑定2个公钥 2个公钥的权限不同 owner > active

{
“account_name”: “heztanrugege”,
“head_block_num”: 44063582,
“head_block_time”: “2019-02-22T05:28:31.000”,
“privileged”: false,
“last_code_update”: “1970-01-01T00:00:00.000”,
“created”: “2018-06-09T12:02:07.500”,
“core_liquid_balance”: “2.6495 EOS”,
“ram_quota”: 9555,
“net_weight”: 10000,
“cpu_weight”: 2990000,
“net_limit”: {
“used”: 1144,
“available”: 848599,
“max”: 849743
},
“cpu_limit”: {
“used”: 4405,
“available”: 40262915,
“max”: 40267320
},
“ram_usage”: 5230,
“permissions”: [{
“perm_name”: “active”,
“parent”: “owner”,
“required_auth”: {
“threshold”: 1,
“keys”: [{
“key”: “EOS6Yy5vh4AdNk5quxpMbH8AZBaQ5FrWnXe52f2sgqetidyHSmppD”,//active公钥
“weight”: 1
}],
“accounts”: [],
“waits”: []
}
}, {
“perm_name”: “owner”,
“parent”: “”,
“required_auth”: {
“threshold”: 1,
“keys”: [{
“key”: “EOS8jMYkT7BUavpZ5fK6RtbSg5terCn4L6w2EScfTAqGrg1hjzoQD”,//owner公钥
“weight”: 1
}],
“accounts”: [],
“waits”: []
}
}],
“total_resources”: {
“owner”: “heztanrugege”,
“net_weight”: “1.0000 EOS”,
“cpu_weight”: “299.0000 EOS”,
“ram_bytes”: 8155
},
“self_delegated_bandwidth”: {
“from”: “heztanrugege”,
“to”: “heztanrugege”,
“net_weight”: “1.0000 EOS”,
“cpu_weight”: “299.0000 EOS”
},
“refund_request”: null,
“voter_info”: {
“owner”: “heztanrugege”,
“proxy”: “”,
“producers”: [“eoshuobipool”],
“staked”: 7000000,
“last_vote_weight”: “3719263910568.08300781250000000”,
“proxied_vote_weight”: “0.00000000000000000”,
“is_proxy”: 0,
“flags1”: 0,
“reserved2”: 0,
“reserved3”: “0.0000 EOS”
}
}

get_table_rows

get_table_rows 返回表信息

地址:/v1/chain/get_table_rows
请求方式: POSTJSON
参数
scope (数据库表作用域)
code(合约托管账号)
table(表名)
json(是否返回json数据,true or false)
lower_bound(根据索引查询,该字段类似于>=,配置索引使用,筛选出该索引后的数据)
upper_bound(根据索引查询,该字段类似于<,配置索引使用,筛选出该索引前的数据)
limit(返回结果上线)
index_position(需要使用的索引默认为1 ,1一般代表主键,这个会配合lower_bound,upper_bound使用,lower_bound,upper_bound指的索引就是根据该值进行筛选)
key_type(索引键类型)

请求实例

curl -X POST -H ‘Content-Type:application/json’ --data ‘{“code”:“eosio.token”,“scope”:“eosio.token”,“table”:"??",“limit”:20}’ https://127.0.0.1:8888/v1/chain/get_table_rows

返回值

{
"more":false,//是否还有更多的数据
"rows":[]//表数据
}

get_currency_balance

get_currency_balance 返回合约账号余额

地址:/v1/chain/get_currency_balance
请求方式: POSTJSON
参数
code(合约托管账号)
account(账号)
symbol(代币符号或称为币种)

请求实例

curl -X POST -H ‘Content-Type:application/json’ --data ‘{“code”:“eosio.token”,“account”:“heztanrugege”,“symbol”:“EOS”}’ https://127.0.0.1:8888/v1/chain/get_currency_balance

返回值

["2.6495 EOS"]

get_currency_balance

get_currency_balance 返回合约账号余额

地址:/v1/chain/get_currency_balance
请求方式: POSTJSON
参数
code(合约托管账号)
account(账号)
symbol(代币符号或称为币种)

请求实例

curl -X POST -H ‘Content-Type:application/json’ --data ‘{“code”:“eosio.token”,“account”:“heztanrugege”,“symbol”:“EOS”}’ https://127.0.0.1:8888/v1/chain/get_currency_balance

返回值

["2.6495 EOS"]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值