Tournament Builder

Tournament Builder Integration Workflow#

This guide outlines the step-by-step process for integrating with the Tournament Builder developed for Forge Digital Ventures. For technical details of the architecture, see the Overview document.

This workflow assumes you have already set up your development environment and have the necessary credentials to access the Anvil API.

1. Tournament Creation#

  1. Prepare Tournament Configuration

    • Define bracket size, entry fees, and payout structure
    • Identify administrator address
    • Gather UTXOs for transaction fees
  2. Create Tournament Transaction

  3. Sign and Submit Transaction

    • Sign the transaction with appropriate keys
    • Submit the signed transaction (see Transaction Overview for details)

    When successful, the tournament is created and an NFT is minted to represent it on-chain. The tournament is now ready to accept registrations.

// 1. Configure tournament parameters
const tournamentConfig = {
  name: "Tournament Name",
  adminAddress: "addr1...",
  bracketSize: 16,
  entryFee: "10000000", // 10 ADA in lovelace
  payoutStructure: ["7000000", "2000000", "1000000"],
  utxos: ["1234...#0", "5678...#1"]
};

// 2. Create tournament transaction
const response = await fetch("/tournaments", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(tournamentConfig)
});
const { transaction } = await response.json();

// 3. Sign and submit transaction
// See Transaction Overview documentation for details: ../guides/transaction/README.md
const signedTx = await signTransaction(transaction);
const submitResponse = await fetch("/tournaments/submit-tx", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ transaction: signedTx })
});
const { txHash } = await submitResponse.json();

console.log("Tournament created with transaction:", txHash);

2. Registration Management#

The Tournament Builder uses a two-phase registration process:

  1. Participants self-register (creating registration UTXOs)
  2. Tournament administrator collects these registrations and officially adds participants

Phase 1: Participants Register#

  1. Participant Initiates Registration

  2. Verification

  3. Optional: Registration Cancellation

Phase 2: Tournament Administrator Adds Participants#

  1. Collect Registration Outputs

  2. Add Participants to Tournament

Phase 3: Tournament Settlement#

  1. Finalize Participant List

  2. Conduct Tournament

  3. Submit Results