EOS Small White Learning (v) EOS HTTP API

Source: Internet
Author: User

Welcome to the EOS Small White Learning series, this series will record some of the operations and details of the EOS learning process, the pie fruit Non-C + + origins, if there are errors, welcome to point out

Next article:

This article will list the EOS-supported HTTP APIs (chain and history), without much explanation, just to make it easy for everyone to call

1. Chain/get_info (Request chain information)

POST:

Http://127.0.0.1:8888/v1/chain/get_info

BODY: No need to fill in anything

{}

RESPONSE:

{    "server_version": "75635168",    "chain_id": " cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f ",    " Head_block_num ": 43060,    " Last_ Irreversible_block_num ": 43059,    " last_irreversible_block_id ":" 0000a833ade6bcfaa05490c14b9e2dec3b59271001314048405a0b2b8fb35f7e ",    " head_block_id ":" 0000a834303d5901171d86c699f0a00a309dcf86ad28252f1b05191b3f3f509e ",    " Head_block_time ":" 2018-07-24T06 : 56:29.500 ",    " Head_block_producer ":" Eosio ",    " Virtual_block_cpu_limit ": 200000000,    " Virtual_block_ Net_limit ": 1048576000,    " Block_cpu_limit ": 199900,    " Block_net_limit ": 1048576}

2. Chain/get_block (Request block information)

POST:

Http://127.0.0.1:8888/v1/chain/get_block

BODY: Need to fill in block number

{
"block_num_or_id": 19238
}

RESPONSE:

{    "timestamp": "2018-07-22t02:55:41.000",    "producer": "Eosio",    "confirmed": 0,    "previous": " 00004b25b6213b5de760937e2315611de3a65cdacfea4bdf757ba46730d79d06 ",    " Transaction_mroot ":" 0000000000000000000000000000000000000000000000000000000000000000 ",    " Action_mroot ":" 1738e6b70e77ce96a56982dc3eda3cc2191801e1e15854935508c91891c10385 ",    " Schedule_version ": 0,    " new_ Producers ": null,    " header_extensions ": [],    " producer_signature ":" Sig_k1_ Jwy7atxzlmx6wy4dfyqhq2vksaa77k4rh7fcbh9cq6fma8hzdwy5nhssjzubgtl8tnzroerazgry3aqnpuvcmgwcren7rz ",    " Transactions ": [],    " block_extensions ": [],    " id ":" 00004b269841c0b8899b8c5218eaf1d5beb1881ece8f1303954cc65d944a8365 ",    " Block_num ": 19238,    " Ref_block_ Prefix ": 1384946569}

3. Chain/get_account (Request information from account)

POST:

Http://127.0.0.1:8888/v1/chain/get_account

BODY: Need to fill in the account name

{
"Account_name": "Dabingguozi"
}

RESPONSE:

{"account_name": "Dabingguozi", "Head_block_num": 44279, "Head_block_time": "2018-07-24t07:06:39.000", "Privi Leged ": false," last_code_update ":" 1970-01-01t00:00:00.000 "," Created ":" 2018-07-21t08:04:17.000 "," core_liquid_        Balance ":" 554.0000 SYS "," Ram_quota ": 8150," net_weight ": 10000000," cpu_weight ": 10000000," Net_limit ": {         "used": 0, "available": "347781061036", "Max": "347781061036"}, "Cpu_limit": {"used": 0,            "Available": "66333973128", "Max": "66333973128"}, "Ram_usage": 2996, "Permissions": [{ "Perm_name": "Active", "parent": "Owner", "Required_auth": {"threshold": 1 , "Keys": [{"Key": "Eos6mryajqq8ud7hvnycfnvpjqcvpscn5so8bhthugy                QET5GDW5CV "," Weight ": 1}]," Accounts ": [],  "Waits": []          }}, {"Perm_name": "Owner", "Parent": "", "Required_auth": { "Threshold": 1, "Keys": [{"Key": "EOS6MRYAJQQ8UD7HV                NYCFNVPJQCVPSCN5SO8BHTHUGYQET5GDW5CV "," Weight ": 1}], "Accounts": [], "Waits": []}}], "Total_resources": {"owner": "Dabi Ngguozi "," Net_weight ":" 1000.0000 sys "," cpu_weight ":" 1000.0000 SYS "," Ram_bytes ": 8150}," s Elf_delegated_bandwidth ": null," refund_request ": null," Voter_info ": null}


4. Chain/get_abi (Request for contract information)

POST:

Http://127.0.0.1:8888/v1/chain/get_abi

BODY: Need to fill in the contract user name

{
"Account_name": "Eosio.token"
}

RESPONSE:

{"account_name": "Eosio.token", "Abi": {"version": "eosio::abi/1.0", "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": "Asset"},             {"Name": "Memo", "Type": "string"}]                    }, {"Name": "Create", "base": "", "Fields": [           {             "Name": "Issuer", "type": "Account_name"}, {                "Name": "Maximum_supply", "type": "Asset"}                    ]}, {"Name": "Issue", "Base": "", "Fields": [                    {"Name": "To", "type": "Account_name"},                    {"Name": "Quantity", "type": "Asset"},                {"Name": "Memo", "Type": "String"} ]}, {"name": "Account", "Base": "", "fi                    ELDs ": [{" Name ":" Balance "," type ":" Asset "               } ]}, {"Name": "Currency_stats", "Base": "", "Fields":                    [{"Name": "Supply", "type": "Asset"                    }, {"Name": "Max_supply", "type": "Asset"                    }, {"Name": "Issuer", "type": "Account_name" }]}], "actions": [{"Name": "Transfer" , "type": "Transfer", "Ricardian_contract": ""}, {"NA                Me ":" Issue "," type ":" Issue "," Ricardian_contract ":" "}, {        "Name": "Create", "type": "Create", "Ricardian_contract": ""}],        "Tables": [    {"Name": "Accounts", "Index_type": "i64", "Key_names": [                "Currency"], "key_types": ["UInt64"],                "Type": "Account"}, {"Name": "Stat", "Index_type": "I64", "Key_names": ["Currency"], "key_types": ["UI        Nt64 "]," type ":" Currency_stats "}]," ricardian_clauses ": [], "Error_messages": [], "abi_extensions": []}}

5. Chain/get_table_rows (Request form information)

POST:

Http://127.0.0.1:8888/v1/chain/get_table_rows

BODY: Where code is a contract account, scope is set in the contract (equivalent to MySQL database), table is also set in the contract (equivalent to MySQL table)

{
"Code": "Eosio.token",
"Scope": "Dabingguozi",
"Table": "Accounts",
"JSON": True
}

RESPONSE:

{"    rows": [        {            "balance": "554.0000 SYS"        }    ],    "more": false}

6. Chain/get_currency_balance (Request for balance information)

POST:

Http://127.0.0.1:8888/v1/chain/get_currency_balance

BODY: Where code is a contract account

{
"Code": "Eosio.token",
"Account": "Dabingguozi"
}

RESPONSE:

[    "554.0000 SYS"]

7. History/get_transactions (Request transaction information)

POST:

Http://127.0.0.1:8888/v1/history/get_transaction

BODY: Need to fill in the ID of transaction

{
"id": "b09395d938e594b838277453cea832ddc5d57ab5e92d8763ea011df9e35d7b34"
}

RESPONSE:

{"id": "b09395d938e594b838277453cea832ddc5d57ab5e92d8763ea011df9e35d7b34", "Trx": {"receipt": {                "Status": "Executed", "Cpu_usage_us": 2751, "net_usage_words": +, "TRX": [ 1, {"Signatures": ["SIG_K1_KFYZBH4ED1QAMONTVHFNV5AVUFKMD5NZGX TAXQGMN96XMTUHW5YQJMKFWEJRS8JBNGUGDD44Y8ZRRSZNWTKVJZZ9TJKEJW "]," compression ":" Non E "," Packed_context_free_data ":" "," Packed_trx ":" 4bf2535b264b899b8c52000000000100a 6823403ea3055000000572d3ccdcd010000000000ea305500000000a8ed3232210000000000ea305500dca79ab1e98e49a08601000000000004535953            000000000000 "}]}," Trx ": {" Expiration ":" 2018-07-22t02:56:11 ",            "Ref_block_num": 19238, "Ref_block_prefix": 1384946569, "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", "t                    O ":" Dabingguozi "," Quantity ":" 10.0000 SYS "," Memo ":" "            }, "Hex_data": "0000000000ea305500dca79ab1e98e49a086010000000000045359530000000000"} ], "transaction_extensions": [], "signatures": ["SIG_K1_KFYZBH4ED1QAMONTVHF  NV5AVUFKMD5NZGXTAXQGMN96XMTUHW5YQJMKFWEJRS8JBNGUGDD44Y8ZRRSZNWTKVJZZ9TJKEJW "]," context_free_data ": []}, "bLock_time ":" 2018-07-22t02:55:42.000 "," Block_num ": 19240," Last_irreversible_block ": 63969," traces ": [{ "Receipt": {"receiver": "Dabingguozi", "Act_digest": "f8ce7062290be813e6484e50c                7c0e3c22a9898e3240bab76f7e11b99c07abe52 "," global_sequence ": 19298," recv_sequence ": 5,                    "Auth_sequence": [["Eosio", 19293            ]], "code_sequence": 1, "Abi_sequence": 1},                    "Act": {"account": "Eosio.token", "Name": "Transfer", "Authorization": [                    {"actor": "Eosio", "permission": "Active"                     }], "data": {"from": "Eosio", "to": "Dabingguozi", "QuaNtity ":" 10.0000 SYS "," Memo ":" "}," Hex_data ":" 0000000000ea305500dca79            ab1e98e49a086010000000000045359530000000000 "}," elapsed ": 6," Cpu_usage ": 0, "Console": "", "Total_cpu_usage": 0, "trx_id": "B09395d938e594b838277453cea832ddc5d57ab5e92d8763ea01 1df9e35d7b34 "," inline_traces ": []}]}

8. History/get_actions (Request information from the actions)

POST:

Http://127.0.0.1:8888/v1/history/get_actions

BODY: Where account_name does not have a filter set in config, response will not get anything

{
"POS": 0,
"Offset": 1000,
"Account_name": "Dabingguozi"
}

RESPONSE:

{"Actions": [{"Global_action_seq": 19298, "Account_action_seq": 0, "Block_nu                    M ": 19240," Block_time ":" 2018-07-22t02:55:42.000 "," Action_trace ": {" receipt ": { "Receiver": "Dabingguozi", "Act_digest": "f8ce7062290be813e6484e50c7c0e3c22a9898e3240b                    Ab76f7e11b99c07abe52 "," global_sequence ": 19298," recv_sequence ": 5,                        "Auth_sequence": [["Eosio", 19293                ]], "code_sequence": 1, "abi_sequence": 1                    }, "act": {"account": "Eosio.token", "Name": "Transfer",                            "Authorization": [{"actor": "Eosio", "Permission":" Active "}]," data ": {" from ":" EO                        Sio "," to ":" Dabingguozi "," Quantity ":" 10.0000 SYS ", "Memo": ""}, "Hex_data": "0000000000ea305500dca79ab1e98e49a08601000000000004535953                0000000000 "}," elapsed ": 6," Cpu_usage ": 0," console ":" ", "Total_cpu_usage": 0, "trx_id": "B09395d938e594b838277453cea832ddc5d57ab5e92d8763ea011df9e35d7            B34 "," inline_traces ": []}, {" Global_action_seq ": 21095, "Account_action_seq": 1, "Block_num": 21034, "Block_time": "2018-07-22t03:10:39.000", "a  Ction_trace ": {" receipt ": {" receiver ":" Dabingguozi "," act_digest ": "72ae6a2af84b85d4b4e20190a56904f53afa2a79ab4c47ca2f15874c4c309205 "," global_sequence ": 21095," Recv_sequenc                            E ": 6," auth_sequence ": [[" Eosio ",                    21090]], "code_sequence": 1,                    "Abi_sequence": 1}, "act": {"account": "Eosio.token", "Name": "Transfer", "authorization": [{"Actor": "                    Eosio "," permission ":" Active "}], ' Data ': {' from ': ' Eosio ', ' to ': ' Dabingguozi ', ' qu Antity ":" 2.0000 SYS "," Memo ":" "}," Hex_data ":" 0000000000e a305500dca79ab1e98e49204e000000000000045359530000000000 "}," elapsed ": 6," Cpu_usage ": 0, "Console": "", "Total_cpu_usage": 0, "trx_id": "E1cafa2561470a0b489a4e2032375a5c88665f75 E5172bac7b574cd051079d42 "," inline_traces ": []}]," Last_irreversible_block ": 64 270}

To this, some of the current commonly used HTTP API, is listed here, then there will be an advanced version of the example of other APIs

The next is the time to summarize and discuss the structure of EOS, connect:

(In edit ... )

PS. Because I did not set wallet-api in the plugin, the wallet related HTTP API is not available

EOS Small White Learning (v) EOS HTTP API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.