Building Real Services
Capstone: assemble a BTCPay-style payment processor, an instant-swap exchange, and a Cake-style mobile wallet from the building blocks you've learned.
You've worked through the whole course. You can run monerod and talk to its daemon RPC, drive monero-wallet-rpc, organize funds with accounts and subaddresses, set up watch-only wallets, move coins with transfer and sweep_all, and connect a phone to a light-wallet server. Those are parts. This capstone shows how to assemble them into three real products: a payment processor, an instant-swap exchange, and a mobile wallet. None of them needs anything you haven't already seen — the skill is in how the pieces fit together.
Service 1 — a BTCPay-style payment processor
A payment processor turns "a customer owes me 0.4 XMR" into "I detected 0.4 XMR and notified my store." You can build the core in an afternoon once the infrastructure is running. The architecture mirrors what you saw in accepting Monero with BTCPay.
- Run your own node. Stand up
monerodso you verify payments yourself instead of trusting a remote node about money owed to you. - Use a watch-only wallet. Start
monero-wallet-rpcwith a view-only wallet — the private view key plus primary address, no spend key. The server can see incoming funds but can never move them, so a breach can't drain you. - One subaddress per invoice. When a buyer checks out, call
create_addresson a dedicated account to mint a fresh subaddress, render it as text and a QR, and show it on the payment page. A unique subaddress per invoice means you can attribute each payment without any payment ID and without address reuse. - Detect the payment. Poll
get_transfers(or subscribe tomonerod's ZMQ feed for push notifications) and match incoming transfers to the subaddress for that invoice. Compare the received amount in atomic units — never floats. - Wait for confirmations. Mark the invoice paid only after N confirmations clear, so a reorg can't reverse a sale. Ten confirmations is a common conservative threshold.
- Sweep to cold storage. On a schedule, the offline side of the operation signs a
sweep_allthat moves accumulated revenue to a cold wallet. The spend key never touches the internet-facing server.
Service 2 — an instant-swap exchange
An instant swap lets someone trade one coin for another with no account — the model from how instant swaps work. Behind the simple "send coin A, receive coin B" experience sit three subsystems: a rate engine, deposit detection on both chains, and payout.
- Rate engine. Quote a price, lock it for a short window, and decide the exact output amount the user will receive.
- Deposit detection. For the Monero leg, generate a fresh subaddress per order and watch for the deposit exactly as the payment processor does. For the other chain, run that chain's equivalent watcher.
- Payout. When the user is selling another coin for Monero, you pay them XMR from a hot wallet with
transferto the address they supplied. When they're selling Monero, you detect their XMR deposit to your subaddress and release the other coin.
The hard parts are operational, not cryptographic. You need hot-wallet liquidity management so the wallet you pay out from never runs dry, a hot/cold split that keeps most reserves offline, sane confirmation thresholds on incoming deposits before you release the other side, and refund handling — always collect a refund address up front so an underpaid or expired order can be returned. Idempotency matters too: each order must pay out exactly once even if your detection loop sees the deposit twice.
For the XMR-BTC pair specifically, there's a trustless alternative that removes your custody risk entirely: atomic swaps, covered in atomic swaps. They let two parties trade directly without either holding the other's funds — no hot wallet, no liquidity desk, but they only work for that one pair today.
Service 3 — a mobile wallet
A Cake-style mobile wallet flips the perspective: now you are the one giving users self-custody. The defining constraint is that keys live on the user's device and never leave it.
- Embed the wallet logic. Most mobile wallets embed Monero's
wallet2library (the same core thatmonero-wallet-rpcwraps) so the phone can build and verify transactions itself. A lighter option is to pair an on-device key store with a light-wallet server that scans the chain using only the view key. - Guard the seed. Generate the 25-word mnemonic on-device and store the keys in the platform's secure storage (Keychain on iOS, Keystore on Android). The seed is the user's money — it must never hit your servers.
- Let the user choose a node. Offer a default remote node but allow the user to point at their own
monerodfor privacy and trust-minimization. - Build and sign locally. Construct, sign, and broadcast transactions on the device. Show the balance through the
get_balanceequivalent and surface locked versus unlocked funds.
The common building blocks
Notice how much these three share. Every one of them rests on the same recurring pieces:
- Your own node (
monerod) so you verify rather than trust. - A wallet engine —
monero-wallet-rpcfor servers, embeddedwallet2for apps. - Subaddresses for routing and attributing incoming payments without reuse.
- Watch-only plus hot/cold separation so internet-facing systems can see funds but the spend key stays offline.
- Confirmations and reorg handling before treating money as final.
- Idempotency so detection and payout each happen exactly once.
- Atomic units in all arithmetic, where
1 XMR = 1e12atomic units.
Where to go next
The authoritative references are the developer guides and the full RPC reference on getmonero.org, and the source itself in the monero-project GitHub — the monero daemon and wallet code, and monero-lws for the light-wallet server. Whatever you build, prototype on stagenet or testnet first: you get the exact same RPC and behavior with coins that cost nothing, so you can break things freely before a single real XMR is at stake.
With these patterns you have everything you need to build your own Cake-style mobile wallet, a BTCPay-style payment processor, or a no-account instant-swap exchange. The protocol is open, the tooling is free, and nobody can stop you from shipping. Go build.
You've reached the end. Test yourself with the Building on Monero quiz.
Created June 30, 2026
Comments
Log in or create a free account to comment.
No comments yet — be the first.