TypeScript SDK for Dice Protocol: commit-reveal randomness oracle on Robinhood Chain.
Key features: fast reveal, cheap predictable fee (0.000025 ETH exact), agent-friendly (SKILL.md, x402).
Canonical page: https://diceprotocol.world/robinhood-chain-rng/ Agent files: https://diceprotocol.world/llms.txt · https://diceprotocol.world/skills/dice-integration/SKILL.md
| Item | Value |
|---|---|
| Package | @diceprotocol/sdk |
| Contract | 0xd8a0680e7699526b57140ed4eafdcc7219dc0a0c |
| Chain ID | 4663 |
| Fee | exact 0.000025 ETH (25000000000000 wei) |
| Refund delay | 6 L1 blocks (~60–90s) via refundRequest |
| Provider | 0x8741b8a825644D9Ef18Faf2DAB5e9b47B900F2b6 |
| SDK callback gas default | 200000 (DEFAULT_CALLBACK_GAS_LIMIT). Omitted gasLimit does not send 0. Pass 0 only to opt in to the live provider defaultGasLimit. |
npm install @diceprotocol/sdkimport { DiceProtocol } from '@diceprotocol/sdk';
import { JsonRpcProvider, Wallet } from 'ethers';
const dice = new DiceProtocol({
rpcUrl: 'https://rpc.mainnet.chain.robinhood.com',
contractAddress: '0xd8a0680e7699526b57140ed4eafdcc7219dc0a0c',
});
const signer = new Wallet(privateKey, new JsonRpcProvider('https://rpc.mainnet.chain.robinhood.com'));
const provider = '0x8741b8a825644D9Ef18Faf2DAB5e9b47B900F2b6';
// Fee must be exact (underpay and overpay both revert)
const fee = await dice.getFee(provider, 200000); // 25000000000000n
const userRandom = DiceProtocol.generateUserRandom();
// Fourth arg optional; omitted uses DEFAULT_CALLBACK_GAS_LIMIT (200000), not provider default 0.
const seq = await dice.requestRandom(signer, provider, userRandom, 200000);
dice.onReveal((event) => {
if (event.sequenceNumber === seq) {
console.log('Random number:', event.randomNumber);
}
});
// If not revealed within ~60–90s:
// await dice.refundRequest(signer, provider, seq);See SKILL.md for the full agent integration guide (exact fee, refunds, errors, cast examples).
Solidity interfaces ship in solidity/. Foundry consumers need this remapping (also in packaged remappings.txt):
@diceprotocol/sdk/=node_modules/@diceprotocol/sdk/
import {IEntropyConsumer} from "@diceprotocol/sdk/solidity/IEntropyConsumer.sol";
import {IEntropy} from "@diceprotocol/sdk/solidity/IEntropy.sol";Apache-2.0. Portions adapted from Pyth Entropy / pyth-crosschain. See LICENSE and NOTICE.