返回介绍

35.4. 区块信息

发布于 2023-06-19 14:14:32 字数 4593 浏览 0 评论 0 收藏 0

35.4. 区块信息

35.4.1. 获得当前区块链信息

				
[root@netkiller ~]# cleos get info
{
  "server_version": "90fefdd1",
  "chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "head_block_num": 1063,
  "last_irreversible_block_num": 1062,
  "last_irreversible_block_id": "00000426ca6002e4097bb85032e357bceac77d90075e0020f45b26d397c2183b",
  "head_block_id": "00000427049a6f175fd5c13660651e7fe36ef8199e316bed0349a178c33f525b",
  "head_block_time": "2018-06-28T08:39:57.000",
  "head_block_producer": "eosio",
  "virtual_block_cpu_limit": 577784,
  "virtual_block_net_limit": 3033320,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}				
				
			

35.4.2. 获取指定区块数据

				
[root@netkiller ~]# cleos get block 1063
{
  "timestamp": "2018-06-28T08:39:57.000",
  "producer": "eosio",
  "confirmed": 0,
  "previous": "00000426ca6002e4097bb85032e357bceac77d90075e0020f45b26d397c2183b",
  "transaction_mroot": "0000000000000000000000000000000000000000000000000000000000000000",
  "action_mroot": "b472502694c9f3fa5684f44edc4c34742708b2400690a49bb00a297b3d201456",
  "schedule_version": 0,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_Jzx3cvL6pDxEsxhFbqPasqBymxKhodiiWjVmgtifFEDzThdYfBTvVvvmTNTxaBLwBZ1AJxyuW1uR3J5nvKDwc3xnAgRuWk",
  "transactions": [],
  "block_extensions": [],
  "id": "00000427049a6f175fd5c13660651e7fe36ef8199e316bed0349a178c33f525b",
  "block_num": 1063,
  "ref_block_prefix": 918672735
}				
				
			

35.4.3. 从区块链获取交易信息

				
[root@netkiller ~]# cleos get transaction cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f
{
  "id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",
  "trx": null,
  "block_time": "2000-01-01T00:00:00.000",
  "block_num": 0,
  "last_irreversible_block": 1777,
  "traces": []
}				
				
			

35.4.4. 获得账号信息

				
[root@netkiller ~]# cleos get account neo
permissions: 
     owner     1:    1 EOS7fcRYssRt5SXVnsPpRNzj86E9h5g62hBgKwr1NSzRmSpH9byZr
        active     1:    1 EOS7fcRYssRt5SXVnsPpRNzj86E9h5g62hBgKwr1NSzRmSpH9byZr
memory: 
     quota:       unlimited  used:      2.66 KiB  

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

cpu bandwidth:
     used:               unlimited
     available:          unlimited
     limit:              unlimited				
				
			
				
[root@netkiller ~]# cleos get accounts EOS7fcRYssRt5SXVnsPpRNzj86E9h5g62hBgKwr1NSzRmSpH9byZr
{
  "account_names": [
    "neo"
  ]
}	

[root@netkiller ~]# cleos get accounts EOS5xfs4X3wNB5cdhzUAebBmaVN3eTsQspGpKrr7FgvEMcZV5kvn3
{
  "account_names": [
    "contract.cms"
  ]
}			
				
			

35.4.5. 从区块链上获取 abi 文件

			
[root@netkiller eos]# cleos get code contract.art  -a art.abi
code hash: 37636dd268e72e75d0559f3c8acdce07feae20dd682bc4b859e7f62517f4bc5f
saving abi to art.abi			
			
			
			
[root@netkiller eos]# cat art.abi 
{
  "version": "eosio::abi/1.0",
  "types": [],
  "structs": [{
      "name": "create",
      "base": "",
      "fields": [{
          "name": "user",
          "type": "name"
        },{
          "name": "title",
          "type": "string"
        },{
          "name": "content",
          "type": "string"
        }
      ]
    },{
      "name": "change",
      "base": "",
      "fields": [{
          "name": "user",
          "type": "name"
        },{
          "name": "post_id",
          "type": "uint64"
        },{
          "name": "title",
          "type": "string"
        },{
          "name": "content",
          "type": "string"
        }
      ]
    },{
      "name": "remove",
      "base": "",
      "fields": [{
          "name": "user",
          "type": "name"
        },{
          "name": "post_id",
          "type": "uint64"
        }
      ]
    },{
      "name": "find",
      "base": "",
      "fields": [{
          "name": "post_id",
          "type": "uint64"
        },{
          "name": "user",
          "type": "name"
        }
      ]
    }
  ],
  "actions": [{
      "name": "create",
      "type": "create",
      "ricardian_contract": ""
    },{
      "name": "change",
      "type": "change",
      "ricardian_contract": ""
    },{
      "name": "remove",
      "type": "remove",
      "ricardian_contract": ""
    },{
      "name": "find",
      "type": "find",
      "ricardian_contract": ""
    }
  ],
  "tables": [],
  "ricardian_clauses": [],
  "error_messages": [],
  "abi_extensions": []
}			
			
			

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文