Skip to content

yaduvanshisachin/Event-ticketing-DApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Ticketing dApp

A decentralized event ticketing application built on Ethereum blockchain using React and Solidity.

🚀 Features

  • Event Creation: Artists can create events with customizable details
  • Ticket Minting: Users can purchase tickets as NFTs
  • Resale Market: Secondary market for ticket trading
  • Seat Management: Automatic seat assignment for tickets
  • Royalty System: 10% royalty on secondary sales
  • Limit Protection: Maximum 5 tickets per address per event

🛠️ Tech Stack

  • Frontend: React.js, ethers.js, react-hot-toast
  • Backend: Solidity, Hardhat
  • Blockchain: Ethereum (Sepolia Testnet)
  • Smart Contracts: OpenZeppelin (ERC721, Ownable, ReentrancyGuard)

📋 Prerequisites

  • Node.js (v14 or higher)
  • MetaMask browser extension
  • Sepolia testnet ETH
  • Alchemy or Infura account

🚀 Quick Start

1. Clone the Repository

git clone <your-repo-url>
cd event-ticketing-dApp

2. Install Dependencies

# Install root dependencies
npm install

# Install frontend dependencies
cd frontend
npm install
cd ..

3. Environment Setup

Create a .env file in the root directory:

# Your wallet's private key (without 0x prefix)
PRIVATE_KEY=your_private_key_here

# Your Alchemy/Infura Sepolia RPC URL
SEPOLIA_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR-API-KEY

4. Deploy Smart Contracts

# Compile contracts
npx hardhat compile

# Deploy to Sepolia
npx hardhat run scripts/deploy-sepolia.js --network sepolia

# Update frontend configuration
node scripts/update-frontend-config.js

5. Start the Application

cd frontend
npm start

The application will be available at http://localhost:3000

🔧 Configuration

MetaMask Setup

  1. Install MetaMask browser extension
  2. Add Sepolia testnet to MetaMask:
    • Network Name: Sepolia Testnet
    • RPC URL: Your Alchemy/Infura URL
    • Chain ID: 11155111
    • Currency Symbol: ETH

Get Test ETH

Visit Sepolia Faucet to get test ETH.

📁 Project Structure

event-ticketing-dApp/
├── contracts/           # Smart contracts
│   └── EventTicket.sol
├── frontend/           # React application
│   ├── src/
│   │   ├── components/ # React components
│   │   ├── config/     # Contract configuration
│   │   └── context/    # Web3 context
│   └── public/
├── scripts/            # Deployment scripts
│   ├── deploy-sepolia.js
│   ├── update-frontend-config.js
│   └── setup-sepolia.js
├── hardhat.config.js   # Hardhat configuration
└── README.md

🎯 Smart Contract Features

EventTicket Contract

  • ERC721 NFT Standard: Each ticket is a unique NFT
  • Event Management: Create and manage events
  • Ticket Minting: Purchase tickets with ETH
  • Resale System: List and buy tickets on secondary market
  • Royalty System: 10% royalty on resales
  • Seat Assignment: Automatic seat numbering
  • Purchase Limits: Max 5 tickets per address per event

🔒 Security Features

  • ReentrancyGuard: Prevents reentrancy attacks
  • Ownable: Access control for admin functions
  • Input Validation: Comprehensive parameter checks
  • Safe Math: Built-in overflow protection (Solidity 0.8+)

🧪 Testing

# Run tests
npx hardhat test

📚 Usage Guide

For Event Organizers

  1. Connect MetaMask wallet
  2. Click "Create Event"
  3. Fill in event details (name, date, venue, price, max tickets)
  4. Submit transaction
  5. Event is now available for ticket sales

For Ticket Buyers

  1. Connect MetaMask wallet
  2. Browse available events
  3. Click "Buy Ticket" on desired event
  4. Confirm transaction in MetaMask
  5. Ticket NFT is minted to your wallet

For Resale

  1. Go to "My Tickets"
  2. Click "List for Resale" on a ticket
  3. Set resale price
  4. Others can buy from "Resale Market"

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

This project is licensed under the MIT License.

🔗 Useful Links

⚠️ Important Notes

  • This is a testnet deployment for development purposes
  • Never use real private keys in development
  • Always test thoroughly before mainnet deployment
  • Keep your private keys secure and never commit them to version control

About

A decentralized event ticketing application built on Ethereum blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors