1

This answer states the following about block.coinbase:

block.coinbase points to the miner node which included the transaction in its block. 

So why does the below function returns a value if it doesn't write the blockchain and the tx doesn't get mined?

  function getCoinbase() external view returns (address) {
    return block.coinbase;
  }

After calling it I get the address of a validator node, but it is not a state writing function. Why do I get any results then?

1 Answer 1

3

For the same reason every member of block. returns a value when called in a view function, it uses the latest available data (so here, the coinbase of the last mined block (or an older one if you're on a fast chain and the node that treated this request is lagging behind)

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.