Skip to content

DevWonder01/Onchain-Randomization

Repository files navigation

Onchain Randomization: Chainlink VRF & Pyth Entropy Coin Flip

This project demonstrates onchain randomization using both Chainlink VRF and Pyth Entropy for a provably fair coin flip game. It includes smart contracts, deployment scripts, and tests for both randomness providers.

Features

Project Structure

contracts/           # Solidity smart contracts
scripts/             # Deployment scripts
test/                # Test files
abi/                 # Exported ABIs
artifacts/, cache/   # Hardhat build artifacts
ignition/            # Hardhat Ignition deployment modules
types/               # Typechain generated types

Getting Started

1. Install Dependencies

npm install

2. Configure Environment

Copy .env.example to .env and fill in your keys:

cp .env.example .env
  • key: Your deployer private key
  • basescankey: BaseScan API key for contract verification
  • COINMARKETCAP_API_KEY: For gas reporter (optional)

3. Compile Contracts

npm run build

4. Run Tests

npx hardhat test

5. Deploy Contracts

  • Chainlink VRF Coin Flip:

    npx ts-node scripts/deploy/vrf.deploy.ts
  • Pyth Entropy Coin Flip:

    npx ts-node scripts/deploy/entropy.deploy.ts

Notes

License

MIT


Switching from Chainlink VRF to Pyth Entropy
This repo provides a reference for integrating both randomness solutions in onchain games.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published