链APIget_info返回包含区块链的各种详细信息的对象。http://127.0.0.1:8888/v1/chain/get_infoNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_info’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});响应{ “server_version”: “d9ad8eec”, “head_block_num”: 8592, “last_irreversible_block_num”: 8591, “head_block_id”: “00002190e805475db152be7d3f4f1a075efaed42827cd551b0e23c7feabbedac”, “head_block_time”: “2018-04-27T17:40:34”, “head_block_producer”: “eosio”}get_block返回包含有关区块链上特定块的各种详细信息的对象。http://127.0.0.1:8888/v1/chain/get_blockNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_block’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例block_num_or_idstring提供块编号或块ID是5响应{ “previous”: “00000004471d48fe40706e73ce27f9cf7bac1704ae55279c7a58c0173718a711”, “timestamp”: “2018-04-18T16:24:23.500”, “transaction_mroot”: “e366c0cc3519bb0f2ddaec20928fa4d6aae546194bb1c4205c67be429147ed4a”, “action_mroot”: “77e5e91b594ab4ebc44ebc8c7ecdc9d26409c5a07452d3b20a4840562fdeb658”, “block_mroot”: “4ef85b0d212f3fffabdd65680d32dd7dded3461d9df226a6e3dc232e42978f8b”, “producer”: “eosio”, “schedule_version”: 0, “new_producers”: null, “producer_signature”: “EOSJzEdFDsueKCerL7a6AdxMxiT851cEiugFB7ux1PAGn5eMmco8j32NsaKupxibheQGVFEqyEdjMub67VZjKmsLzuNxxKtUA”, “regions”: [{ “region”: 0, “cycles_summary”: [ [{ “read_locks”: [], “write_locks”: [], “transactions”: [{ “status”: “executed”, “kcpu_usage”: 2, “net_usage_words”: 38, “id”: “9880c128683e24845ccd282ebe026bd522f7fa9c6278d885f6ed35164c680669” }] }] ] }], “input_transactions”: [], “id”: “000000056d75b0581b4fbb96affa36669a37173d21f46f8cb974f760e94bbe14”, “block_num”: 5, “ref_block_prefix”: 2528857883}get_block_header_statehttp://127.0.0.1:8888/v1/chain/get_block_header_stateNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_block_header_state’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例block_num_or_idstring提供块编号或块ID否1get_account返回一个对象,其中包含有关区块链上特定帐户的各种详细信息。http://127.0.0.1:8888/v1/chain/get_accountNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_account’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例account_namestring提供帐户名称是eosio响应{ “account_name”: “eosio”, “permissions”: [{ “perm_name”: “active”, “parent”: “owner”, “required_auth”: { “threshold”: 1, “keys”: [{ “key”: “EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV”, “weight”: 1 }], “accounts”: [] } }, { “perm_name”: “owner”, “parent”: “”, “required_auth”: { “threshold”: 1, “keys”: [{ “key”: “EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV”, “weight”: 1 }], “accounts”: [] } }]}get_abihttp://127.0.0.1:8888/v1/chain/get_abiNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_abi’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例account_namestring要检索ABI的帐户名称否eosio.tokenget_code返回一个对象,其中包含有关区块链上特定智能合约的各种详细信息。http://127.0.0.1:8888/v1/chain/get_codeNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_code’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例account_namestring提供智能合约帐户名称是currency响应{ “name”:“currency”, “code_hash”:“a1c8c84b4700c09c8edb83522237439e33cf011a4d7ace51075998bd002e04c9”, “wast”:"(module\n (type $0 (func (param i64 i64 i32) (result i32)))\n …truncated", “abi”: { “types”: [{ “new_type_name”: “account_name”, “type”: “name” } ], “structs”: [{ “name”: “transfer”, “base”: “”, “fields”: [ {“name”:“from”, “type”:“account_name”}, {“name”:“to”, “type”:“account_name”}, {“name”:“quantity”, “type”:“uint64”} ] },{ “name”: “account”, “base”: “”, “fields”: [ {“name”:“key”, “type”:“name”}, {“name”:“balance”, “type”:“uint64”} ] } ], “actions”: [{ “name”: “transfer”, “type”: “transfer” } ], “tables”: [{ “name”: “account”, “type”: “account”, “index_type”: “i64”, “key_names” : [“key”], “key_types” : [“name”] } ]}code_as_wasm自1.2.2起已弃用。get_raw_code_and_abihttp://127.0.0.1:8888/v1/chain/get_raw_code_and_abiNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_raw_code_and_abi’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例account_namestring帐户名称以获取代码和abi否eosioget_table_rows返回包含指定表中行的对象。http://127.0.0.1:8888/v1/chain/get_table_rowsNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_table_rows’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例scopestring数据范围所在的帐户名称是initacodestring控制提供的表的智能合约的名称是currencytablestirng要查询的表的名称是accounttable_keystring 否initajsonboolean返回json对象或返回格式化的响应是truelower_boundstring过滤结果以返回不小于集合中提供的值的第一个元素否 upper_boundstring过滤结果以返回大于集合中提供的值的第一个元素否 limitint32限制响应中返回的结果否10index_positionstring使用的索引的位置,例如,1表示主索引,2表示次要索引,等等否1key_typestringindex_position指定的键的类型(例如:uint64_t或name)否 encode_typestring 否dec响应{ “rows”: [ { “account”: “account”, “balance”: 1000 } ], “more”: false}get_table_by_scopehttp://127.0.0.1:8888/v1/chain/get_table_by_scopeNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_table_by_scope’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例codestring返回表数据的合同的name是 tablestring按表过滤结果否0lower_boundstring过滤结果以返回不小于集合中提供的值的第一个元素否 upper_boundstring过滤结果以返回大于集合中提供的值的第一个元素否 limitint32限制响应中返回的结果否10get_currency_balancehttp://127.0.0.1:8888/v1/chain/get_currency_balanceNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_currency_balance’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});查询参数参数名参数类型描述必要示例codestring 否 accountstring获取余额的账户否 symbolstring要查询的符号否 abi_json_to_bin将json序列化为二进制十六进制,生成的二进制十六进制通常用于push_transaction中的数据字段。http://127.0.0.1:8888/v1/chain/abi_json_to_binNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/abi_json_to_bin’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例codestring提供帐户名称否currencyactionstring提供操作参数否transferargsjson提供json参数否{“from”:“eosio”,“to”:“eosio”,“quantity”:1000}响应{ “binargs”: “000000008093dd74000000000094dd74e803000000000000”, “required_scope”: [], “required_auth”: []}abi_bin_to_json将二进制十六进制序列化为json。http://127.0.0.1:8888/v1/chain/abi_bin_to_jsonNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/abi_bin_to_json’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例codestring提供帐户名称是currencyactionstring提供操作名称是transferbinargsstring提供二进制参数是 响应{ “args”: { “from”: “initb”, “to”: “initc”, “quantity”: 1000 }, “required_scope”: [], “required_auth”: []}get_required_keys返回签名交易所需的密钥。http://127.0.0.1:8888/v1/chain/get_required_keysNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_required_keys’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例transactionjson提供交易对象是 available_keys字符串数组提供可用的密钥是 响应{ “required_keys”: [ “EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV” ]}示例transaction{ “ref_block_num”: “100”, “ref_block_prefix”: “137469861”, “expiration”: “2017-09-25T06:28:49”, “scope”: [“initb”, “initc”], “actions”: [{ “code”: “currency”, “type”: “transfer”, “recipients”: [“initb”, “initc”], “authorization”: [{ “account”: “initb”, “permission”: “active” }], “data”: “000000000041934b000000008041934be803000000000000” }], “signatures”: [], “authorizations”: []}available_keys[“EOS4toFS3YXEQCkuuw1aqDLrtHim86Gz9u3hBdcBw5KNPZcursVHq”, “EOS7d9A3uLe6As66jzN8j44TXJUqJSK3bFjjEEqR4oTvNAB3iM9SA”, “EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV”]get_currency_statshttp://127.0.0.1:8888/v1/chain/get_currency_statsNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_currency_stats’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例codestring 否 symbolstring获取统计数据的货币符号否SYSget_producershttp://127.0.0.1:8888/v1/chain/get_producersNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/get_producers’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例limitstring要检索的生产者总数否 lower_boundstring 否 jsonboolean以JSON格式返回结果?否truepush_blockhttp://127.0.0.1:8888/v1/chain/push_blockNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/push_block’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例timestampdate-time 否 producerstring 否 confirmedint32 否0previousstring 否 transaction_mrootstring 否 action_mrootint32 否0versionstring 否 new_producers字符串数组 否 header_extensions字符串数组 否 producer_signaturestring 否 transactionsarray 否 block_extensions字符串数组 否 push_transaction此方法需要JSON格式的交易,并尝试将其应用于区块链。http://127.0.0.1:8888/v1/chain/push_transactionNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/push_transaction’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例signatures字符串数组授权交易所需的签名数组否 compressionstring使用压缩,通常是false否falsepacked_context_free_datastringjson到十六进制否 packed_trxstringjson十六进制否 响应{ ’transaction_id’ = “1…"}push_transactions此方法需要JSON格式的交易,并尝试将其应用于区块链,此方法一次推送多个交易。http://127.0.0.1:8888/v1/chain/push_transactionsNodevar request = require(“request”);var options = { method: ‘POST’, url: ‘http://127.0.0.1:8888/v1/chain/push_transactions’ };request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body);});body参数参数名参数类型描述必要示例bodyjson提供交易的授权否 响应{ ’transaction_id’ = “1…"}这里的ref_block_num和ref_block_prefix是last_irreversible_block的/v1/chain/get_block的结果,可以通过调用/v1/chain/get_info找到last_irreversible_block,你还需要使用/v1/wallet/sign_transaction来获取正确的签名。