anchor-nft-ticketing

Solana / Rust / Anchor - NFT Marketplace Event Ticketing

MIT License

Stars
2

NFT Ticketing in Rust / Solana / Anchor

#Rust 🦀 #Solana 💠 #Anchor ⚓ #React ⚛️ #NFT 🖼️ #Web3 🌐

NFT Marketplace Event Ticketing on the Solana Blockchain

This NFT Solana Project is developed by Stephen Damian

Note: I developed the same project with Ethereum / Hardhat

Summary

Project Overview

NFT Marketplace Event Ticketing - A decentralized application for managing and verifying event tickets as NFTs on the Solana blockchain.

Status: Under development 🚧

See more images here: Images

Roadmap

  • ✅ Phantom integration.
  • ✅ Homepage.
  • ✅ Create event.
  • ✅ Event listing.
  • ✅ Buy a ticket.
  • ✅ Generate NFTs.
  • ✅ Verify NFTs.
  • ⬜ Integrate other wallets.
  • ⬜ Event organizer dashboard.

Prerequisites

  • Rust >= 1.75.0 (last tested: 1.80.0) - You can install Rust here: Rustup.
  • Solana >= 1.18.14 (last tested: 1.18.22) - You can install Solana CLI here: Solana CLI.
  • Anchor 0.30.1 - You can install Anchor here: Anchor.
  • Node.js >= 18 (last tested: 20) and npm - You can install Node.js and npm here: Node.js.

Technologies

  • Back-End: Rust, Solana, Anchor 0.30.1
  • Front-End: Next.js 14, React 18, TypeScript 5, Tailwind CSS
  • Blockchain Interaction: Solana-Web3.js
  • Wallet Integration: Phantom

Getting Started (Localnet)

Setup Solana Locally

Configure your Solana CLI to use your localhost validator:

solana config set --url localhost

Clone the Repository

git clone https://github.com/s-damian/anchor-nft-ticketing.git

Go to the Anchor Directory

cd /<your-path>/anchor-nft-ticketing

Install Dependencies

For the Anchor Program:

npm install

For the Next.js App:

npm install --prefix ./app/frontend

Update Anchor Configuration

  • In [provider] section, update to:
[provider]
cluster = "localnet"

Environment Setup

Create a ./app/frontend/.env file (for the Next.js App):

cp ./app/frontend/.env.example ./app/frontend/.env

Make Scripts Executable

Ensure that the shell scripts are executable:

chmod +x sh/*.sh

Run Solana Local Validator

Start the Solana local validator (solana-test-validator) with Metaplex:

npm run ledger

Fund Your Wallet

After starting the Solana local validator, you will probably need to airdrop SOL to your Localnet wallet:

solana airdrop <amount>

Build and Deploy the Anchor Program

Build:

anchor build

Deploy:

anchor deploy

PS: anchor deploy will create your target/idl/nft_ticketing.json file.

Update Program ID

Automatically update the Program ID in the necessary files:

npm run update-program-id

Rebuild and Redeploy the Anchor Program

anchor build && anchor deploy

This step is crucial after updating the Program ID to ensure that the deployed program matches the updated configuration.

IDL Setup

Copy the IDL (Interface Definition Language) file into the Next.js App:

npm run copy-idl

Phantom Wallet

In your Phantom wallet settings, switch to Solana Localnet.

Run Front-End (Next.js App)

Go to the Next.js App Directory:

cd /<your-path>/anchor-nft-ticketing/app/frontend

Start the development server:

npm run dev

Open your browser and go to:

http://localhost:3000

Transition: Localnet to Devnet

Preparing for Public Deployment: Transition from Localnet to Devnet

After successfully running your project locally, the next step is to deploy it on the public Devnet. This section guides you through the process of configuring your environment, deploying your program to Devnet, and updating your Front-End to interact with the deployed program on the Devnet.

To switch from the Localnet to Devnet: Localnet-to-Devnet.md

Code Structure

.
├── app
   └── frontend
       ├── app
       │   └── [React pages]
       ├── src
       │   ├── components
       │   │   └── [React components]
       │   ├── handlers
       │   │   └── [React handlers]
       │   ├── idl
       │   │   └── nft_ticketing.json.
       │   └── utils
       │       └── [React utils]
       ├── .env
       ├── config-overrides.js
       ├── package.json
       └── tailwind.config.ts
├── programs
   └── nft-ticketing
       ├── src
       │   ├── kernel
       │   │   └── [Program managers]
       │   └── lib.rs
       └── Cargo.toml
├── tests
   └── [Tests]
├── Anchor.toml
├── Cargo.toml
├── package.json
└── README.md

Various Documentations

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Badges
Extracted from project README
Tests Static Analysis License