1

I'm following this very cool article on how to calculate rewards for a ETH miner and I'm stuck on the uncle rewards.

In the example they calculate the rewards on the ETH block with id 15349734, click here to open the link to this block in Etherscan.
In Etherscan you can see that there is only one uncle for this block with hash:
0x9c70da5c4b5be500e7732b122179a6baa85b8f092bea32cfe717d912de6bbf5a.

I also get the same uncle hash when running this code to download the block from the cloudflare endpoint (15349734 in 0x hex is: 0xEA37E6):

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0xEA37E6", true],"id":1}' https://cloudflare-eth.com/

Then, using the uncle hash, I try to download its block using the following command:

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "eth_getUncleByBlockHashAndIndex", "params": ["0x9c70da5c4b5be500e7732b122179a6baa85b8f092bea32cfe717d912de6bbf5a", "0x0"], "id": 1}' https://cloudflare-eth.com

The problem is that the result is null, but it shouldn't because I can see the uncle values in Etherscan:

{"jsonrpc":"2.0","result":null,"id":1}

Am I missing something? I'm very confused

1 Answer 1

1

The hash parameter for eth_getUncleByBlockHashAndIndex should be of the nephew block.

Then

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc": "2.0", "method": "eth_getUncleByBlockHashAndIndex", "params": ["0x537ceb6998b9ec3afd9e56956efbb449f5f1bafd1e7e187feb54ebf5f1346330", "0x0"], "id": 1}' https://cloudflare-eth.com

Returns

{
    "jsonrpc": "2.0",
    "result": {
        "baseFeePerGas": "0x3ddf41981",
        "difficulty": "0x2bd536ca1cdc8a",
        "extraData": "0x53424943727970746f2e636f6d20506f6f6c28657529",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0xd9c8b1",
        "hash": "0x9c70da5c4b5be500e7732b122179a6baa85b8f092bea32cfe717d912de6bbf5a",
        "logsBloom": "0x53b2e5435389d9225402eaa8e51651690060ccc5277c1ea021fb89c09ddf432351300ec29fe8801a4c402e4a8a43f9f34abe054489113d59285372182ef7ec0a8a0a730c070d442e79123408801b78b419edcc38c7c6301328b228d5a2f425371eab82143782c146a6821cc0d4b188ec209464740049a5f01028c0730559957cde2683360a22195c0dcdd0ae1da6620f4da810916108567aca3018ca6873fcbaca80c311247be56dcd8840e0c5c0aeb10ab40b0662daaa03a0b10a1e86accec9399c513b312688c292640766ca427ddf0cfd82e0914babda6a7ca9baabcde2c8c07676387ac403aaa9fc373d85841a92500810486ad9514e4543de1108c466b6",
        "miner": "0x8b4de256180cfec54c436a470af50f9ee2813dbb",
        "mixHash": "0x9332449e0354ec80340915082b07180d89b0155d81944e8b7c8bd35cf62cbcf1",
        "nonce": "0x22324bcf1b0a13d8",
        "number": "0xea37e5",
        "parentHash": "0xde9ef69ce59a2dc9e6ac3ff86a69d3e5215c925640086193b877c2e607bce6d9",
        "receiptsRoot": "0x2e1e17cc5276be9a5ec998ad304d533affa2b0ee4648993735f355fc638e10a7",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x226",
        "stateRoot": "0x5ca63f7a9dfef563db5867a54c3da50be42a162a8b8b8b3fead63739a345a89d",
        "timestamp": "0x62fb0056",
        "transactionsRoot": "0xba99242cf0990646845ff0e21be49df27c0e8a7e32b0a7b250e8ef63cbc03ccb",
        "uncles": []
    },
    "id": 1
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.