What are Presets?
Presets at a high level use Chainlink VRF V2 to generate a random number to later be used as an input for a Chainlink Function. This allows you to generate and consume random numbers all in a decentralized and provable manner with the convenience of a single API call.Offchain API
With 0xCord’s Presets offchain API, you can easily consume Chainlink VRF V2 and Chainlink Functions through a simple RESTful JSON API call, bridging the gap between Web2 and decentralized Web3 infrastructure. This allows you to retrieve random numbers and execute external computations for your applications without the need for complex onchain interactions.Prerequisites
To get started with Chainlink VRF V2 and Chainlink Functions and 0xCord, you will need the following:- An account on 0xCord.com: Sign up for an account on 0xCord.com to access the infrastructure and services provided by 0xCord.
- Add the Preset to your dapp to get your api key: Follow the steps outlined in the Get started page to provision Chainlink Functions for your application.
Supported networks
Testnets
| Network Name | Value |
|---|---|
| Polygon Mumbai | polygon_mumbai |
| Ethereum Sepolia | sepolia |
| Avalanche Fuji | fuji |
Supported Presets
- Coinflip: Returns a random number between 0 and 1. This preset is useful for generating a random boolean value, where 0 represents false and 1 represents true.
- Range: Returns a random number between a min and a max. This preset is useful for generating a random number within a specific range, such as for a game or simulation.
- Lotto: Returns a string with the N amount of winners comma separated. This preset is useful for selecting random winners from a list of participants, such as for a raffle or contest.
- nDice: Returns n amount of dice rolls for k amount of dice faces (the max amount of rolls is 100). This preset is useful for simulating dice rolls in a game or for generating random numbers with a specific distribution.
Using the Offchain API
To get started with the offchain API add your api key to the header of your request, followed by the body parameters of the preset you want to use. Coinflip: Returns a random number between 0 and 1Coinflip API Reference
Learn more about the API endpoint for using the coinflip preset
min: The minimum value of the range.max: The maximum value of the range.
Range API Reference
Learn more about the API endpoint for using the range preset
numberOfWinners: The amount of winners you want to get.list: The list of participants.
Lotto API Reference
Learn more about the API endpoint for using the lotto preset
numFaces: The amount of faces the dice has.numDice: The amount of dice you want to roll.
nDice API Reference
Learn more about the API endpoint for using the nDice preset

