Skip to content

Instantly share code, notes, and snippets.

Making oracles for Uqbar on Urbit

This plan is adapted from Chainlink OCR described here: https://research.chain.link/ocr.pdf

Oracle contract is simple: it takes in a result value, and a bundle of attestations. The contract checks these signatures and updates the stored information only if the signatures are all valid, recent enough (some number of ETH blocks) and the total reaches the consensus threshold for this data feed. Defined inside the contract is some formula for taking many data observations and averaging them into a final value. This formula can be a simple median, or have mechanisms for removing outliers, etc. The contract provides a scry path for the stored information. This scry path contains options regarding how recent the last update to the stored information must have been, with recency measured in ETH block height.

With this contract deployed on Uqbar, an off-chain coordination protocol is required to generate these "attestation bundles". The attestations should be limited to planets and

Mill Explained

Mill, or mill.hoon, is the execution engine for Uqbar. At a high level, it takes the current state of a town (a "shard" of our rollup) along with a set of transactions (referred to in code as eggs) and creates a state transition which can be applied to that town. Here, I will document the specifics of this process and explore implementation choices available to us.

It's important to note that our current implementation of the execution engine can be modified in some ways by Sequencers. The result of an individual transaction must be ZK-verified, that is, the sequencer must generate hints to prove the computation was performed correctly, but the overall state transition can be composed of these results in many ways. A Sequencer therefore has the ability to exclude or order transactions in ways they see fit (with the potential, here, for MEV extraction). The implementation choices made outside of the "must-prove" portion of mill.hoon are made for performance, not validity, and can