`

eos_rpc_get

    博客分类:
  • EOS
 
阅读更多
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<bool, eosio::chain::name, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>): (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的接口创建账户

    - 命令示例:`curl http://192.168.1.56:8889/v1/chain/get_block -X POST -d'{"block_num_or_id":94839}'` #### 三、创建新账户 1. **创建账户所需的参数**:基于前面获取的信息,创建账户时需要提供以下参数: ...

    EOS rpc创建可投票账户

    curl http://192.168.1.56:8889/v1/chain/get_info ``` 响应结果中包含的关键信息有: - `chain_id`: 链的唯一标识符,用于识别不同的EOS区块链实例。 - `head_block_num`: 最新的区块高度。 #### 五、创建可投票...

    eosgo-client:EOS(eosio)RPC API的简单Go包装器,以及更多!

    发布v0.0.3:实施更多eosio合同(很快) v0.0.2:实现独立的测试用例v0.0.1:nodeos RPC API的全功能包装,请参阅了解详细规格当前功能链API (请参阅 ) 获取信息get_block get_account get_code get_table_rows ...

    eosrb:EOS RPC-API客户端。 轻松与EOS区块链互动

    chain_get_info连接到EOS阿根廷# Connects to https://api,eosargentina,ioc = EOS :: Client . arprods = c . chain_get_producers ( json : true ) [ 'rows' ] . map { | p | p [ 'owner' ] }puts prods . ...

    sx.js:SX Javascript

    const { get_tokens , get_settings , get_rate } = require ( "sxjs" ) ;( async ( ) =&gt; { // nodeos const rpc = new JsonRpc ( "https://eos.eosn.io" , { fetch : require ( 'node-fetch' ) } ) ; // settings ...

Global site tag (gtag.js) - Google Analytics