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
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
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 runsmigrate 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.