Originally asked here but probably more appropriate to ask on SE.

I'm working on creating a better baker binary. This baker would have more advanced features than what we get with tezos-baker such as a retry mechanism, multiple-bakers with quorum/leadership, election, etc.

Many questions have come up, but all are related to the topic:

  1. How do calculate the proof_of_work_nonce? In reading ocaml code, this appears to be a completely random set of bytes encoded as hex. Is this PoW based on anything? Is it checked/compared to the previous block's nonce?

  2. It is the responsibility of the block forger to include operations (endorsements, transactions, reveals, etc) when creating the block. At level-in-cycle 4095, the block is supposed to include all balance_updates for cycle rewards. What happens if the baker of 4095 does not include this information? Are the rewards forever frozen? Lost?

  • For 2: Balance updates are performed anyway at the end of the cycle, no matter what operations are in the last block. Said otherwise, these updates are triggered by the block level (being the last one in a cycle), not by the block contents.
    – Eugen
    Oct 28, 2019 at 16:44
  • For 1: The proof of work nonce is used as in Bitcoin: the baker needs to find a nonce that is incorporated in the block header such that the hash of the block is smaller than a given constant (proof_of_work_threshold, see gitlab.com/tezos/tezos/blob/master/src/proto_alpha/…). See its use here: gitlab.com/tezos/tezos/blob/master/src/proto_alpha/lib_protocol/…. Nonces for different blocks are independent.
    – Eugen
    Oct 28, 2019 at 19:08

1 Answer 1

  1. It's a proof of work nonce, a very minimal difficulty is applied to the hash of the block. It's intended as a mild, additional, spam protection mechanism though to be useful it should be made higher in the protocol.

  2. The block doesn't include any of that, that's computed implicitly.

  • Thanks @arthur-b If I look at this block, localhost:8732/chains/main/blocks/667648, as example, I can see all unfrozen balance updates as part of the block. If "the block doesn't include any of that" why is it present in the blocks? Same for if "computed implicitly", why is it there? Doesn't that just waste space?
    – utdrmac
    Oct 28, 2019 at 20:19
  • It's not present in the block, it's computed by the node when you call the RPC.
    – Arthur B
    Oct 28, 2019 at 20:38

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.