Skip to content

Native-VRF/native-vrf

Repository files navigation

Native VRF

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.

Setup

  1. Clone this repository
git clone https://github.com/Native-VRF/native-vrf.git
  1. Copy the .env.example file and rename to .env
cp .env.example .env
  1. Set the PRIVATE_KEY variable in the .env file using your wallet private key
  2. Install required packages
npm i

Deploy Native VRF

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

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

Example of Native VRF consumer

  1. Deploy a consumer smart contract
npx hardhat run scripts/deploy/consumer.ts --network <target-network>
  1. Run random request
npx hardhat run scripts/examples/request.ts --network <target-network>
  1. Run random data record
npx hardhat run scripts/examples/record.ts --network <target-network>

Full article

You can read full article that explains the building blocks and analysis of Native VRF and other RNGs. https://www.mdpi.com/2079-8954/11/7/326

Citation

Please cite our research article if you use this library in your research or projects.

Werapun W, Karode T, Suaboot J, Arporntip T, Sangiamkul E. NativeVRF: A Simplified Decentralized Random Number Generator on EVM Blockchains. Systems. 2023; 11(7):326. https://doi.org/10.3390/systems11070326

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published