openethereum / parity-ethereum

The fast, light, and robust client for Ethereum-like networks.
Other
6.81k stars 1.68k forks source link

Getting Information on the Miner and the Block Reward #11855

Closed Raid5594 closed 3 years ago

Raid5594 commented 4 years ago

Could you please help out how to get the information on the miner and the block reward?

This information was removed from the block trace as I understand.

I have Goerli testnet fully synced as an archive nodes and getBlock request return miner value as 0.

Kind Regards,

Raid

Raid5594 commented 4 years ago

curl --data '{"method":"parity_getBlockHeaderByNumber","params":["0x1b4"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

{"jsonrpc":"2.0","result":{"author":"0x0000000000000000000000000000000000000000","difficulty":"0x2","extraData":"0x506172697479205465636820417574686f726974790000000000000000000000bf254a15d223a85e9c9f708b09426b9c5d37f3de96f58cedc9ebd1c3df4f259b07b1bec96e22d5cce45c8e2f38b3027cd189bd1ef2e6e94865d437720e3b47df01","gasLimit":"0x7a1200","gasUsed":"0x0","hash":"0xb0550d9b3033c5bc04407af24af13f943d5636e3674e1e93855219a6fe2ed885","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x1b4","parentHash":"0xa49ec4e60be8e6334c0123578286d228e4ca16b29db4a8b15081194f91c93413","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","sealFields":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000"],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x25b","stateRoot":"0x5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008","timestamp":"0x5c53297a","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"},"id":1}

adria0 commented 4 years ago

So the proposer (miner) address can be retrieved since the extradata field contains the signature of the miner, but you need to write code to extract this information.

This is the code to retrieve it in OE

https://github.com/openethereum/openethereum-3.1/blob/d9cd95261956a1081e96fbb8acfe676743788a5f/ethcore/src/engines/clique/util.rs#L38

Raid5594 commented 4 years ago

Found a great solution in js: https://github.com/ethereum/go-ethereum/issues/17454#issuecomment-414975770

Thanks for your prompt answer. Is there any way to retrieve block reward assigned to the miner with archive node?