Skip to content

Raffles

The RaffleSDK and RaffleFactorySDK manage on-chain raffles powered by Algorand’s VRF (Verifiable Random Function) beacon.

Raffles use the Algorand VRF Randomness Beacon to select winners. This ensures provably fair, tamper-proof random selection.

  1. Created — Raffle is set up with prize, ticket price, and duration
  2. Open — Users purchase tickets (entries)
  3. Drawing — VRF beacon is called to select a winner
  4. Complete — Winner claims the prize
import { RaffleSDK, RaffleFactorySDK } from '@akta/sdk/raffle'
const raffleFactory = new RaffleFactorySDK({ algorand })
// Interact with an existing raffle
const raffle = new RaffleSDK({
algorand,
factoryParams: { appId: raffleAppId },
})
const raffle = await raffleFactory.newRaffle({
prizeAsset: nftAssetId,
prizeAmount: 1n,
ticketAsset: 0n, // Tickets cost ALGO
startTimestamp: BigInt(Math.floor(Date.now() / 1000)),
endTimestamp: BigInt(Math.floor(Date.now() / 1000) + 86400), // 24h
minTickets: 10n,
maxTickets: 100n,
name: 'My NFT',
proof: merkleProof,
marketplace: marketplaceAddr,
gateId: 0n, // No gate
weightsListCount: 0n, // Even odds
})
  • Fair randomness — VRF beacon ensures provably random winner selection
  • Configurable pricing — Set ticket price and maximum entries
  • Time-limited — Raffles have configurable duration
  • Double-sided fees — Both listing and purchasing platforms can take fees
  • DAO fees — Raffle creation and entry fees controlled by governance

Raffle operations through a wallet use the RafflePlugin. See Wallet Plugins.