Ticketing

On-chain concert venue and ticket management with SPL token payments

Pending Anchor 0.32
Program ID 2bmGLNZ1dXFiWcS7x8DffzQVHUuPhhJ4vRKLw2SSdBNB
Cluster Devnet

Instructions

IX create_venue

Creates a new venue PDA that holds ticket inventory and payment configuration.

ParameterTypeDescription
venue_idStringUnique 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.

ParameterTypeDescription
venue_idStringVenue identifier
ticket_nameStringName of the ticket tier (e.g. "VIP", "General")
priceu64Price per ticket in token base units
available_ticketsu64Total 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.

ParameterTypeDescription
venue_idStringVenue identifier
ticket_nameStringName of the ticket tier to purchase
quantityu64Number of tickets to buy

Accounts

Venue

FieldTypeDescription
ownerPubkeyVenue owner wallet
available_ticketsVec<Ticket>Array of ticket tiers
token_mintPubkeySPL token mint for payments
owner_token_accountPubkeyVenue owner's token account for receiving payment
bumpu8PDA bump seed

Ticket (nested)

FieldTypeDescription
nameStringTicket tier name
priceu64Price per ticket
availableu64Remaining tickets

PurchasedTickets

FieldTypeDescription
ticket_nameStringTier purchased
priceu64Price paid per ticket
quantityu64Number of tickets purchased
date_of_purchasei64Unix timestamp of purchase
bumpu8PDA 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();