Ticketing
On-chain concert venue and ticket management with SPL token payments
Pending
Anchor 0.32
Program ID
2bmGLNZ1dXFiWcS7x8DffzQVHUuPhhJ4vRKLw2SSdBNB
Repository
ExpertVagabond/solana-ticketing
Cluster
Devnet
Instructions
IX
create_venue
Creates a new venue PDA that holds ticket inventory and payment configuration.
| Parameter | Type | Description |
|---|---|---|
venue_id | String | Unique identifier for the venue (used as PDA seed) |
IX
create_tickets
Adds a new ticket tier to a venue. Only the venue owner can call this.
| Parameter | Type | Description |
|---|---|---|
venue_id | String | Venue identifier |
ticket_name | String | Name of the ticket tier (e.g. "VIP", "General") |
price | u64 | Price per ticket in token base units |
available_tickets | u64 | Total supply for this tier |
IX
purchase_tickets
Purchases tickets by transferring SPL tokens from the buyer to the venue owner. Creates a purchase receipt PDA for the buyer.
| Parameter | Type | Description |
|---|---|---|
venue_id | String | Venue identifier |
ticket_name | String | Name of the ticket tier to purchase |
quantity | u64 | Number of tickets to buy |
Accounts
Venue
| Field | Type | Description |
|---|---|---|
owner | Pubkey | Venue owner wallet |
available_tickets | Vec<Ticket> | Array of ticket tiers |
token_mint | Pubkey | SPL token mint for payments |
owner_token_account | Pubkey | Venue owner's token account for receiving payment |
bump | u8 | PDA bump seed |
Ticket (nested)
| Field | Type | Description |
|---|---|---|
name | String | Ticket tier name |
price | u64 | Price per ticket |
available | u64 | Remaining tickets |
PurchasedTickets
| Field | Type | Description |
|---|---|---|
ticket_name | String | Tier purchased |
price | u64 | Price paid per ticket |
quantity | u64 | Number of tickets purchased |
date_of_purchase | i64 | Unix timestamp of purchase |
bump | u8 | PDA bump seed |
PDA Derivation
venue
seeds = [b"venue", venue_id]
ticket (purchase receipt)
seeds = [b"ticket", venue_id, buyer]
Error Codes
InvalidTicketName
The ticket tier name does not exist on this venue
TicketsNotAvailable
Insufficient tickets remaining for the requested quantity
InvalidSub
Arithmetic underflow/overflow
Usage Example
import { getProgram, findVenuePda, findTicketPda } from "./src"; const ticketing = getProgram("ticketing", provider); // Create a venue const venueId = "solana-hacker-house-2026"; const [venuePda] = findVenuePda(venueId); await ticketing.methods .createVenue(venueId) .accounts({ venueAccount: venuePda, authority: wallet.publicKey, tokenMint, tokenAccount }) .rpc(); // Add VIP tickets at 10 USDC each, 100 available await ticketing.methods .createTickets(venueId, "VIP", new BN(10_000_000), new BN(100)) .accounts({ venueAccount: venuePda, owner: wallet.publicKey }) .rpc(); // Purchase 2 VIP tickets const [ticketPda] = findTicketPda(venueId, buyer.publicKey); await ticketing.methods .purchaseTickets(venueId, "VIP", new BN(2)) .accounts({ venueAccount: venuePda, buyerAccount: ticketPda, buyer: buyer.publicKey }) .rpc();