Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the hash obtained by "blockHash := block.Hash()" is not equal to the "hash" in the data returned by eth_getBlockByNumber #23523

Closed
cppfuns opened this issue Sep 3, 2021 · 9 comments

Comments

@cppfuns
Copy link

cppfuns commented Sep 3, 2021

I am doing to get the block data eth_getBlockByNumber according to the block number, and then get the blockHash through the obtained block "blockHash := block.Hash()" and finally get the corresponding data through "eth_getLogs"

But it is found that the hash obtained by "blockHash := block.Hash()" is not equal to the "hash" in the data returned by eth_getBlockByNumber

{
   "id" : 7,
   "jsonrpc" : "2.0",
   "method" : "eth_getBlockByNumber",
   "params" : [ "0x4fd1fd", false ]
}

{
   "id" : 7,
   "jsonrpc" : "2.0",
   "result" : {
      "baseFeePerGas" : "0x7",
      "difficulty" : "0x2",
      "extraData" : "0x696e667572612e696f0000000000000000000000000000000000000000000000d78e42dfeec55b82d6233e22d70a8ae7784e92282cbc913ab4f7b800659b680173c445a0647b0e63b41352c404243542473daddaf51f03aa3fcc47a02d2664b000",
      "gasLimit" : "0x1c9c380",
      "gasUsed" : "0x4ae9a2",
      "hash" : "0x972dc654c8f82b96411a022d090d29c409b541afb48b1d91e913c8cb87dec6ee",
      "logsBloom" : "0x20000000800001000a2000001000000000000000000000005180000000000002000004000000080090000000004020c100004000000000000222000080000000000000080001000601000148000200028485000c80001021022000000c0000088080000992080000008100004000080010000240000008000000001000000240020000100002002000080000200000000408201080080020100100000000000000000000050000100000000408000000000000002000000000002000084000420000000201800104000002000000000a410008000000000000020000000020000200000000430000000000000002000000000000000080001000000000002004",
      "miner" : "0x8b24eb4e6aae906058242d83e51fb077370c4720",
      "mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
      "nonce" : "0x0000000000000000",
      "number" : "0x4fd1fd",
      "parentHash" : "0x2065906cd908617ee5f5ea98024604ec46166d1ef6b8d1542589baf44babc8f7",
      "receiptsRoot" : "0xb8e219e28204d882b00ab760693580b28b43efb4f093ba0e777eb49559e6ff2d",
      "sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
      "size" : "0x1b5c0",
      "stateRoot" : "0x9bc625856d8f4fd5c435ff2e9a396488d0d9c1abd4d3f67f41b5216035b14f8b",
      "timestamp" : "0x6103c725",
      "totalDifficulty" : "0x74a93f",
      "transactions" : [
         "0xc27b8cd621bae1bf82f96076d2c2bc6e4f5560dc939c20da1e362b0e559cbfd9",
         "0x7ba8bbec0178db0248d6f606dda4a7dc0031677750aba7b652590a4469caad17",
         "0x5cd19edb8800fbf2930fc5bcb8ea73f4f333674ec8dd7d0e2be2a8014edbd17d",
         "0x306e6876b3232ace2f12b5fc327b6060eebdae0f7bfab1447b4fab202c7250ef",
         "0xdd2bd9ef287b190d87e447bc4a546cd2114e0fce47ab9f3bd06c277d75a86ff8",
         "0x564f049d6bd0f988abb243ba927e3aa52ce1a580dc2615d577c7b57baf209958",
         "0x28a7b3491a04d6f49e38cee12a7175661dcb8f52efd15e6fd307638dfe14ffb3",
         "0x840f3831d9257ae421703647a796033964954e5f7fef655e670a7d975e3768a4",
         "0x444cba9c15dbd33a9a9cbc2e04b9c356d4f2cbf9326e2c36fe31afd70cf5d5bf",
         "0xf6984a661b7ad61c73ffa9509eabf25a595701dcd728ddd96f508f53ff64efd0",
         "0xdb06ea03d9fb1de937788dbba7fbfe46559ed2eadd3eba4097265460b5fa9540",
         "0xa35620585ef58fd471c972b6cd071674a52c7342ea23cc65ed4b325573f635f6"
      ],
      "transactionsRoot" : "0xaf8d143a92c23958c430f707da69ef3113bb46ee3ec614b46b5ecb2f2169a4d4",
      "uncles" : []
   }
}
{
   "id" : 8,
   "jsonrpc" : "2.0",
   "method" : "eth_getLogs",
   "params" : [
      {
         "address" : [ "0x2dd3dc6ec3ddc15d05c3719eb329a7e64e00aad5" ],
         "blockHash" : "0xf4746be5600cea6d65226d448b80b73d4310e93f7cf3dd4bee1776787a023bb5",
         "topics" : [
            [ "0x7090729cb71d105f50d09825b7425766b047a5d225e26e73ceb1d6fd4d9c1e58" ]
         ]
      }
   ]
}

{
   "error" : {
      "code" : -32000,
      "message" : "unknown block"
   },
   "id" : 8,
   "jsonrpc" : "2.0"
}

Version used

github.com/ethereum/go-ethereum v1.10.8

Problem recurring network
goerli ropsten kovan

@Kantitad
Copy link

Kantitad commented Sep 3, 2021 via email

@cppfuns
Copy link
Author

cppfuns commented Sep 3, 2021

#23466

@cppfuns cppfuns closed this as completed Sep 3, 2021
@cppfuns
Copy link
Author

cppfuns commented Sep 3, 2021

- [ ] -

WTF

@cppfuns
Copy link
Author

cppfuns commented Sep 3, 2021

ับ Outlook สำหรับ Android< https://aka.ms/AAb9ysg >

________________________________ จาก: pablo6116 @.***> ส่งแล้ว: วันศุกร์ที่ 3กันยายยย 2021 12:01 ก่อนเที่ยง ถึง:ethereum/go-ethereum สำเนาถึง:已订阅 ชื่งงง็่่ "在eth_getBlockByNumber ( # 23523 )返回的数据中— 您收到此消息是因为您订阅了此线程。直接回复本邮件,在GitHub上查看< #23523(评论) >,或取消订阅< https://github.com/notifications/unsubscribe-auth/AQDJWK5TM7ET2K2UOEBSKFDUABCBPANCNFSM5DK3QB6Q >。

WTF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@cppfuns @Kantitad and others