Commit-Reveal Randomness Oracle for Robinhood Chain
Dice Protocol provides onchain verifiable randomness through a hash-chain commitment scheme. A designated provider pre-commits to a sequence of random values and reveals them on-demand, combining user-contributed randomness with provider-revealed values using Keccak256.
Portions of the architecture and interfaces are adapted from Pyth Entropy / pyth-crosschain under Apache-2.0.
- Two-party - Neither party unilaterally chooses a completed result. The provider can still withhold a reveal.
- Verifiable - Every reveal is verifiable onchain via Keccak256
- Fast reveal - Built for sub-second keeper fulfillment. Typical observed request-to-reveal is about 1-3 seconds (not an SLA).
- Cheap, predictable fee - Exact
0.000025 ETHper request (msg.valuemust match exactly) - Agent-friendly - x402
$0.05USDG,@diceprotocol/sdk, SKILL.md - Refundable - If not revealed within ~60-90s (
refundDelayBlocks = 6L1 blocks), requester can reclaim fee viarefundRequest - Immutable - No proxy, no upgrades
- Automatic - Keeper auto-reveals; optional consumer callback
Site: RNG for Robinhood Chain · llms.txt
| Parameter | Value |
|---|---|
| Chain | Robinhood Chain (ID: 4663) |
| RPC | https://rpc.mainnet.chain.robinhood.com |
| Explorer | https://robinhoodchain.blockscout.com |
| DiceEntropy | 0xd8a0680e7699526b57140ed4eafdcc7219dc0a0c |
| Provider (keeper) | 0x8741b8a825644D9Ef18Faf2DAB5e9b47B900F2b6 |
| Fee | 0.000025 ETH exact (25000000000000 wei) |
| Refund delay | 6 L1 blocks (~60–90s wall-clock) |
| Package | @diceprotocol/sdk |
| Document | Description |
|---|---|
| Whitepaper | Technical specification |
| Integration Guide | Quick start |
| Developer Docs | API reference |
| Architecture | System design |
| Deployment Guide | Deploy notes |
| Roadmap | Roadmap |
| Security | Security notes |
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import {IEntropyConsumer} from "@diceprotocol/sdk/solidity/IEntropyConsumer.sol";
import {IEntropy} from "@diceprotocol/sdk/solidity/IEntropy.sol";
contract MyGame is IEntropyConsumer {
IEntropy public immutable dice;
address public provider = 0x8741b8a825644D9Ef18Faf2DAB5e9b47B900F2b6;
constructor(address _dice) {
dice = IEntropy(_dice);
}
function roll(bytes32 userRandom) external payable {
// Generate userRandom client-side with a CSPRNG and keep it private.
// msg.value must equal getFeeV2(provider, gasLimit) exactly
dice.requestV2{value: msg.value}(provider, userRandom, 200000);
}
function entropyCallback(uint64 seq, address, bytes32 random) internal override {
uint256 result = uint256(random) % 6 + 1;
}
function getEntropy() internal view override returns (address) {
return address(dice);
}
}If a request is not revealed within about 60–90 seconds (6 L1 blocks on Robinhood / Arbitrum Nitro, where block.number is L1), the original requester can call:
dice.refundRequest(provider, sequenceNumber);This refunds the exact feePaid for that request.
A refund returns the exact request fee, but transaction gas is not refunded:
- The requester pays gas for the original request and for
refundRequest. - Dice retains no request fee and earns nothing from an unrevealed, refunded request.
- If no reveal transaction was submitted, Dice has no direct reveal-transaction gas cost for that request.
- If a reveal transaction was submitted but reverted, Dice bears that failed transaction's gas cost.
Apache-2.0. See LICENSE and NOTICE.