Overview:
Aptos Labs introduces Aptos Roll, the first secure and instant on-chain randomness API specifically designed for proof-of-stake (PoS) blockchains. This API simplifies the process of obtaining random values in Move smart contracts, crucial for applications like decentralized games, raffles, NFTs, and airdrops.
Key Features:
-
Instant Delivery:
- APIs:
randomness::u64_integer()
: Returns a uniformly-sampled 64-bit unsigned integer.randomness::bytes(n)
: Returns a uniformly-sampled vector of n bytes.randomness::permutation(n)
: Returns a uniformly-sampled shuffle of the vector [0, 1, 2, …, n-1].
- Benefit: Provides randomness instantly, unlike external beacons which require a commit-and-reveal process.
- APIs:
-
Security:
- Trust Model: Relies on the security and availability of the Aptos PoS validator set.
- Unpredictable and Unbiasable: Randomness is secure as long as adversaries control less than 50% of the stake.
-
Novel Cryptography:
- Weighted Publicly-Verifiable Secret Sharing (wPVSS): Efficient and aggregatable, reducing communication overheads.
- Weighted Distributed Key Generation (wDKG): Facilitates secure secret sharing among validators.
- Weighted Verifiable Random Function (wVRF): Ensures constant communication per validator, optimizing performance.
Technical Details:
- Epoch-Based Randomness:
- Validators generate a shared secret at the start of each epoch via wDKG.
- This shared secret is used to compute a randomness seed for each block in the epoch.
- Block-Specific Randomness:
- Validators evaluate a wVRF using the shared secret to produce a block seed.
- The seed ensures each block has unique, unbiasable randomness.
Comparison to Other Solutions:
-
DFINITY:
- Uses threshold DKG (tDKG) and threshold VRF (tVRF), suitable for non-PoS models. Easier but less secure for PoS.
-
External Beacons (e.g., Drand):
- Require external trust and commit-reveal processes, delaying randomness.
-
Verifiable Delay Functions (VDFs):
- Cannot produce instant randomness and are unsuitable for low-latency blockchains.
-
Flow and Celo Designs:
- Susceptible to bias and predictability by malicious validators.
Why Aptos Roll Stands Out:
- Instant Access: Provides immediate randomness, enhancing developer convenience.
- Security: Matches the blockchain’s inherent security, ensuring robustness.
- Efficiency: Optimized cryptographic techniques minimize overhead, making it practical for real-world use.