pub fn header_chain(
builder: &CircuitBuilder,
headers: &[[Wire; 10]],
) -> [Wire; 4]Expand description
Returns hash(headers[0]), the digest of the latest block in the chain.
Asserts the following things:
previous_block_hash(headers[i]) = hash(headers[i+1])(hash chain)hash(headers[i]) < target(headers[i])(proof of work)
The digest of the head is returned rather than asserted, so the caller decides what to compare it against.
IMPORTANT: This does currently NOT assert that target(headers[i]) is in any way
related to target(headers[i+1]), like it must be in the Bitcoin protocol. In particular,
this means that one can easily satisfy this circuit with a self-mined sequence of blocks
which have low difficulty.
Note: It also doesn’t check many other things about the block header, like that the constraints on the timestamps.
§Panics
If headers is empty.