VeeDo is a STARK-based Verifiable Delay Function (VDF) service. VeeDo works in the Vending Machine model - a user can request a randomness for a specific input, sending payment in advance. An off-chain service picks up the request, computes the randomness and generates a proof attesting to the validity of the computation. The proof is then sent to the STARK Verifier for a verification process (see the Verifier contract). The Vending contract registers the new randomness if the Verifier accepts the corresponding proof and sends the payment to the off-chain service. In case a request was not served, the user can reclaim the payment after sufficient time has passed.
The Vending contract serves as the interface and has the following API:
addPayment(uint256 seed, uint256 n_iter, uint256 tag, uint256 paymentAmount)reclaimPayment(uint256 seed, uint256 n_iter, uint256 tag)prizes(uint256 seed, uint256 n_iter) viewregisteredRandomness(uint256 seed, uint256 n_iter) viewpayments(address sender, uint256 seed, uint256 n_iter, uint256 tag) view
Full implementation can be found in the code.
Denote the delay function by f (see the reference code for a simple implementation example).
The randomness on (seed, n_iter) is computed as follows:
- Compute
b:=keccak256(uint256 seed, string ‘veedo’). - Compute the delay function input
input=<x_in,y_in>by taking the lowest 250 bits ofband splitting them to a pair of 125-bit elements each:x_in: = b & ((1<<125)-1)y_in: = b >> 125 & ((1<<125)-1)
- Compute
foninput=<x_in,y_in>forn_iteriterations. - Denote
f(input,n_iter):=<x_out, y_out>.Randomness:= keccak256(x_out, y_out, ‘veedo’).
The proof is for the following statement: "<x_out, y_out> is the result of calculating f
on input=<x_in,y_in> for n_iter iterations".
| Mainnet | Ropsten | |
|---|---|---|
| Vending | Currently N/A | 0x45D88Ca5aF1eA87b8c38377b6B4455E75225db26 |
| Verifier | Currently N/A | 0x70165E8Bea7cE6E6EC456e0eb1b1dD55c3Ca7811 |
Accepted n_iter |
Currently N/A | 10239 |