DogeJS / Doge on X / X tip jar

X tip jar

Put a tip link in your X profile. Fans pick an amount and pay from any Dogecoin wallet, straight to you.

Free, no account, nothing leaves your browser. For developers: the docs

The tip page fans open: the X account, amounts 10 to 100 DOGE and a Tip 25 DOGE button.

What you get

X tip jar, step by step

The tip-jar form on a phone: X username dogejs_demo and a Dogecoin address, both with green checks.

Two boxes and you are done

Type your X username and your Dogecoin address. The page checks both while you type, so a typo shows up before you share anything.

  • Type the username any way you like: @name, a profile link or the plain name
  • The address is checked for typos and for the right network
  • Nothing is uploaded: your name and address live inside the link
The result: a bio line to copy and a black Post on X button to pin a tip post.

A bio line ready to paste

You get one short line for your bio and a link for the Website box. It is short enough for the 160 characters X allows.

  • Copy the whole bio line or just the link
  • Open the tip page first to see what fans will see
  • Make a new link any time you change your address
An illustration of a post box with the tip post and link filled in and a Post button.

Pin a tip post

One button opens the X post box with the words and the link already filled in. You look it over and press Post yourself.

  • We never read your account or post for you
  • The text fits X's 280 characters, with the link counted the way X counts it
  • Works on a phone and on a computer
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.

Add a green Proof badge

Anyone can make a link with any name, so tip pages say Claimed. Sign once with your wallet and your page shows a green Proof badge.

  • Paste the proof link under Advanced
  • Fans can check the proof themselves in their browser
  • Optional: the tip jar works without it

How it works

  1. Type your name and address

    The page checks both and writes them into a link.

  2. Copy the bio line and post

    Paste it into your X bio and pin the tip post.

  3. Fans tip from any wallet

    They pick an amount and pay straight to your address.

Questions

Why does my tip page say Claimed?

Anyone can make a link with any name. Make a proof and add it under Advanced to get the green Proof badge.

Is the link short enough for a bio?

Yes. The bio line is at most 95 characters, even with a 15-character username; an X bio holds 160. If a link ever arrives cut short, the CRC catches it and the tip page says the link looks cut short instead of showing anything.

Can I use a test network address?

Yes, for trying it out: the page and the tip page label it Test network.

Do you take a fee?

No. Tips go from the fan's wallet straight to your address.

What if I change my address?

Make a new link and replace the old one in your bio. Old links keep pointing to the old address.

Do I need an account or an API key?

No. Everything is inside the link, and nothing is stored on a server.

Is this made by X?

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.

X tip jar

It works for real, right here. No sign-up.

For developers

The tip link for developers

The format of a tip link, how to build and read one in code, and how the tip page works.

How it works

  1. The page checks the username (1 to 15 letters, digits, underscores) and the address (checksum, network).
  2. It writes both into a link: https://dogejs.com/x/t/#1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e. The last field is a CRC-32 that catches cut links.
  3. The bio line is that link without https:// after "Tips in Dogecoin:". "Post on X" opens X's composer with a pinned-post text and the link.
  4. The tip page (/x/t/) reads the fragment in the browser, shows the account as Claimed, or with a green Proof badge when the link carries a checked proof and post, and embeds the <doge-pay> button for the chosen amount. Payments go straight from the fan's wallet to the address.

Nothing is stored anywhere: change the address by making a new link. The field rules are on the link format section.

Use it in your own code

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';

Put a tip button on your own site with the same link as your bio:

HTML
<a href="https://dogejs.com/x/t/#1~dogejs_demo~DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L~7a2ff36e">Tip me in DOGE</a>

Or build links for many accounts in code (for a community page, say) with tipLink, and read links people paste with decodeLink.

Code examples

Each example runs in Node against the built package; the output 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

Check what people type

The same checks as the form: handles typed many ways, addresses, and a pasted secret that must be cleared. File examples/inputs.mjs; run: node examples/inputs.mjs.

JavaScript
// Read what people type into a tip-jar form, the way the tip page does.
import { addressHint, addressNetwork, handleHint, looksSecret, parseHandle } from '@dogejs/xkit';

for (const typed of ['@dogejs_demo', 'https://twitter.com/dogejs_demo/', 'doge js', 'much_too_long_name_here']) {
  const h = parseHandle(typed);
  console.log(JSON.stringify(typed), '->', h ?? handleHint(typed));
}
for (const typed of ['DH5yaieqoZN36fDVciNyRueRGvGLR3mr7L', 'nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt', 'DH5yaieqoZN36fDVciNyRueRGvGLR3mr7', 'bc1qexampleexampleexample']) {
  console.log(typed.slice(0, 12) + '...', '->', addressNetwork(typed) ?? addressHint(typed));
}
// A pasted recovery phrase or private key is recognised so the page can clear it and never keep it.
console.log(looksSecret('abandon ability able about above absent absorb abstract absurd abuse access accident'));
Output
"@dogejs_demo" -> dogejs_demo
"https://twitter.com/dogejs_demo/" -> dogejs_demo
"doge js" -> A username has no spaces.
"much_too_long_name_here" -> X usernames have at most 15 characters.
DH5yaieqoZN3... -> mainnet
nUCAGGgZEPN1... -> testnet
DH5yaieqoZN3... -> Not finished yet. A Dogecoin address has 34 characters and starts with D.
bc1qexamplee... -> That is not a Dogecoin address. Dogecoin addresses start with D.
true

The pinned post

The "Post on X" link of step 2: text and link, counted like X counts it. 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

The exports this page uses. The full list is on the Doge on X developer page.

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

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.

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.

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.

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