Discord Tip Bot
The classic Dogecoin project: tip your friends DOGE in chat.
A custodial Discord bot with an internal ledger: on-chain deposits and withdrawals, instant free tips between users, hard safety limits. This kit assumes the architecture from the tip-bot lesson and builds all of it on testnet.
What you'll have when it works
- !balance, !deposit, !tip @user amount, !withdraw address amount commands
- Internal ledger in integer koinu with atomic transfers
- Deposit watcher crediting confirmed arrivals per user
- Withdrawal limits, cooldowns, and an admin audit command
The prompt
Paste this into Claude Code in an empty project folder. It's a full spec, not a wish – the constraints in it (integer koinu, idempotent crediting, testnet asserts) are the difference between a demo and something trustworthy. Read what comes back before you run it.
Build a Discord tip bot for Dogecoin TESTNET in Python. Read this whole spec before writing code.
CONTEXT
- I have a synced Dogecoin Core testnet node on localhost with server=1, txindex=1. RPC port 44555. RPC credentials will be provided via environment variables DOGE_RPC_USER / DOGE_RPC_PASS. Discord bot token via DISCORD_TOKEN. Never hardcode secrets.
- Dogecoin Core speaks Bitcoin-Core-style JSON-RPC. Use plain HTTP via the requests library (no heavy deps): POST {"jsonrpc":"1.0","id":...,"method":...,"params":[...]} with basic auth. Raise on the "error" field in responses.
ARCHITECTURE (non-negotiable)
- Internal ledger: SQLite table balances(user_id INTEGER PRIMARY KEY, koinu INTEGER NOT NULL DEFAULT 0). All amounts stored as integer koinu (1 DOGE = 100_000_000 koinu). Never do float math on balances.
- Tips are off-chain ledger transfers inside one SQLite transaction: debit with UPDATE ... SET koinu = koinu - :amt WHERE user_id = :from AND koinu >= :amt; if rowcount is 0, roll back and report insufficient balance; otherwise credit the recipient and commit.
- Deposits: table deposit_addrs(user_id INTEGER PRIMARY KEY, address TEXT UNIQUE). First !deposit call generates an address via RPC getnewaddress and stores it; later calls reuse it. A background task every 30s calls listtransactions and credits NEW confirmed receives (>= 2 confirmations) to the owning user, using a processed_txids table so a txid is never credited twice (idempotent across restarts).
- Withdrawals: validate the address with RPC validateaddress (must be testnet-valid), enforce min withdrawal 2 DOGE, max 500 DOGE per user per day (tracked in a withdrawals log table), then RPC sendtoaddress, then debit the ledger recording the txid. If sendtoaddress throws, do not debit.
COMMANDS (discord.py, message_content intent on)
!balance, !deposit (DM the address, never post publicly), !tip @user amount, !withdraw address amount, !house (admin-only: wallet balance via RPC getbalance vs SUM(ledger) - print both and the difference).
SAFETY RAILS
- Min tip 1 DOGE; per-user cooldown 10s on !tip and !withdraw; friendly errors, never stack traces to chat.
- On startup, verify RPC getblockchaininfo returns "chain":"test" and refuse to run otherwise. This bot must not be pointed at mainnet as-is.
DELIVERABLES
Single tipbot.py plus requirements.txt and a README covering setup, the dogecoin.conf needed, and how to run it. Write clean, commented code. After writing, walk me through testing it end-to-end with a testnet faucet.
The walkthrough
- Run the node lesson first: testnet node synced, RPC credentials set.
- Create a Discord application + bot, enable the message-content intent, grab the token.
- Paste the prompt into Claude Code in an empty project folder and review what it builds.
- Fund the bot: !deposit, send faucet coins, watch the watcher credit you after 2 confirmations.
- Tip a second test account, then !withdraw back to your faucet/return address.
- Read the audit output of !house until the invariant (wallet >= ledger sum) makes intuitive sense.
Before this touches real DOGE
- Keep it on testnet until the production checklist lesson is second nature.
- If you ever go mainnet: thin hot wallet + cold sweeps, encrypted wallet, small published limits, and read the custody warnings in the tip-bot lesson again.
- Back up the bot machine's wallet.dat AND the SQLite ledger together - one without the other is half the accounting.
The lessons behind this kit: Detect a payment · Architect a tip bot · Taking Dogecoin payments to production