DogeJS / Doge on X

Doge on X

Dogecoin tools for X. No account, no API, no server.

  • A tip page on a phone: the X account with a green Proof badge, amounts from 10 to 100 DOGE and a Tip 25 DOGE button.
    Fans tip from any wallet
  • A price card: A coffee is 80 DOGE. Much affordable.
    A price card to post
  • A proof check on a phone: a green check, Signed by this address, the X account and the Dogecoin address.
    Anyone can check the proof

Six simple tools

Each one does one thing and ends with a Post on X button. Free, and nothing to sign up for.

How it works without an API

  1. Everything lives in the link. Your name and address are written after the # in the link, so no server stores anything.
  2. X writes the post, you press Post. Our buttons open X with the text filled in. We never read or post anything for you.
  3. Images are made in your browser. Download or copy them, then attach them to your post.

For developers

Doge on X for developers

How the tools work without an API, the link and proof formats, the fair draw, and the @dogejs/xkit package with runnable examples.

How it works without an API

  1. Post-composer links

    Every "Post on X" button is an ordinary link to X's own composer, https://x.com/intent/post?text=...&url=.... X opens with the text filled in; the person reads it and presses Post. Nothing posts for anyone, and composer links cannot attach images, so the pages say "attach the image".

  2. Static preview cards

    Each page has fixed og: and twitter:card (summary_large_image) tags with a 1200x630 image. When a link is posted, X's crawler reads those tags; the part after # is never sent to it, so every tip link shows the same card.

  3. Data in the URL fragment

    A tip link or a proof carries its data after #. Browsers do not send that part to the server: the page reads it with JavaScript and checks it. There is no database and no account.

Who sees what

  • The DogeJS server serves the same static files to everyone and never receives the fragment.
  • X sees what you post: your bio line and your posts are public text, including the link and its fragment.
  • Keys stay in your wallet. The proof page asks your wallet to sign a sentence; it never asks for or keeps a key or recovery phrase.
  • Images are drawn in your browser. A photo for the avatar ring is read locally and never uploaded.
  • The price comes from CoinGecko's public price endpoint, read directly by your browser, with no key.

Proofs: format, checks and trust

A proof is a Sign in with Doge message whose statement is exactly I am @handle on X. My Dogecoin address is D...., signed by the address's key in the person's wallet. The signed text, for the test key in the example below:

Text
dogejs.com wants you to sign in with your Dogecoin address:
njrsdYxFzKyVfywip6LGRm6fYqTBRUi2wy

I am @dogejs_demo on X. My Dogecoin address is njrsdYxFzKyVfywip6LGRm6fYqTBRUi2wy.

URI: https://dogejs.com/x/proof/
Version: 1
Network: testnet
Nonce: a1b2c3d4e5f60718293a4b5c6d7e8f90
Issued At: 2026-11-28T16:00:00.000Z
Expiration Time: 2026-11-28T16:10:00.000Z

How a page checks it

  1. Read the link strictly (CRC, field rules).
  2. Refuse it unless its host is dogejs.com or the page's own host, and the address is a regular (P2PKH) address.
  3. Rebuild the exact text above from the fields: domain, address, statement, URI https://<host>/x/proof/, network, nonce, issued and expiry times.
  4. Verify the signature against the address with verifySignIn at the signing time (the expiry only limited the wallet request).
  5. Show the badge only when the signature checks and the link names the post that carries it.

Trust model

The signature can only be made with the address's key, and it ties the address to the words "I am @name on X". The post on that account shows the account agrees. X shows a post under /<any name>/status/<id>, so the pages tell readers to open the post and check it is on that account. A proof says who controlled the address and the account when it was signed; it says nothing about later.

Adversarial cases covered by the tests

AttemptWhat happens
Another key signs the same textbad_signature: the signature recovers another address.
Same signature, handle changed (even only its case)bad_signature: the rebuilt text differs.
A real proof for @alice replayed as @bobbad_signature.
Time, nonce, expiry or host changed in the linkbad_signature (or the CRC refuses the link first).
A valid proof signed for another websiteother_site: only dogejs.com (and the page's own host) are accepted.
Mangled or non-canonical signature, extra charactersRefused when the link is read; checkProof never throws.
Main network address with a test network proof (or the reverse)Refused: the network is part of the signed text.
A post link from another account, a look-alike host, user:password@, another portparsePostUrl refuses it.
The post id changed to another postThe signature still checks (the id is not signed), so the page shows the post and asks readers to check it is on that account.

The fair draw

  1. Commit. The page makes a random 32-byte seed and shows only its fingerprint, SHA-256 of the seed's 64 hex characters. The host posts the fingerprint before entries close, so the seed is fixed before anyone knows the list.
  2. Draw. Entries are cleaned (@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.
  3. Reveal. The host posts the seed and a check link /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.

Re-run a draw with no DogeJS code

Node's own crypto is enough. It gives the same winners as the page and as draw() in the example further down.

Independent re-run

The whole algorithm in 30 lines. File examples/draw-independent.mjs; run: node examples/draw-independent.mjs.

JavaScript
// 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(', '));
Output
seed fingerprint 4793e416d06cf6ce7aa520374bb4d0870f7d0ab7f714bfa2620ed670cb63eacd
list fingerprint f5df1be1e4ae0223
winners: @shibe_three, @shibe_two

The card renderer

All share images are drawn on a <canvas> in the browser by src/canvas.ts and the page scripts in src/pages/ (browser only, not part of the package's exports). The steps are the same for every card:

  1. Wait for the web fonts (fontsReady, at most 3.5 s), so the first image has the right letters.
  2. Load the site's own images (same origin, so the canvas can be exported).
  3. Measure and wrap text before drawing (fitText, fitLine, ellipsize): text never overflows; at the smallest size the last line ends with an ellipsis.
  4. Draw the X mark from the unmodified logo path (drawX, uniform scale only), QR codes with qrcode-generator (drawQr).
  5. Export a PNG with toBlob for Download, and ClipboardItem for Copy image where the browser supports it (the button is hidden otherwise).
CardSizePage
Price card1600 x 900/x/price/
Doge-speak meme (Classic, Shout, Cool)1600 x 900/x/wow/
Profile header (Gold, Night, Cream; optional QR)1500 x 500/x/profile/
Avatar with coin ring400 x 400/x/profile/
Giveaway winners1600 x 900/x/giveaway/

Draw a header yourself

A minimal version of the header kit with the plain Canvas API: the X path, a title that shrinks to fit, a PNG. File examples/header-canvas.html; run: Open it in a browser.

HTML
<!doctype html>
<meta charset="utf-8">
<title>Draw an X header in the browser</title>
<canvas id="c" width="1500" height="500" style="width:100%;max-width:750px"></canvas>
<pre id="out"></pre>
<script>
// The same steps as the header kit: fixed size, fonts first, text measured before drawing, PNG out.
// The X mark is the unmodified logo path (viewBox 0 0 1200 1227), only scaled and filled.
const X_PATH = 'M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z';

async function drawHeader(canvas, { title, handle }) {
  const ctx = canvas.getContext('2d');
  await document.fonts.ready;                               // the kit waits for its web fonts here
  ctx.fillStyle = '#FDC606';
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  // X mark, 160 px high, top-left at (90, 90)
  ctx.save();
  ctx.translate(90, 90);
  ctx.scale(160 / 1227, 160 / 1227);
  ctx.fillStyle = '#000';
  ctx.fill(new Path2D(X_PATH));
  ctx.restore();
  // the title shrinks until it fits 1000 px
  let size = 110;
  do ctx.font = `900 ${size}px system-ui, sans-serif`; while (ctx.measureText(title).width > 1000 && --size > 40);
  ctx.fillStyle = '#2F220C';
  ctx.fillText(title, 300, 230);
  ctx.font = '700 44px system-ui, sans-serif';
  ctx.fillText('@' + handle, 300, 320);
  return new Promise((resolve) => canvas.toBlob(resolve, 'image/png'));
}

drawHeader(document.getElementById('c'), { title: 'Dogecoin accepted here', handle: 'dogejs_demo' }).then((blob) => {
  const c = document.getElementById('c');
  document.getElementById('out').textContent = `${c.width}x${c.height} ${blob.type} ${blob.size > 10000 ? 'ok' : 'too small'}`;
});
</script>
Output
1500x500 image/png ok

Use it, embed 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.

Shell
npm install github:DogeJS-Dev/doge-on-x#v0.2.0
JavaScript
import { tipLink, decodeLink, checkProof, draw, postIntentUrl } from '@dogejs/xkit';

Link to the tools from your own site: they are plain links.

HTML
<!-- a tip button for your site: the same link as in your bio -->
<a href="https://dogejs.com/x/t/#1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e">Tip me in DOGE</a>

<!-- open the tip-jar maker with your details filled in -->
<a href="https://dogejs.com/x/tip/#1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e">Make my tip link</a>

The tip-jar maker reads a record after # and fills in the form (the proof page uses this to hand over a finished proof).

Code examples

Each example runs in Node against the built package; the output under it is recorded from that run and checked by npm run examples.

Build and read a tip-jar link

From a typed handle and an address to the link, the bio line and back. File examples/tip-link.mjs; run: node examples/tip-link.mjs.

JavaScript
// Build an X tip-jar link, the bio line, and read the link back.
import { addressNetwork, bioLine, decodeLink, encodeRecord, parseHandle, tipLink } from '@dogejs/xkit';

const handle = parseHandle('https://x.com/dogejs_demo'); // also "@dogejs_demo" or "dogejs_demo"
const address = 'DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L';
const record = { handle, address, network: addressNetwork(address) }; // "mainnet"

console.log(encodeRecord(record)); // the part after "#"
console.log(tipLink(record));      // the page fans open
console.log(bioLine(record));      // what goes in the X bio

const read = decodeLink(tipLink(record));
console.log(read.ok, read.record.handle, read.record.network);
Output
1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e
https://dogejs.com/x/t/#1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e
Tips in Dogecoin: dogejs.com/x/t/#1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e
true dogejs_demo mainnet

Create and verify a proof with a test key

Signs the proof text with a throwaway test-network key, as a wallet would, then checks it and a tampered copy. File examples/proof.mjs; run: node examples/proof.mjs.

JavaScript
// Create a proof with a test key (test network, no value) and verify it.
import { sha256 } from '@noble/hashes/sha256';
import { encodeWif, getNetwork, getPublicKey, p2pkhAddress, signMessage } from '@dogejs/core';
import { checkProof, decodeLink, hasProofBadge, proofLink, proofMessage } from '@dogejs/xkit';

// A throwaway key made from a public phrase: never use a key like this for real coins.
const net = getNetwork('testnet');
const priv = sha256(new TextEncoder().encode('dogejs docs example key, test network only'));
const wif = encodeWif(priv, { network: net });
const address = p2pkhAddress(getPublicKey(priv), net);

const record = {
  handle: 'dogejs_demo', address, network: 'testnet',
  proof: { host: 'dogejs.com', nonce: 'a1b2c3d4e5f60718293a4b5c6d7e8f90', issued: Date.UTC(2026, 10, 28, 16, 0, 0), expires: 600, signature: '', post: '' },
};
const message = proofMessage(record);            // the exact text the wallet signs
record.proof.signature = signMessage(message, wif); // what a wallet returns (base64, 88 characters)
console.log(message);

console.log(checkProof(record));                 // the signature checks out
console.log(hasProofBadge(record));              // false: no post id yet
record.proof.post = '1862001234567890123';       // the id of the post that carries the proof
const link = proofLink(record);
console.log(link.length, hasProofBadge(decodeLink(link).record));

// Change one letter of the handle: the same signature no longer matches.
console.log(checkProof({ ...record, handle: 'dogejs_dem0' }));
Output
dogejs.com wants you to sign in with your Dogecoin address:
njrsdYxFzKyVfywip6LGRm6fYqTBRUi2wy

I am @dogejs_demo on X. My Dogecoin address is njrsdYxFzKyVfywip6LGRm6fYqTBRUi2wy.

URI: https://dogejs.com/x/proof/
Version: 1
Network: testnet
Nonce: a1b2c3d4e5f60718293a4b5c6d7e8f90
Issued At: 2026-11-28T16:00:00.000Z
Expiration Time: 2026-11-28T16:10:00.000Z
{ ok: true, signedAt: 1795881600000, host: 'dogejs.com' }
false
245 true
{ ok: false, reason: 'bad_signature' }

Reproduce a giveaway draw

Commit, paste replies, draw, make the check link, and verify it like a reader would. File examples/draw.mjs; run: node examples/draw.mjs.

JavaScript
// 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(', '));
Output
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_two

Build a post-composer link

Text plus link, counted like X counts it; a post that would not fit is refused. File examples/composer.mjs; run: node examples/composer.mjs.

JavaScript
// Build a post-composer link: X opens with the text filled in, the person presses Post.
import { addressNetwork, pinnedPost, postIntentUrl, tipLink, xLength } from '@dogejs/xkit';

const address = 'DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L';
const url = tipLink({ handle: 'dogejs_demo', address, network: addressNetwork(address) });
const text = pinnedPost();

console.log(text);
console.log('counts as', xLength(text, 1), 'of 280'); // X counts every link as 23
console.log(postIntentUrl({ text, url }));

try {
  postIntentUrl({ text: 'wow '.repeat(80) });
} catch (e) {
  console.log('refused:', e.message);
}
Output
Tip me in Dogecoin 🐕 Pick an amount, pay from any Dogecoin wallet. Much thanks. Wow. #Dogecoin
counts as 119 of 280
https://x.com/intent/post?text=Tip%20me%20in%20Dogecoin%20%F0%9F%90%95%20Pick%20an%20amount%2C%20pay%20from%20any%20Dogecoin%20wallet.%20Much%20thanks.%20Wow.%20%23Dogecoin&url=https%3A%2F%2Fdogejs.com%2Fx%2Ft%2F%231%7Edogejs_demo%7EDH5yaieqoZN36fDVciNyRueRGvGLR3mr7L%7E7a2ff36e
refused: post too long

API reference

Every export of @dogejs/xkit 0.2.0, by source file.

Text src/text.ts

ExportReturnsWhat it does
cleanText(input)stringOne line of plain text: hidden, control and bidirectional characters and < > removed, spaces collapsed, NFC. Used on everything taken from a link or a person.
clipText(s, max)stringCuts to at most max user-visible characters (an emoji is never split) and adds an ellipsis when cut.
graphemes(s)string[]User-visible characters (Intl.Segmenter when present).
codePoints(s)numberNumber of Unicode code points.
groupDigits(digits)string"1234567" to "1,234,567".

Check digits src/crc.ts

ExportReturnsWhat it does
crc32(bytes)numberCRC-32 (IEEE) of bytes.
crcHex(s)stringCRC-32 of the UTF-8 bytes of s as 8 lowercase hex digits: the last field of a link. Catches cut or garbled links; it is not a signature.

Handles and post links src/handle.ts

ExportReturnsWhat it does
parseHandle(input)string | nullReads "@name", "name", "x.com/name" or "https://twitter.com/name" as a handle (1 to 15 of A-Z a-z 0-9 _), or null.
handleHint(input)stringA plain sentence saying what is wrong with a handle that is not valid yet.
sameHandle(a, b)booleanCompares two handles without case, as X does.
profileUrl(handle)stringhttps://x.com/<handle>
parsePostUrl(input, handle){ ok: true, id } | { ok: false, reason }Accepts only an https x.com or twitter.com status link whose path names the same handle (any case). Refuses look-alike hosts, user:password@, other ports and non-status paths.
postUrl(handle, id)stringhttps://x.com/<handle>/status/<id>
HANDLE_RERegExp/^[A-Za-z0-9_]{1,15}$/

Addresses src/address.ts

ExportReturnsWhat it does
addressNetwork(address)'mainnet' | 'testnet' | nullThe network of a valid Dogecoin address (checksum checked by @dogejs/core), or null.
addressHint(value)stringA plain sentence for an address that is not valid yet (too short, another coin, spaces...).
looksSecret(value)booleanTrue for a private key (WIF, hex), an extended private key or a recovery phrase. The pages clear such input and never keep it.

Link format src/codec.ts

ExportReturnsWhat it does
encodeRecord(record)stringThe link fragment (the part after #) for a record, with or without a proof. Throws on a field that is not valid.
decodeRecord(fragment)DecodedReads a fragment (with or without "#"). Strict: one spelling per value, otherwise { ok: false, reason }. Only %7E is undone.
decodeLink(link)DecodedSame, from a whole link or just the fragment. Only the fragment is read, so copies of the pages on other hosts read the same links. New in 0.2.0.
decodeProblem(reason)stringPlain words for a refused link.
sigToUrl(sig) / sigFromUrl(s)string | null88-character base64 signature to the 87-character base64url form in links and back; null when not canonical.
isB64Sig(s)booleanTrue for a canonical 65-byte base64 signature.
originOf(host)stringhttps://host, or http:// for localhost and 127.0.0.1 (local testing).
VERSION, MAX_FRAGMENT, DOGEJS_HOST, MAX_EXPIRES'1', 600, 'dogejs.com', 86400Format version, longest fragment read, the default host, longest challenge expiry in seconds.
XRecord, Proof, Decodedtypes{ handle, address, network, proof? }; { host, nonce, issued, expires, signature, post }; { ok: true, record } | { ok: false, reason }.

Proofs src/proof.ts

ExportReturnsWhat it does
proofStatement(handle, address)stringI am @handle on X. My Dogecoin address is D....
proofMessage(record)stringThe exact Sign in with Doge text the wallet signs for a record with a proof.
checkProof(record, allowedHosts?)ProofCheckRebuilds the text and verifies the signature at the signing time. Default hosts: ["dogejs.com"]. Never throws; reasons: none, other_site, not_p2pkh, bad_signature, malformed.
hasProofBadge(record, allowedHosts?)booleanThe tip-page rule: a valid signature for this handle and address and a post id.
proofProblem(reason)stringPlain words for a failed check.
challengeAttrs(handle, address, network, host)Record&lt;string, string&gt;Attributes for the <doge-signin> element (statement, domain, uri, network, expires-in 600).
recordFromSignIn(handle, address, detail, allowedHosts){ ok, record } | { ok: false, reason }Turns the element's doge-signin:verified detail into a record, after checking it is exactly the proof that was asked for.
PROOF_PATH'/x/proof/'Path in the signed URI.

Post composer src/intent.ts

ExportReturnsWhat it does
postIntentUrl({ text, url? })stringhttps://x.com/intent/post?text=...&url=.... Throws if it would not fit in 280 (X's count) or the url is not http(s).
followIntentUrl(handle)stringhttps://x.com/intent/follow?screen_name=...
xLength(text, urls?)numberLength as X counts it: most Latin characters 1, CJK and emoji 2, each link 23.
fitPost(text, hasUrl, limit?)stringCuts a text at a word so text plus link fits limit (default 240), ending with an ellipsis.
POST_LIMIT, URL_WEIGHT, OUR_LIMIT280, 23, 240X's limit, the weight of a link, the limit our texts keep to.

Page links and texts src/links.ts

ExportReturnsWhat it does
tipLink(record, base?)stringbase + /x/t/# + fragment; base defaults to https://dogejs.com.
proofLink(record, base?)stringbase + /x/proof/# + fragment.
bioLine(record, base?)stringTips 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)stringThe 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.

Doge-speak src/speak.ts

ExportReturnsWhat it does
dogeSpeak(input, round?, count?){ ok: true, lines } | { ok: false, reason }Deterministic doge-speak: same words and round, same lines. Uses only the input's words and a fixed vocabulary; mentions and links are dropped; at most 200 characters in.
contentWords(input)string[]The words doge-speak uses, in order, lower case, without duplicates.
kindOf(word)'noun' | 'verb' | 'adj'Word class from a small list and English endings.
MAX_INPUT200Longest input.

Word filter src/safety.ts

ExportReturnsWhat it does
isBlockedText(text)booleanTrue when any word is blocked (also disguised with digits, symbols or repeated letters).
isBlockedWord(word)booleanOne word. Ordinary words that contain a short entry (therapist, Scunthorpe) pass.
normalizeWord(word)stringThe form the filter compares.
FRIENDLY_REFUSALstringThe sentence shown for refused input.

Prices src/price.ts

ExportReturnsWhat it does
parsePriceText(text, fallback?)PriceInput | null"A coffee, $4.50" to { item, currency, minor }. Understands $, C$, A$, €, £, codes, 1,234.56 and 1.234,56, k / million / billion.
parseAmount(num, suffix?)bigint | nullOne number in minor units (cents).
minorToKoinu(minor, priceE8)bigintFiat minor units to koinu at a rate of fiat per DOGE x 1e8, rounded half up. No floats.
friendlyDoge(koinu)string"0.25", "5.6", "56", "1,234", "1.2 billion".
headline(item, koinu), tagline(koinu)string"A coffee is 56 DOGE." and a fixed fun line by size.
formatFiat(minor, currency), formatRate(priceE8, currency)string"$4.50"; "1 DOGE = $0.1825".
PRESETS, SYMBOL, KOINU, MAX_MINOR, MAX_ITEM, isFiatThe six example prices, currency symbols, 100000000n, the largest price, the longest item name, a currency check.

Fair draw src/draw.ts

ExportReturnsWhat it does
newSeed(rand?)string32 random bytes as 64 hex characters (crypto.getRandomValues).
commitment(seed)stringThe fingerprint to post first: SHA-256 of the 64 hex characters (as printf %s SEED | sha256sum).
revealMatches(seed, commit)booleanDoes 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)stringSHA-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? })DrawCheckRe-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 | nullThe check link fragment c~seed~count~list16.
HashStreamclassSHA-256 counter-mode stream; below(n) gives a uniform integer by rejection sampling.
isSeed, sha256Hex, hex, MAX_ENTRIES, MAX_WINNERSHelpers and limits (10,000 entries, 100 winners).

Payout file src/csv.ts

ExportReturnsWhat it does
payoutCsv(rows)stringaddress,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)stringPlain decimal DOGE; one escaped CSV field.
CSV_HEADER, MIN_KOINU, MAX_KOINU'address,amount,label', 1000000n, 10 billion DOGE.

Self-hosting

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/.

Shell
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 output
  1. Copy site/x/ from the website repository, 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.
  2. Put the built dist/x-*.js next to the pages as site/x/x-*.js.
  3. Serve the folder from any static host. Nothing else is needed: no database, no keys, no X API.

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.

FAQ

Do I need an X developer account or API key?

No. The tools never call X. Posting goes through X's public composer links, and the person presses Post.

Is anything stored on a server?

No. Links carry their data after #, images are made in the browser, and the pages are static files.

Can someone make a tip link with my name?

Yes, anyone can type any name: that is why a plain link says Claimed. Only a proof, signed by the address and posted from your account, shows the green Proof badge.

Does a proof move coins or cost a fee?

No. Signing a message moves nothing and costs nothing.

Does the giveaway pay the winners?

No. It picks winners and, when the winners are addresses, writes a payout file for the DogeJS Wallet (Pay many) or the command line.

Is this made by X?

No. Independent project. Not affiliated with X Corp.