0
  • 单个区块中包含的交易可以使用的最大气体单位数量是否会随着时间的推移而变化,并且在不同的 EVM 兼容链上会有所不同?
  • block gas limitThunderCore 链具体是什么?
  • 我可以通过block gas limit编程方式获取吗?
4

1 回答 1

0

简短回答:block gas limitthunder-mainet100M gas units

更长的答案

  • 对于同一条链,区块气体限制确实会随着时间而改变
  • thunder-mainnet( https://mainnet-rpc.thundercore.com )的区块 gas 上限为 100M gas units
  • 要获取最新block gas limit的 EVM 兼容链,请通过以下方式获取最新的块头eth_getBlockByNumber并读取gasLimit字段:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' -H 'Content-Type: application/json' https://mainnet-rpc.thundercore.com | jq '.result.gasLimit' | python -c 'import sys; print(int(sys.stdin.read().strip()[1:-1], base=16))'

输出

100000000

块头

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "difficulty": "0x9103000002000000cd0f00009103000002000000cc0f0000",
    "extraData": "0x",
    "gasLimit": "0x5f5e100",
    "gasUsed": "0x8da5d",
    "hash": "0xd3b407d7caee8cb351cc2ddd4315ab08de116da13defa98d0988fbc876b0c508",
    "logsBloom": "0x000000000000000000000000000000020000000001000000000000000000000000400000000000400000000000880000400000000000000000000000000020000400000000001000000000080000000000000000000000000000000000000020000000800a0000000000000100000800000000000000000000000018000001000000000001000004000240000000000000000000000000000000000400000000040000000020200000000000000000000000000000100000000800022002000000002002000000000000000200002000000000000004000000000000000020000000000000000100000000000000000000000000004000000000000000000220",
    "miner": "0xc4f3c85bb93f33a485344959cf03002b63d7c4e3",
    "mixHash": "0x1ff8b209ed7b610a4e7c0457e169894894bfeb4ab0e2e2345a67a8a80f341ae0",
    "nonce": "0x0000000000000fcd",
    "number": "0x28de50c",
    "parentHash": "0xd67bac08ffd4ede2335e9481e3037e061ee94ceb4585050284fde03d9969e3e3",
    "receiptsRoot": "0xa5013034e668c9c35fc9b5c3c3c8cb039320c19a2067bdcbd898f0de53a35459",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x57b",
    "stateRoot": "0x33d8e304800f11556826625f8d9f5d0017855909d9c86db04e99e93fe9376231",
    "timestamp": "0x5f06f91f",
    "totalDifficulty": "0x45cae70bf7fe32e14a93365747cae67af4fe32e04a9335cb758141",
    "transactions": [
      "0xcc8105b70d4e8167046f5bbaef63fcf549cf52b8988c500e176b8281e7eed5d5",
      "0x3df59e94eb7b41cc6f037a6a7fcf7a3518ea13073bedc3c0c15bd24e83e83d66",
      "0x9792735f46ccc0fbff09e6e205f9f90474bf27cbbbd845a95e7303da880cc057",
      "0xc27ec22620bd0ecfb4664706013a1e386828ab77fe71c7218bb1b24a6fc8c085",
      "0x7d512708738df8b80fea2741e844251b21d2542cb14b39a2cb4c2c570433286e"
    ],
    "transactionsRoot": "0x4a56dfcf3e04202b262775c88d5946120918c999465d68b1cf96e9262248a39d",
    "uncles": []
  }
}
于 2020-07-09T11:05:52.440 回答