1

I sent a transaction in clique POA private chain and get the block via transaction hash. Why is the miner address for this transaction all zero?

step 1: send a transaction

> eth.sendTransaction({from:'0x558dfdb706847de650dfbdc19c5295c6fe29dab5',to:'0x6bcb6fdd4fe6d8d2eafa30ffbf7d1e663231403f',value:web3.toWei(1,"ether")})
"0x6f75c39f98f18ce6faf02e46d4bd53c2ce5f40549ec62410c560ad59bd172e39"

step 2 get block via transaction hash

> eth.getTransaction("0x6f75c39f98f18ce6faf02e46d4bd53c2ce5f40549ec62410c560ad59bd172e39")
{
  blockHash: "0xbf2d253c1171cd9da45472fa2e92a8d4a71a6a836b80b922a808ca88e8ec9a7b",
  blockNumber: 56624,
  from: "0x558dfdb706847de650dfbdc19c5295c6fe29dab5",
  gas: 21000,
  gasPrice: 1000000000,
  hash: "0x6f75c39f98f18ce6faf02e46d4bd53c2ce5f40549ec62410c560ad59bd172e39",
  input: "0x",
  nonce: 76,
  r: "0x14fbadd027575b9bb15859844332410517a0379a275b4795c740df8667abaefa",
  s: "0x361990e6c38be3de787cedfb989244a7474d89e8d38dc8a68cc00d7695215b20",
  to: "0x6bcb6fdd4fe6d8d2eafa30ffbf7d1e663231403f",
  transactionIndex: 0,
  v: "0x3dd4",
  value: 1000000000000000000
}

step 3: get block details via block number

> eth.getBlock(56624)
{
  difficulty: 2,
  extraData: "0xd883010900846765746888676f312e31322e34856c696e75780000000000000089d9d6ebb23327af16c483814c1372ee4a1ee7295bae5994ae09447bf000a6ca0bad468ab3c3e1fd8308a63fb7b29bd95fcd5b7a66971516543115826272c4cd00",
  gasLimit: 8000000,
  gasUsed: 21000,
  hash: "0xbf2d253c1171cd9da45472fa2e92a8d4a71a6a836b80b922a808ca88e8ec9a7b",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x0000000000000000000000000000000000000000",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: 56624,
  parentHash: "0xa70805ba45bea2368317991f8b02b27c966808960045f161179f0c647a022440",
  receiptsRoot: "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 722,
  stateRoot: "0x4ff9ded28f68dc9f77770da8a6c73a9999fa2eadf79b2a111f4e589e95dd5299",
  timestamp: 1558403220,
  totalDifficulty: 113249,
  transactions: ["0x6f75c39f98f18ce6faf02e46d4bd53c2ce5f40549ec62410c560ad59bd172e39"],
  transactionsRoot: "0x2b429c381013191e134b9db2f0863075aea8ba066a19d205d91697016fbc7147",
  uncles: []
}
1

I tried your suggestion to use "ecrecover" function run on a private POA ethereum chain, the result shows a wrong miner address, not the actual miner address. Thanks for you help.

calculated miner address : "0x9a1da187d501ea796599dd0e2c9de52b1b1a3794"
actual miner address: "0x3c46b43e683b5addd7e66b3d1d958854ffb58361"

geth version

Version: 1.8.27-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.12.4
Operating System: linux
GOPATH=/root/goworks
GOROOT=/usr/local/go

node version 10.15.3

miner address resolving code

const Web3 = require('web3');
const utils = require('ethereumjs-util');
const BlockHeader = require('ethereumjs-block/header');
const web3 = new Web3('http://localhost:8545');
const main = async () => {
const block = await web3.eth.getBlock(7);
const dataBuff = utils.toBuffer(block.extraData);
const sig = utils.fromRpcSig(dataBuff.slice(dataBuff.length - 65, dataBuff.length));
block.extraData = '0x' + utils.toBuffer(block.extraData).slice(0, dataBuff.length - 65).toString('hex');
console.log("got extraData = ",block.extraData);
const headerHash = new BlockHeader({
    parentHash: utils.toBuffer(block.parentHash),
    uncleHash: utils.toBuffer(block.sha3Uncles),
    coinbase: utils.toBuffer(block.miner),
    stateRoot: utils.toBuffer(block.stateRoot),
    transactionsTrie: utils.toBuffer(block.transactionsRoot),
    receiptTrie: utils.toBuffer(block.receiptsRoot),
    bloom: utils.toBuffer(block.logsBloom),
    difficulty: utils.toBuffer(block.difficulty),
    number: utils.toBuffer(block.number),
    gasLimit: utils.toBuffer(block.gasLimit),
    gasUsed: utils.toBuffer(block.gasUsed),
    timestamp: utils.toBuffer(block.timestamp),
    extraData: utils.toBuffer(block.extraData),
    mixHash: utils.toBuffer(block.mixHash),
    nonce: utils.toBuffer(block.nonce)
});
const pub = utils.ecrecover(headerHash.hash(), sig.v, sig.r, sig.s);
const address = utils.addHexPrefix(utils.pubToAddress(pub).toString('hex'));
console.log("miner address result:",address) ;
};
main();

block information

> eth.getBlock(7)
{
  difficulty: 2,
  extraData: "0xd88301081b846765746888676f312e31312e39856c696e757800000000000000dd7dbfb525694a880603c92ed9326e2fdd37907ae2d2528b8bb9dc1ae11c605d03868c1644186b84ba300ec8f53681eb479ee2438ebad4f0f77e44a4725c55f401",
  gasLimit: 4732212,
  gasUsed: 0,
  hash: "0x6c9587d64ca2446bd7a6fd9d595e0bdf8af5b9627e7f32455c0f4fb4925ef7ce",
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  miner: "0x0000000000000000000000000000000000000000",
  mixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  nonce: "0x0000000000000000",
  number: 7,
  parentHash: "0x9e72501d25bb1809b44568c4ec69ebdee92a22d9b05aaf104b5726992b19aba1",
  receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 606,
  stateRoot: "0xf899500a3ff238853d1c23b73f799135770c1ba16e970f4feff385b7ab777c92",
  timestamp: 1559202842,
  totalDifficulty: 15,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}
  • You can edit your own question to add more details. The signature is calculated on the block's hash without the extraData field. – Ismael Jul 9 at 17:00
  • What more information is needed? Thanks. – Ntydrm Jul 11 at 1:50
0

As part of the changes required by rinkeby some fields from the block headers were repurposed, for more details consult Clique PoA protocol & Rinkeby PoA testnet.

  • miner and nonce are repurposed to vote for new validator.

    Should be filled with zeroes normally, modified only while voting.

    When voting miner is the address to vote for and nonce is the vote

    • 0xffffffffffffffff to approve validator
    • 0x0000000000000000 to vote for removal
  • I check the block info again, the miner and nonce value are still all zeros. the private chain has three nodes, two are sealer, one is normal node(is validator?). when the miner address will be updated to sealer address, not all zeros? – Ntydrm May 21 at 3:57
  • the new validator you mentioned here is for adding a new sealer? if the miner field is for this purpose, how can I know the miner address for a specific block? – Ntydrm May 21 at 4:02
  • Validator/Sealer are nodes than can create new blocks. The miner field will be zero unless validators are voting to add or remove another validator with the clique.propose() command. To determine the miner/validator the extraData field contains a signature which together with the block header data you can use ECRecover to find the validator/sealer. – Ismael May 21 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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