
Draw the winners
Choose how many winners, then draw. The page shows the winners and a link that lets anyone re-run the draw.
- Duplicates count once and the page tells you how many it removed
- Order does not matter
- Up to 10,000 entries and 100 winners
DogeJS / Doge on X / Giveaway picker
Tipping the replies? Paste the names, draw the winners, and show everyone the draw was fair.
Free, no account, nothing leaves your browser. For developers: the docs

What you get

Choose how many winners, then draw. The page shows the winners and a link that lets anyone re-run the draw.

Get a picture with the winners and the fingerprint of the draw, ready to attach.

Readers open your check link, paste the same list, and get the same winners. A green result means the draw was fair.

First post the fingerprint, before entries close. After the draw, post the winners with the check link.

Post the fingerprint before entries close.

The winners and a check link appear.

Anyone can re-run the draw and compare.
The host cannot pick a seed after seeing the list, because its fingerprint was posted first. The host does choose who is on the list, so post the list or say where it came from.
No. Entries are cleaned and sorted before the draw.
Duplicates count once; the page says how many it removed.
No. It writes a payout file when the winners are addresses; you pay with your wallet.
Up to 10,000 entries and 100 winners.
No. Copy the names of the people who replied and paste them in.
No. DogeJS is an independent project and is not affiliated with X Corp. The tools only open X's own post box with the text filled in; you press Post yourself.
For developers
Commit, draw and reveal, the exact algorithm, and how to re-run a draw with or without DogeJS code.
@name lower case, or an address), de-duplicated and sorted, so the order they were pasted in does not matter. The list fingerprint is SHA-256 of the ids joined with "\n". The key is SHA-256 of seed + "\n" + list fingerprint. A stream of 32-bit numbers comes from SHA-256(key || counter), counter as 4 big-endian bytes, starting at 0. Position i takes i + below(n - i) (partial Fisher-Yates), where below(n) rejects numbers at or above floor(2^32 / n) * n to avoid modulo bias./x/giveaway/#c~<seed>~<count>~<first 16 of the list fingerprint>. Anyone pastes the same replies and gets the same winners; the page says if the list differs.The host can still choose who is on the list. The draw shows the winners follow from a seed fixed in advance, and that the list was the one shown.
The check link holds the seed, the number of winners and the first 16 hex characters of the list fingerprint: https://dogejs.com/x/giveaway/#c~<64 hex>~<count>~<16 hex>. The list is not in the link (it can be long); the checker pastes it.
The package is @dogejs/xkit. It is not on npm yet: install it from its repository tag, then import the helpers. They are plain functions with no DOM at module level, so they run in Node 20+, in browsers and in workers.
npm install github:DogeJS-Dev/doge-on-x#v0.2.0import { tipLink, decodeLink, checkProof, draw, postIntentUrl } from '@dogejs/xkit';Run draws from a bot or a script with parseEntries, commitment and draw; let anyone check them with verifyDraw or the independent script below.
Each example runs in Node against the built package; the output is recorded from that run and checked by npm run examples.
Commit, paste replies, draw, make the check link, and verify it like a reader would. File examples/draw.mjs; run: node examples/draw.mjs.
// Reproduce a giveaway draw: commit, draw, reveal, check.
import { commitment, draw, encodeCheck, parseEntries, verifyDraw } from '@dogejs/xkit';
const seed = '7f3a9c51e2d84b06a1f0c3e5d7b9a2c4e6f8091b3d5f7a9c0e2b4d6f8a1c3e5d'; // newSeed() makes a random one
console.log('post first:', commitment(seed)); // the fingerprint, posted before entries close
const replies = `@shibe_one wow count me in
@Shibe_Two
much want @shibe_three and @shibe_four
@shibe_one again`;
const { entries, duplicates } = parseEntries(replies);
console.log(entries.map((e) => e.id).join(' '), '| duplicates:', duplicates);
const result = draw(seed, entries, 2);
console.log('winners:', result.winners.map((w) => w.id).join(', '));
console.log('check link: https://dogejs.com/x/giveaway/#' + encodeCheck(seed, 2, result.listHash));
// Anyone re-runs it from the revealed seed, the posted fingerprint and the same replies:
const check = verifyDraw({ seed, entries: replies, count: 2, commit: commitment(seed), listPrefix: result.listHash.slice(0, 16) });
console.log(check.ok, check.commitMatches, check.listMatches, check.winners.map((w) => w.id).join(', '));post first: 4793e416d06cf6ce7aa520374bb4d0870f7d0ab7f714bfa2620ed670cb63eacd
@shibe_four @shibe_one @shibe_three @shibe_two | duplicates: 1
winners: @shibe_three, @shibe_two
check link: https://dogejs.com/x/giveaway/#c~7f3a9c51e2d84b06a1f0c3e5d7b9a2c4e6f8091b3d5f7a9c0e2b4d6f8a1c3e5d~2~f5df1be1e4ae0223
true true true @shibe_three, @shibe_twoThe whole algorithm with Node's own crypto: the same winners as above. File examples/draw-independent.mjs; run: node examples/draw-independent.mjs.
// Re-run a DogeJS giveaway draw with no DogeJS code at all: Node's own crypto only.
import { createHash } from 'node:crypto';
const sha = (data) => createHash('sha256').update(data).digest();
const seed = '7f3a9c51e2d84b06a1f0c3e5d7b9a2c4e6f8091b3d5f7a9c0e2b4d6f8a1c3e5d';
const ids = ['@shibe_four', '@shibe_one', '@shibe_three', '@shibe_two']; // cleaned: "@" + lower case, de-duplicated
const count = 2;
ids.sort(); // code-unit order
console.log('seed fingerprint', sha(seed).toString('hex')); // = printf %s SEED | sha256sum
const listHash = sha(ids.join('\n')).toString('hex');
const key = sha(`${seed}\n${listHash}`);
let block = Buffer.alloc(0), pos = 0, counter = 0;
function u32() { // SHA-256 in counter mode
if (pos + 4 > block.length) {
const c = Buffer.alloc(key.length + 4);
key.copy(c); c.writeUInt32BE(counter++, key.length);
block = sha(c); pos = 0;
}
const v = block.readUInt32BE(pos); pos += 4; return v;
}
function below(n) { // rejection sampling, no modulo bias
const limit = Math.floor(2 ** 32 / n) * n;
for (;;) { const v = u32(); if (v < limit) return v % n; }
}
const pool = ids.slice();
for (let i = 0; i < Math.min(count, pool.length); i++) { // partial Fisher-Yates
const j = i + below(pool.length - i);
[pool[i], pool[j]] = [pool[j], pool[i]];
}
console.log('list fingerprint', listHash.slice(0, 16));
console.log('winners:', pool.slice(0, count).join(', '));seed fingerprint 4793e416d06cf6ce7aa520374bb4d0870f7d0ab7f714bfa2620ed670cb63eacd
list fingerprint f5df1be1e4ae0223
winners: @shibe_three, @shibe_twoWhen winners are addresses: a CSV for the DogeJS Wallet's Pay many or the command line. The page itself pays nothing. File examples/payout.mjs; run: node examples/payout.mjs.
// Winners that are addresses -> a payout file for the DogeJS Wallet (Pay many) or the dogejs command line.
import { draw, parseDoge, parseEntries, payoutCsv } from '@dogejs/xkit';
const entries = parseEntries('DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L\nnUCAGGgZEPN1QyknmQe1oAku817bQAFKFt\n@shibe_one').entries;
const { winners } = draw('ab'.repeat(32), entries, 3);
const rows = winners.filter((w) => w.kind === 'address').map((w, i) => ({ address: w.id, koinu: parseDoge('25'), label: `giveaway winner ${i + 1}` }));
process.stdout.write(payoutCsv(rows));address,amount,label
DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L,25,giveaway winner 1
nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt,25,giveaway winner 2The exports this page uses. The full list is on the Doge on X developer page.
| Export | Returns | What it does |
|---|---|---|
newSeed(rand?) | string | 32 random bytes as 64 hex characters (crypto.getRandomValues). |
commitment(seed) | string | The fingerprint to post first: SHA-256 of the 64 hex characters (as printf %s SEED | sha256sum). |
revealMatches(seed, commit) | boolean | Does a revealed seed match the posted fingerprint? |
parseEntries(text) | { entries, invalid, duplicates } | One entry per line, or every @name and address found in a pasted reply; handles lower-cased with "@"; de-duplicated; sorted. |
listFingerprint(entries) | string | SHA-256 of the sorted ids joined with "\n". |
draw(seed, entries, count) | { winners, listHash, commit } | Deterministic, order-independent draw (see the algorithm above). At most 100 winners. |
verifyDraw({ seed, entries, count, commit?, listPrefix? }) | DrawCheck | Re-runs a draw like a checker and compares the seed and list fingerprints. Never throws. New in 0.2.0. |
encodeCheck(seed, count, listHash), decodeCheck(fragment) | string; object | null | The check link fragment c~seed~count~list16. |
HashStream | class | SHA-256 counter-mode stream; below(n) gives a uniform integer by rejection sampling. |
isSeed, sha256Hex, hex, MAX_ENTRIES, MAX_WINNERS | Helpers and limits (10,000 entries, 100 winners). |
| Export | Returns | What it does |
|---|---|---|
payoutCsv(rows) | string | address,amount,label lines for Pay many and the command line; labels escaped against spreadsheet formulas. |
parseDoge(text) | bigint | null | "25", "2.5" or "2,5" DOGE to koinu (at least 0.01 DOGE). |
dogeDecimal(koinu), csvEscape(value) | string | Plain decimal DOGE; one escaped CSV field. |
CSV_HEADER, MIN_KOINU, MAX_KOINU | 'address,amount,label', 1000000n, 10 billion DOGE. |
| Export | Returns | What it does |
|---|---|---|
tipLink(record, base?) | string | base + /x/t/# + fragment; base defaults to https://dogejs.com. |
proofLink(record, base?) | string | base + /x/proof/# + fragment. |
bioLine(record, base?) | string | Tips in Dogecoin: dogejs.com/x/t/#..., always without the proof so it stays short. |
pinnedPost(), proofPost(handle, address), pricePost(headline, line), wowPost(line), profilePost(), lockPost(commit, entries), winnersPost(winners, commit) | string | The texts the pages prefill in the composer; each stays under 240 with its link. |
SITE, PAGES | 'https://dogejs.com', { hub, tip, tipPage, proof, price, wow, profile, giveaway } | The site and the page paths. |
Everything is static files. The page scripts are built from DogeJS-Dev/doge-on-x; the HTML and CSS of the pages are in DogeJS-Dev/website under site/x/.
git clone https://github.com/DogeJS-Dev/doge-on-x
cd doge-on-x
npm install
npm run build # dist/x-tip.js, x-t.js, x-proof.js, x-price.js, x-wow.js, x-profile.js, x-giveaway.js
npm test # unit tests
npm run examples # runs every example on this page and compares its outputsite/x/ from the website repository (the product page of each tool is x/<tool>/, the tool itself x/<tool>/app/), with ui.css, apps.css, styles.css, site.js, pay.js (tip pages) and signin.js (proof page) from the site root, and the images the pages name.dist/x-*.js next to the pages as site/x/x-*.js.What changes on your own host: the pages write links for the host they are served from (so your tip links point to your copy), and proofs are signed for your host. A proof page accepts proofs signed for dogejs.com and for its own host, nothing else. To make another host the default for links built in code, pass it as the base argument of tipLink, proofLink and bioLine, and the hosts you accept as allowedHosts of checkProof.