GOAT VRF
GOAT VRF uses the drand network to deliver verifiable randomness to EVM contracts on GOAT Network.
Request Flow
Components
| Component | Role |
|---|---|
| GoatVRF contract | Verifies proofs and stores request state |
| Oracle or relayer service | Pulls randomness from drand and submits proofs |
| Consumer contract | Requests randomness and implements the callback |
Consumer Integration
To integrate GOAT VRF, implement IRandomnessCallback and call getNewRandom() on the GoatVRF contract.
How GOAT VRF Works
Consumer requests randomness
Your contract calls getNewRandom() on the GoatVRF contract, providing a deadline, a maximum gas price you are willing to pay for the callback, and a gas limit for your callback function.
Fee is collected
The GoatVRF contract collects a fee in WGOATBTC tokens to cover the off-chain proof submission and the on-chain callback gas.
Oracle submits a drand proof
The off-chain Oracle service monitors the chain for randomness requests and submits proofs from the drand network.
Callback delivers randomness
When a valid proof is submitted, GoatVRF calls your contract's receiveRandomness() function with the resulting random value.
Implementation Details
Fee Calculation
The randomness fee is based on the callback gas limit and the gas price used for fulfillment.
Token Approval
The fee token is WGOATBTC. Approve enough allowance before calling getNewRandom, and leave headroom if you expect gas-price movement between estimation and fulfillment.
Deadline
Use the drand beacon period to calculate a reasonable fulfillment deadline.
Fee Rule Types
| Fee rule | Description |
|---|---|
| Fixed | Uses a static fee plus callback gas cost |
| APRO_BTC | Adjusts against the APRO BTC price feed to keep a target USD-denominated value |
Configure the active rule through environment variables when deploying GoatVRF:
- Fixed — set
FEE_RULE_TYPE=FIXEDandFIXED_FEE=<amount>. - APRO_BTC — set
FEE_RULE_TYPE=APRO_BTC,TARGET_VALUE=<amount>(in USD with 8 decimals), andPRICE_FEED=<address>. The fee then adjusts automatically with the BTC price to keep a consistent USD value.
The APRO_BTC fee rule contract must be granted permission by APRO before it can be used.
Deployments
Testnet3
| Property | Value |
|---|---|
| GoatVRF Proxy | 0xa3aeBE2F0d9daDac9E8111D9D41671A510FFB2ca |
| Fee Token | 0xbC10000000000000000000000000000000000000 |
| Beacon Type | BN254 |
| Beacon | 0x46d74aB88fd5894F82d150ec18912aCC9df80663 |
| Fee Rule Type | APRO_BTC |
| Fee Rule | 0x34fd84eCbFf7B8369b61A34CB6B5666AD3a05F97 |
| Target Value | 1000000 |
| Price Feed | 0x0c98A1AAECE12D6815A02fD2A6d24652325FD6Ef |
| Fee Recipient | 0xF51d148D4A7ae851c1d5641763081023938c6342 |
| Relayer | 0x5C71d12522c454689A6A1653A99A44Bd5Fa4A65B |
| Overhead Gas | 200000 |
| Max Deadline Delta | 604800 |
| Request Expire Time | 604800 |
Mainnet
| Property | Value |
|---|---|
| GoatVRF Proxy | 0x0b481e6133B4e1c489995bF867CA6E5b562c858B |
| Fee Token | 0xbC10000000000000000000000000000000000000 |
| Beacon Type | BN254 |
| Beacon | 0x0EaC9f6B63263038268c675FF7C9Bff6C8B30F76 |
| Fee Rule Type | APRO_BTC |
| Fee Rule | 0xAD2aE757e15BA11e87ad24589bCA077ABE93328C |
| Target Value | 1000000 |
| Price Feed | 0xB587aB45a92e19eE3e0d483bc629DE75Ed575025 |
| Fee Recipient | 0x53D0A68ed81698239831cd0A09813771A37E7f8F |
| Relayer | 0x9DaFB0DC6DCDcD4176a5C420F43C15eBe26305B3 |
| Overhead Gas | 200000 |
| Max Deadline Delta | 604800 |
| Request Expire Time | 604800 |
The APRO_BTC fee rule adjusts dynamically against the APRO BTC/USD price feed to keep a consistent USD-denominated value. The fee rule contract must be authorized by APRO before use.