Skip to main content
One key can sign a wrong or stolen price. Then each contract that reads that slot key gets this fixing. More signers remove this single point of failure. The sources implement a quorum of signers in the oracle output and a median in consumer contracts, but they do not implement a median in the output or the eviction of a signer. Status lists each feature.

Quorum on one sample

AttestationBeacon takes 1 to 5 signer keys and a threshold. attest counts the valid signatures over one message. The message is the SHA-256 hash of the asset id, the ticker, the price, and the time. The spend fails when fewer than threshold signatures are valid (the loop). The first signersN keys must be different from each other. All signers sign the same price and the same time. A signature counts only for the sample that it signs. Signers that report different prices do not reach a quorum. The contract counts agreement, and it does not combine prices. The quotes become one sample offchain, before the signers sign. The desk of arkade-options sets the price of its quotes with the median of Coinbase, Kraken, and Binance. The desk needs two live venues. The oracle service samples one source, the Deribit BTCUSD index. For a signer that did not sign, pass an empty signature. attest checks each slot below signersN. A valid signature counts 1. An empty signature counts 0. Any other signature fails the transaction, also a signature of 64 zero bytes (opcodeChecksigFromStack). The arkade-prediction repository passes an empty signature for each absent signer. A quorum does not give independence. The open-source oracle service takes all signer keys as secrets in one process and tests the quorum script, but it does not give independent custody or independent data.

Median of signed prices

A median needs each signer’s own price, so one agreed price is not enough. In the sources, the consumer computes the median with Arkade opcodes. The options example in the compiler verifies three signatures from three different oracles for each print. It takes the median of the three prices:
examples/option/option_vault.ark @ f9f8866
settle then checks that the three signers of a print are different. It verifies each signature and takes the median:
examples/option/option_vault.ark @ f9f8866
With 2f + 1 signers, up to f signers can report any price. The median stays between the lowest and the highest honest price. With three signers, one wrong price cannot move the result outside the two honest prices. For a yes-or-no question against a fixed strike, the contract does not sort. PriceVault in the prediction market counts the signers whose signed value is on one side of the strike. With five signers and quorum 3, this gives the median. The quorum must be a majority of the signers. With a smaller quorum, both sides can reach the quorum.
contracts/src/price_vault.ark @ c0b063f
Both contracts store the signer keys in their constructor. This is the dependency that The Coupling Problem describes. When a key changes, each open consumer stays with the old committee.

Outliers and eviction

A median tolerates an outlier, but it does not remove the signer that reported the outlier. No contract in the sources evicts a signer for a deviation. The script of the output stores the committee as constructor arguments. To change the committee, the admin runs migrate to a script with a different signers set. The asset id does not change, so no consumer changes.

Status

Source files: examples/option/option_vault.ark at f9f8866, contracts/src/price_vault.ark at c0b063f, and attestation_beacon.ark at 9fc10ef.