eos_rpc_get

阅读更多
1.get info:通过指定全节点API接口获取其连接的EOS区块链的基本信息
xjdeMacBook-Pro:cleos xj$ cleos get info
{
  "server_version": "14185431",
  "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "head_block_num": 123962,
  "last_irreversible_block_num": 123961,
  "last_irreversible_block_id": "0001e43917c4c5775a2cf5c99e725f6cd6bd6ae74aae76f3d17a2872ce548338",
  "head_block_id": "0001e43a3fc95af108b370c126eff07380468721160ef9e217f98e56359a4701",
  "head_block_time": "2019-09-02T03:25:22.000",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 200000000,
  "virtual_block_net_limit": 1048576000,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576,
  "server_version_string": "v1.8.1-dirty",
  "fork_db_head_block_num": 123962,
  "fork_db_head_block_id": "0001e43a3fc95af108b370c126eff07380468721160ef9e217f98e56359a4701"
}

2.get block 7830762:从区块链中检索完整的区块信息,可根据指定区块号(block_num)或区块ID进行查询
必填参数:#block TEXT,用于表示要检索的块号或ID
非必填参数,#-header-state:表示从可逆区块数据库中获取块头信息
xjdeMacBook-Pro:cleos xj$ cleos get block 123962
{
  "timestamp": "2019-09-02T03:25:22.000",
  "producer": "eosio",
  "confirmed": 0,
  "previous": "0001e43917c4c5775a2cf5c99e725f6cd6bd6ae74aae76f3d17a2872ce548338",
  "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
  "action_mroot": "1803b07bb2006a853ed8a3647ba4e26e380bafca8781a06f5344bdf28fe997e4",
  "schedule_version": 0,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_KWRtprSNeYMFrWYj2PE9TiNeerBwnHr6FNx9X4zx8EVP8KjSGdpNi49NsyBHAb27zHFDgcQXvww6eXf3yEHfbREkui3vUA",
  "transactions": [],
  "block_extensions": [],
  "id": "0001e43a3fc95af108b370c126eff07380468721160ef9e217f98e56359a4701",
  "block_num": 123962,
  "ref_block_prefix": 3245388552
}

3.get account:从区块链中检索指定账户详情
必填参数:#name TEXT:表示要检索的账户名
非必填参数:#-j,-json:表示以JSON格式输出

xjdeMacBook-Pro:cleos xj$ cleos get account eosio
created: 2018-06-01T12:00:00.000
privileged: true
permissions:
     owner     1:    1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
        active     1:    1 EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
memory:
     quota:       unlimited  used:      2.66 KiB

net bandwidth:
     used:               unlimited
     available:          unlimited
     limit:              unlimited

cpu bandwidth:
     used:               unlimited
     available:          unlimited
     limit:              unlimited


xjdeMacBook-Pro:cleos xj$ cleos get account xj
error 2019-09-02T03:26:27.285 thread-0  main.cpp:3940                 main                 ] Failed with error: unspecified (0)
unknown key (boost::tuples::tuple): (0 xj)

4.get code:获取指定账户发布的智能合约代码信息,没有部署合约则为0
必填参数:#name TEXT:表示要检索的账户名
非必填参数:
a.#-c,--code TEXT:表示将智能合约保存为.wast/wasm格式并为文件命名
b.#-a,-abi TEXT:表示将智能合约保存为.abi格式并为文件命名
c.#--wasm:表示将智能合约保存为wasm
xjdeMacBook-Pro:safecode.contracts xj$ cleos get code eosio
code hash: c57c92b8ce61518843af755117ad92f947ee1751bca126561b3e7ecc108cef96
xjdeMacBook-Pro:safecode.contracts xj$ cleos get code a1
code hash: 0000000000000000000000000000000000000000000000000000000000000000

5.get abi eosio.token:返回账户的智能合约abi文件
必填参数:#name TEXT:表示要检索的账户名
非必填参数:#f,--file TEXT:表示将返回结果保存在指定文件中
xjdeMacBook-Pro:safecode.contracts xj$ cleos get abi eosio > a.txt
xjdeMacBook-Pro:safecode.contracts xj$ head -n 100 a.txt
{
  "version": "eosio::abi/1.1",
  "types": [],
  "structs": [{
      "name": "abi_hash",
      "base": "",
      "fields": [{
          "name": "owner",
          "type": "name"
        },{
          "name": "hash",
          "type": "checksum256"
        }
      ]

6.get table contract scope table:返回指定表中数据
必填参数:
a.#contract TEXT:表示待检索的表所在智能合约账户
b.#scope TEXT:表示待检索数据所在作用域
c.#table TEXT:表示待检索表名称
非必填参数:
a.#-b,--binary UINT:表示返回二进制数据
b.#-l,--limit UINT:表示返回数据中的最大行数
c.#-k,--key TEXT:表示待请求数据在表中的键值
d.#-L,--lower TEXT:表示键的下限值的JSON表示,默认为first
e.#-U,--upper TEXT:表示键的上限值的JSON表示,默认为last
e.#--index TEXT:表示指定第几个索引,1为第一个
f.#--key-type TEXT:表示--index的键值类型
xjdeMacBook-Pro:safecode.contracts xj$ cleos get table eosio eosio global
{
  "rows": [{
      "max_block_net_usage": 1048576,
      "target_block_net_usage_pct": 1000,
      "max_transaction_net_usage": 524288,
      "base_per_transaction_net_usage": 12,
      "net_usage_leeway": 500,
      "context_free_discount_net_usage_num": 20,
      "context_free_discount_net_usage_den": 100,
      "max_block_cpu_usage": 200000,
      "target_block_cpu_usage_pct": 1000,
      "max_transaction_cpu_usage": 150000,
      "min_transaction_cpu_usage": 100,
      "max_transaction_lifetime": 3600,
      "deferred_trx_expiration_window": 600,
      "max_transaction_delay": 3888000,
      "max_inline_action_size": 4096,
      "max_inline_action_depth": 4,
      "max_authority_depth": 6,
      "max_ram_size": "68719476736",
      "total_ram_bytes_reserved": 0,
      "total_ram_stake": 0,
      "last_producer_schedule_update": "2000-01-01T00:00:00.000",
      "last_pervote_bucket_fill": "1970-01-01T00:00:00.000",
      "pervote_bucket": 0,
      "perblock_bucket": 0,
      "total_unpaid_blocks": 0,
      "total_activated_stake": 0,
      "thresh_activated_stake_time": "1970-01-01T00:00:00.000",
      "last_producer_schedule_size": 0,
      "total_producer_vote_weight": "0.00000000000000000",
      "last_name_close": "2000-01-01T00:00:00.000"
    }
  ],
  "more": false
}

7.get currency balance contract account[symbol]:返回指定账户的某个Token的余额
必填参数:
a.#contract TEXT:表示Token发行合约账户名
b.#account TEXT:表示待检索账户名
非必填参数:
a.#symbol TEXT:表示待检索Token的名称,主网默认为EOS
例:获取账户tom的EOS余额
get currency balance eosio.Token tom
xjdeMacBook-Pro:safecode.contracts xj$ cleos get currency balance eosio.token a1 SYS
0.0300 SYS

8.get currency stats contract symbol:返回指定Token的发行状态(初始总额,发行人等)
必填参数:
a.#contract TEXT:表示Token发行合约账户名
b.#symbol TEXT:表示待检索Token的名称
xjdeMacBook-Pro:safecode.contracts xj$ cleos get currency  stats eosio.token SYS
{
  "SYS": {
    "supply": "1000000000.0000 SYS",
    "max_supply": "1000000000.0000 SYS",
    "issuer": "eosio"
  }
}

9.get accounts public key:返回指定公钥所控制的所有账户
必填参数:
a.#public_key TEXT:表示待检索有EOS公钥
例:get accounts EOS666666666666666666T3MD
xjdeMacBook-Pro:safecode.contracts xj$ cleos wallet keys
[
  "EOS4uyHP7iMBpT9xxfa4jrXqFhqQgEE9BLeH9tVRrQna7L6uUZ1WA",
  "EOS51q4xhKdKQwbbV2yLV7zxKV1bYnBZybLuu3pDUqnd1mCYdwMcs",
  "EOS6Kkm7WbARXUWXZAAprQnpAjnxPeMWzczn2LmhhdH3ZgtQkUT1P",
  "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
  "EOS76oQi7ERYrUA4zh2BHNHBgsynSVycoSd5fmAg8YvsvQ6bPEFoC",
  "EOS7LN26X2GEW4pnxRS336nGWUd7Dz7BRgC9wcksnfxCmbDLymYeM"
]
xjdeMacBook-Pro:safecode.contracts xj$ cleos get accounts EOS76oQi7ERYrUA4zh2BHNHBgsynSVycoSd5fmAg8YvsvQ6bPEFoC
{
  "account_names": [
    "a1",
    "eosio.bpay",
    "eosio.msig",
    "eosio.names",
    "eosio.ram",
    "eosio.ramfee",
    "eosio.rex",
    "eosio.saving",
    "eosio.stake",
    "eosio.token",
    "eosio.vpay"
  ]
}

10.get servants account:返回指定账户所控制的所有账户
必填参数:
a.#account TEXT:表示待检索账户名

11.get transaction [OPTIONS] id:在区块链上检索某个交易的详细信息
必填参数:
a.#id TEXT:表示待检索的交易ID
非必填参数:
a.#-b,--block-hint UINT:表示该交易可能存在的区块号

12.get actions [OPTIONS] account_name [PoS] [offset]:在区块链上检索某个账号的所有actions
必填参数:
a.#account_name TEXT:表示待检索账户名
非必填参数:
a.#PoS INT:表示action的序号,默认-1,即最后一个
b.#offset INT:表示action的数量,为正则向后数offset个action,负则向前数
c.#-j,--json:表示以JSON格式打印
d.#--full:表示打印不缩短action的JSON格式
e.#--pretty:表示打印优化后的JSON格式
f.#--console:表示打印action在控制台的输出结果
例:get actions tom 101 0 --full/pretty/console
xjdeMacBook-Pro:safecode.contracts xj$ cleos get actions eosio  --full
#  seq  when                              contract::action => receiver      trx id...   args
================================================================================================================
?69381   2019-09-15T00:57:24.000            eosio::onblock => eosio         21aeab38...    ]
{"header":{"timestamp":207274747,"producer":"eosio","confirmed":0,"previous":"00010e5e5e56d4e2d99034ffe1103d166ede9e873731d1daa62ee40d45d3e2f1","transaction_mroot":"0000000000000000000000000000000000000000000000000000000000000000","action_mroot":"963cea478e134d02c683711adcbb7102f564836056ea308148521745cf27349b","schedule_version":0,"new_producers":null}}
?69382   2019-09-15T00:57:27.000            eosio::onblock => eosio         6f35311c...    ]
{"header":{"timestamp":207274748,"producer":"eosio","confirmed":0,"previous":"00010e5fcef979dfd0315ebcb02315dbd3590c20f59fdd8298e621eb653868fa","transaction_mroot":"0000000000000000000000000000000000000000000000000000000000000000","action_mroot":"a478289e18c28b90b6c34d11ca1e1dc8a00ea9c05281ed93d40a937dd184e11a","schedule_version":0,"new_producers":null}}

13.get schedule [OPTIONS]:检索区块链当前的节点出块顺序安排
非必填参数:
a.[OPTIONS]:#-j,--json:表示以JSON格式打印检索结果
xjdeMacBook-Pro:safecode.contracts xj$ cleos get schedule -j
{
  "active": {
    "version": 0,
    "producers": [{
        "producer_name": "eosio",
        "block_signing_key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
      }
    ]
  },
  "pending": null,
  "proposed": null
}

你可能感兴趣的:(eos_rpc_get)