Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Make a Giveaway Draw Verifiable With 10 Lines of Code

A commit-reveal draw lets entrants check a published seed commitment and reproduce a winner from a frozen entrant list. Here’s a compact Node.js example and what it cannot prove.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A provably fair giveaway lets entrants check that the organizer committed to a secret before the draw inputs were fixed, then reproduce the published result after the secret is revealed. The code below is a compact Node.js example of that idea—not a complete giveaway system. It assumes the entrant list and rules have already been frozen and that everyone agrees on how the draw maps a cryptographic value to a winner.

What a verifiable giveaway can—and cannot—prove

A commit-reveal draw starts with a secret server seed. Before the remaining inputs are fixed, the organizer publishes the seed’s SHA-256 hash. After entries close and the entrant list is frozen, the organizer calculates the result using the secret and the agreed inputs, then reveals the seed. Entrants can hash the revealed seed to check the commitment and rerun the documented calculation to check the result. Changing the seed after publishing its hash would produce a different hash.

As an Amazon Associate I earn from qualifying purchases.

This establishes a narrow, useful guarantee: the disclosed seed matches the earlier commitment, and the published result follows from the disclosed inputs and algorithm. It does not prove that the organizer included every eligible entrant, applied the rules fairly, or will award the prize. Those parts require transparent procedures and evidence outside the cryptographic calculation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What to publish before entries close

Post the commitment and draw rules somewhere participants can access before the draw inputs are finalized. To make independent replay possible, publish:

#1 Best Overall
Sale
LLIKED Blue Raffle Tickets 2" x 2", Double Roll, 1000 Pairs/Roll
  • Each Raffle Tickets Roll has 1000 Pairs(2000 pcs) double stub raffle tickets with consecutive numbering, designed with perforated lines for easy separation, saving you time and effort.
  • Each double stub raffle tickets measures 2x2 inches and split Into 2 X 1 inch halves.
  • The back of the "ticket" part has a place for Name/Address/City/Phone
  • With a deposit ticket and keep ticket
  • Perfect for a wide range of events including carnivals, school fundraisers, class rewards, and prize drawings.
  • The SHA-256 commitment to the server seed.
  • The entry cutoff, eligibility rules, and handling of duplicate or invalid entries.
  • The ordered entrant list, or a digest together with an accessible method for checking the exact list.
  • The number of winners and the precise algorithm, including how it maps a digest to an entrant index.

Freeze the entrant list and rules before calculating the outcome. A seed cannot make a draw auditable if participants cannot establish which list and rules were used.

A compact Node.js commit-and-reveal example

This 10-line example uses only Node.js’s built-in crypto module. It derives a deterministic pseudorandom stream by hashing the seed and a counter, then uses rejection sampling to select an unbiased index. It assumes entries is the already-frozen, ordered array of eligible entrants and that the organizer has securely retained serverSeed. Publish the hash of that seed before fixing the rest of the draw inputs; after the draw, reveal the seed and publish the list and result so entrants can rerun the calculation.

Rank #2
Sale
Tacticai 1000 Raffle Tickets, 50/50 Double Roll, Blue
  • MULTIPURPOSE EVENT TICKETS – These raffle tickets rolls can be used for all types of events including fundraising, door admittance, drink or food options, carnival rides, large baby showers, parking, and other fun and engaging ideas.
  • RAFFLE OPTIONS & EASY TEAR – Each roll contains 1,000 tickets. The double roll providing matching numbers for deposits and reference use with quick contact writing option. The perforations make it easy to tear them off. Discover the ultimate ticket size for convenience and functionality with our 2" x 1.75" ticket, which can be split into two 1.75” x 1” halves. Its compact design is perfect for holding in your hand, wallet, or pocket, making it the ideal choice for all your events.
  • BRIGHT AND VIBRANT COLORS – Tacticai colored raffle tickets come in a wide variety of brilliant colors including blue, green, orange, purple, red, white, yellow, and pink. All to match your individual event, event date, or party theme.
  • BACK WRITABLE TICKET SURFACE – On the back, you’ll find the ticket has a place where guests or attendees can write their contact information, so you can reach out to them if they’ve won a prize or require follow-up information.
  • CONSECUTIVELY NUMBERED – Each roll of tickets for raffle and event use features numbers completely in order to make it easier to separate them and stay organized if you’re holding a raffle, fundraiser, or special event. You will receive a random series of numbers with no duplicates when you purchase multiple rolls.
const { createHash, randomBytes } = require('node:crypto');
const serverSeed = randomBytes(32).toString('hex');
const commit = createHash('sha256').update(serverSeed).digest('hex');
// Publish commit before the entrant list and other draw inputs are fixed.
const entries = ['entrant-1', 'entrant-2', 'entrant-3']; // frozen ordered list
const n = entries.length, limit = Math.floor(2 ** 32 / n) * n;
let i = 0, x;
do { const h = createHash('sha256').update(`${serverSeed}:${i++}`).digest(); x = h.readUInt32BE(0); } while (x >= limit);
const winnerIndex = x % n;
console.log({ commit, winner: entries[winnerIndex], winnerIndex });

The rejection step discards values at or above limit. That keeps the accepted 32-bit values evenly divisible across the number of entries; simply taking a digest value modulo the entrant count without this check can favor some indices when the range does not divide evenly. This example uses a single seed and counter-based SHA-256 derivation rather than a standardized giveaway protocol. For a real draw, document the exact code or algorithm, input encoding, list order, and output format so independent implementations agree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The sample’s illustrative entrant names are not a real participant list. Replace them with the exact frozen list and make that list available to entrants. A public commitment alone does not reveal or authenticate the list.

Rank #3
XXINMOH 4000 Pairs Double Raffle Tickets – 4 Assorted Colors (Pink, Blue, Red, Purple) – 1000 Pairs per Roll for Carnival, Fundraiser, Party, Event, Classroom, Lottery Drawing Prize Tickets for Raffle
  • Assorted Colors for Any Event: This XXINMOH raffle ticket set includes 4 assorted colors: pink, blue, red, and purple – 1,000 double raffle tickets per color, totaling 4,000 pairs (8,000 single tickets). Perfect for carnivals, fundraisers, parties, events, or classroom use. The vibrant colors make it easy to organize different prize categories or ticket types for your lottery drawing or raffle.
  • Double Roll Design for Easy Use: Each roll features a double ticket design that allows for quick tear-off and simple distribution. Whether you're hosting a carnival, school activity, or fundraiser, these raffle tickets streamline the process of handing out entries. The double format gives you a matching stub for each ticket – ideal for keeping track of participants and ensuring a fair drawing.
  • Durable & High-Quality Material: Made from sturdy paper stock, these lottery drawing prize tickets are built to withstand frequent handling without tearing or fading. Unlike flimsy alternatives, our raffle tickets hold up well whether you're using them for a food booth, meal event, or week-long carnival. Reliable and long-lasting – even for bulk use.
  • Convenient Roll Format for Bulk Use: Each roll contains 1,000 pairs of tickets, making this set ideal for bulk events and large gatherings. The compact roll format allows for easy storage and transport, so you can grab a roll whenever you need it. Perfect for classroom teachers, event planners, and fundraiser organizers who need tickets para rifas ready to go at a moment's notice.
  • Versatile for Endless Occasions: From carnival games and party raffles to classroom rewards and fundraiser drawings, these raffle tickets work for almost any occasion. Use them for lottery-style prize giveaways, event entry tracking, or even as simulated tickets for custom game setups. Whether you need single or double rolls, this XXINMOH set delivers reliability and value for all your drawing and prize needs.

How entrants verify the draw

  1. Check that the commitment was published before the entrant list and other draw inputs were finalized.
  2. After the organizer reveals the server seed, calculate its SHA-256 hash and compare it with the published commitment.
  3. Use the published ordered entrant list and the exact algorithm to recompute the selected index and winner.
  4. Check that the published winner corresponds to that index and that the revealed inputs match the announced cutoff and eligibility rules.

For the example, the verification implementation must use the same UTF-8 string format, counter starting at zero, first four digest bytes interpreted as a big-endian unsigned integer, and rejection condition. Otherwise, two implementations could disagree even when both use SHA-256.

Why not use Node.js randomInt for this draw?

Node.js documents crypto.randomInt(min, max) as returning an integer with an inclusive lower bound and exclusive upper bound while avoiding modulo bias. Its bounds must be safe integers, and the range must be less than 248. But an ordinary call to randomInt is not seeded for replay: entrants cannot reproduce its output from a later-revealed secret. A replayable draw needs a specified deterministic derivation and unbiased mapping, as in the example’s counter hash and rejection step. See the Node.js Crypto documentation v26.8.1.

Rank #4
Sale
LLIKED Red Raffle Tickets 2" x 2", Double Roll, 1000 Pairs/Roll
  • Each Raffle Tickets Roll has 1000 Pairs(2000 pcs) double stub raffle tickets with consecutive numbering, designed with perforated lines for easy separation, saving you time and effort.
  • Each double stub raffle tickets measures 2x2 inches and split Into 2 X 1 inch halves.
  • The back of the "ticket" part has a place for Name/Address/City/Phone
  • With a deposit ticket and keep ticket
  • Perfect for a wide range of events including carnivals, school fundraisers, class rewards, and prize drawings.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a hosted commit-reveal API may fit

A hosted service can provide commitment and reveal endpoints, but its workflow is a particular implementation, not a universal requirement. Provable.IO’s API reference documents a commit endpoint that returns a commitment ID and server hash, followed by a single-use reveal request with the client seed and generation parameters. The reference lists a default commitment TTL of 10 minutes; confirm the service’s current documentation and constraints before relying on that value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Provable.IO provable-core repository describes an HMAC-SHA256 scheme in which the server seed is the key and the message includes a client seed, nonce, and round number. The nonce distinguishes outcomes under the same seed, while the round number permits additional digest blocks when needed. Anyone with the revealed server seed and the other inputs can reproduce the calculation. The Provable.IO getting started guide also describes a commit-reveal workflow and replay instructions.

Best Value
Golden Tickets 1 Roll 1000 Metallic Foil Raffle Tickets for Events, Carnivals, Contests, Entry Prizes & Class Rewards (Golden)
  • Large quantities of tickets to meet all event needs Includes 1000 Golden Tickets metallic foil tickets, perfect for events, raffles, carnivals, competitions, and more, ensuring you have ample tickets for large-scale occasions.
  • Exquisite Golden Tickets metallic foil design Each ticket features Golden Tickets metallic foil material with a brilliant sheen and premium texture, perfect for luxury prizes, event tickets, or admission passes to elevate your event's sophistication.
  • Dual-roll design for effortless distribution Each pack includes two rolls of tickets for convenient distribution and management. Each roll contains 1,000 tickets, allowing for organized storage and use to save time and effort.
  • Versatile for Any Occasion Whether for corporate events, community fairs, school reward programs, or any setting requiring prizes or admission passes, these Golden Tickets raffle tickets meet your needs.
  • High-Quality, Durable, and Eco-Friendly Crafted from premium metallic foil, the tickets are sturdy, tear-resistant, and built to last. Each ticket undergoes meticulous finishing to ensure smooth event execution.

Whether you self-host or use an API, ensure the public record gives entrants the inputs needed to verify the commitment and reproduce the result. A provider’s endpoint workflow does not, by itself, settle whether the entrant list was complete or the rules were followed.

Quick Recap

SaleBestseller No. 1
LLIKED Blue Raffle Tickets 2' x 2', Double Roll, 1000 Pairs/Roll
LLIKED Blue Raffle Tickets 2" x 2", Double Roll, 1000 Pairs/Roll
Each double stub raffle tickets measures 2x2 inches and split Into 2 X 1 inch halves.; The back of the "ticket" part has a place for Name/Address/City/Phone
$7.95
SaleBestseller No. 4
LLIKED Red Raffle Tickets 2' x 2', Double Roll, 1000 Pairs/Roll
LLIKED Red Raffle Tickets 2" x 2", Double Roll, 1000 Pairs/Roll
Each double stub raffle tickets measures 2x2 inches and split Into 2 X 1 inch halves.; The back of the "ticket" part has a place for Name/Address/City/Phone
$7.99

Operational safeguards beyond the code

  • Keep the unrevealed seed private until the draw; disclose it afterward so participants can check the commitment.
  • Publish the commitment early enough that entrants can see it before the remaining draw inputs are fixed.
  • Preserve the exact ordered entrant list, rules, commitment, revealed seed, and result record.
  • Explain how to report a mismatch and who will resolve disputes; cryptography cannot compel the organizer to honor the result.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.