Native VRF applies verifiable random function and simplifies process of participation. It combines on-chain data and random feed from public to generate a random number. In order to secure data feed, Native VRF requires data feeders to generate a valid signature with corresponding random input before publishing it to a blockchain. Each random number needs prior random result as a component. The prior random result is also an input of signatures generated by data feeders. With this data forming, Native VRF provides secure random number generation while keeping simplicity for participants.
This project aims to support random number generation on Ethereum compatible chains natively. Anyone can simply deploy and participate in decentralized random number generation. The system is more secure when there are more number of participants.
- Clone this repository
git clone https://github.com/Native-VRF/native-vrf.git
- Copy the
.env.example
file and rename to.env
cp .env.example .env
- Set the
PRIVATE_KEY
variable in the.env
file using your wallet private key - Install required packages
npm i
Run deploy script
npx hardhat run scripts/deploy/nativevrf.ts --network <target-network>
Example:
npx hardhat run scripts/deploy/nativevrf.ts --network kubchain_test
Run fulfiller bot script
npx hardhat run scripts/examples/fulfill-bot.ts --network <target-network>
Example:
npx hardhat run scripts/examples/fulfill-bot.ts --network kubchain_test
- Deploy a consumer smart contract
npx hardhat run scripts/deploy/consumer.ts --network <target-network>
- Run random request
npx hardhat run scripts/examples/request.ts --network <target-network>
- Run random data record
npx hardhat run scripts/examples/record.ts --network <target-network>