Skip to content

This project is a decentralized raffle system built on the Arbitrum blockchain. It leverages the scalability and low transaction costs of Arbitrum to provide a seamless and efficient raffle experience. The system is designed to be transparent, secure, and fair, ensuring that all participants have an equal chance of winning.

License

Notifications You must be signed in to change notification settings

walterthesmart/RaffleOnArbitrum

Repository files navigation

Raffle Draw Platform on Arbitrum

# Overview
This project is a decentralized raffle draw platform built on the Arbitrum Layer 2 network. It utilizes smart contracts deployed via Hardhat and integrates Chainlink VRF for fair random winner selection. The frontend is developed with React.js, allowing users to interact with the platform seamlessly by entering raffles, viewing live results, and connecting their wallets.

## Features
- **Blockchain-based**: Uses Arbitrum for lower gas fees and fast transactions.
- **Secure Randomness**: Chainlink VRF ensures fairness in winner selection.
- **User-friendly UI**: Built with React.js, providing a sleek interface.
- **Wallet Integration**: Users can connect with wallets like MetaMask to participate in raffles.
- **Responsive Design**: Optimized for both desktop and mobile devices.

## Technology Stack
- **Smart Contracts**: Written in Solidity and deployed using Hardhat on Arbitrum.
- **Frontend**: React.js framework for building a dynamic and responsive user interface.
- **Randomness Provider**: Chainlink VRF for verifiable randomness.
- **Blockchain Network**: Arbitrum Layer 2 for scalability and lower transaction costs.

## Prerequisites
- **Node.js**: Make sure you have Node.js installed. You can download it from [here](https://nodejs.org/).
- **Hardhat**: Install Hardhat by running the following command:
    ```bash
    npm install --save-dev hardhat
    ```
- **Arbitrum Network Setup**: Ensure you have set up the Arbitrum network in your wallet (e.g., MetaMask).
- **Chainlink VRF**: Configure Chainlink VRF for secure and random number generation.

## Getting Started
### 1. Clone the Repository
```bash
git clone https://github.com/your-username/raffle-platform.git
cd raffle-platform

2. Install Dependencies

Backend (Hardhat):

cd raffle-smart-contracts
npm install

Frontend (React):

cd raffle-frontend
npm install

Project Structure

├── raffle-smart-contracts # Smart contracts and Hardhat config
│   ├── contracts
│   │   └── Raffle.sol      # The Raffle smart contract
│   ├── scripts
│   │   └── deploy.js       # Deployment script
│   ├── test
│   │   └── raffle.test.js  # Smart contract tests
│   └── hardhat.config.js   # Hardhat configuration
├── raffle-frontend         # React.js frontend code
│   ├── public
│   ├── src
│   │   ├── components      # React components
│   │   ├── hooks           # Custom hooks for blockchain interaction
│   │   └── App.js          # Main entry point for the app
│   └── package.json
└── README.md

Smart Contract Deployment

1. Compile the Smart Contracts

npx hardhat compile

2. Deploy to Arbitrum Testnet

Update your .env file with the following:

ALCHEMY_API_URL=https://arb-rinkeby.alchemyapi.io/v2/your-api-key
PRIVATE_KEY=your-private-key
VRF_COORDINATOR=0x...
LINK_TOKEN=0x...
KEY_HASH=0x...
FEE=...

Deploy the contract to the Arbitrum test network:

npx hardhat run scripts/deploy.js --network arbitrumTestnet

Frontend Setup

Create a .env file in the frontend directory with the following:

REACT_APP_CONTRACT_ADDRESS=your-deployed-contract-address
REACT_APP_CHAIN_ID=421611 # Arbitrum Testnet Chain ID
REACT_APP_ALCHEMY_API_KEY=your-alchemy-api-key

Start the frontend application:

npm start

Interacting with the Smart Contract

  • Enter a Raffle: Connect your wallet and enter an ongoing raffle by paying the entry fee.
  • Random Winner Selection: After the raffle is full or the deadline has passed, the Chainlink VRF service is called to randomly select a winner.
  • Claim Prize: The winner can claim their prize via the platform.

Testing

Run the smart contract tests using Hardhat:

npx hardhat test

Deployment

  • Frontend Deployment: Host the React frontend on a service like Vercel or Netlify.
  • Smart Contract Deployment: Deploy the smart contract to the Arbitrum mainnet.

License

MIT

About

This project is a decentralized raffle system built on the Arbitrum blockchain. It leverages the scalability and low transaction costs of Arbitrum to provide a seamless and efficient raffle experience. The system is designed to be transparent, secure, and fair, ensuring that all participants have an equal chance of winning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published