Skip to content

Aliserag/random.wtf

Repository files navigation

Randomness.WTF

A decentralized random number generator using Flow's on-chain VRF (Verifiable Random Function).

Features

  • Generate random numbers within a specified range
  • Select random items from a list
  • True randomness powered by Flow's VRF

Tech Stack

  • Next.js 13+ with App Router
  • TypeScript
  • Tailwind CSS
  • Solidity
  • Hardhat
  • Flow Network

Getting Started

  1. Clone the repository:

    git clone https://github.com/yourusername/random.wtf.git && cd random.wtf
  2. Install dependencies:

    npm install
  3. Compile the contracts and generate TypeScript bindings

    npm hardhat compile
  4. Set up environment variables:

    cp .env.example .env

    Edit .env and add your Flow EVM private key.

  5. Deploy the smart contract:

    npx hardhat run scripts/deploy.ts --network flow_testnet
  6. Run the development server:

    npm run dev

Open http://localhost:3000 with your browser to see the result.

Running Tests

To run the Hardhat test suite, execute the command:

npx hardhat test test/*.test.ts

Smart Contract

The RandomnessWTF contract is deployed on Testnet and uses Flow's VRF capabilities to generate true random numbers. The contract provides two main functions:

  • getRandomNumber(uint256 min, uint256 max): Generates a random number within the specified range
  • selectRandomItem(string[] items): Selects a random item from an array of strings

Resources

For more about using Flow's VRF in your contracts, check out the resources below:

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •