Skip to main content

Concert Tickets Example

This tutorial demonstrates how to use the Webdeeds API to create, distribute, and manage concert tickets.

Scenario

Alice's band 'Alice Unchained' is performing at a venue and needs to create and distribute tickets to their fans.

Step 1: Minting 100 Tickets

First, Alice mints 100 general admission tickets using the /v1/mint endpoint. The mint request uses a placeholder ("PLACEHOLDER") because the server generates the actual deed id.

Mint Request

{
"metadata": "General Admission Tickets for Alice's Live Show",
"outputs": ["+100.PLACEHOLDER.ticketSecretA"]
}

Mint Response

{
"itemId": "deed_2samLx0gNPgbb6o3JxKMSWSzz3E",
"outputs": ["+100.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretA"]
}

Note: The server generates a unique, permanent identifier for this batch of tickets: deed_2samLx0gNPgbb6o3JxKMSWSzz3E

Step 2: Alice Splits the Tickets

Now Alice wants to sell 10 tickets to Bob. She performs a swap on her minted output to split the 100-ticket token into two parts:

  • A 10-ticket output with secret ticketSecretB that she will later send to Bob
  • A 90-ticket output with secret ticketSecretC that she keeps

Swap Request (Alice splits the token)

{
"inputs": ["+100.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretA"],
"outputs": [
"+10.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretB",
"+90.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretC"
]
}

Swap Response

{
"success": true
}

Step 3: Out-of-Band Transfer

Alice now sends the 10-ticket output with secret ticketSecretB to Bob over a secure communication channel (iMessage, Signal, etc.).

The transfer looks like this:

+10.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretB

Step 4: Bob Secures Custody

Upon receiving the 10-ticket deed, Bob needs to secure his ownership. He does this by performing his own swap to update the secret. This ensures that only Bob knows the final secret for his tickets.

Swap Request (Bob updates the secret)

{
"inputs": ["+10.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretB"],
"outputs": ["+10.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretD"]
}

Swap Response

{
"success": true
}

After this swap, Bob controls 10 tickets with the secret ticketSecretD that only he knows.

Important: A transfer is not complete until the receiver swaps to outputs with secrets that only they know. Otherwise, the sender can reclaim the outputs.

Step 5: Redeeming Tickets

When Bob arrives at the concert venue, he can prove ownership of his tickets by presenting the output:

+10.deed_2samLx0gNPgbb6o3JxKMSWSzz3E.ticketSecretD

The venue can verify the validity of the tickets by checking that:

  1. The deed ID (deed_2samLx0gNPgbb6o3JxKMSWSzz3E) is legitimate
  2. The secret (ticketSecretD) is valid

Summary

This tutorial demonstrated:

  1. Minting: Creating 100 tickets with associated metadata
  2. Splitting: Dividing the tickets into smaller amounts
  3. Transferring: Sending tickets to a buyer securely
  4. Securing custody: The buyer updating the secret to claim exclusive ownership
  5. Redeeming: Using the tickets at the venue