Privacy aware self-hosted crypto-friendly invoice system

Sealbill issues invoices and takes payment in stablecoins, bitcoin, Lightning, Monero, Zcash, bank transfers and payment links. It runs on your own server, reads the chains itself, holds no key that can spend, and keeps your clients’ data encrypted under a password that only people know.

Invoice 2026-0042

As the database holds itAs the running app reads it

Paid
Client
gAAAAABq8lOAvZjPc4qW1kE9z2YyZ84DYQKKwj5Hg4LTew-fBITJEMWiEA-QCgQ8Rt7m5qeNj-lEh5HudKdBcr3oEOaYxqgxrg==Lena Brandt
E-mail
gAAAAABq8lOARNRZtbNUb1y8k584OYwHh_SKJy4Up2YEZYwtr8Qp6YI4PuBUDv3o9VQRjCiXyCz9xbq22ATlJ-YBwGEtNiW_8L9WpyuqO0DCdzITEavZtyc=lena@example.com
Address
gAAAAABq8lOApN87NT7TkBGHn3J3dG-5K1tIp15JwhngRnGAG2i3KI0ITZ966KKKgUZP7Onnar1FVFyqogTjd3gXK2lYBqXKKTGWeoQJnrqnLTUBSQGYaW_aTbFMg-GKMb0L2gm_HY-3Kastanienallee 12, 10435 Berlin
Line 1
gAAAAABq8lOAMBJNlA1FJicy48TuYM7ZhAl6v0dkIkHnS4b0w4eXFMa6oBF_GJgAZ5EaQnw3ppkepEZi8gmerBfg84fdlKYUfP-feqZ-EOa92H7E32vJ_JY=Brand workshop, two days2,400.00
Total
2,400.00 EUR
Paid with
USDC on Arbitrum One, finalized
Transaction
0x6061…65c4
Sealed: names, e-mail and postal addresses and line items sit in the database as Fernet tokens. Amounts, statuses and transaction hashes stay readable, so payments are still seen and matched. Unsealed: someone typed the vault password, so the running app holds the key in memory and can read these fields. The database still holds only the tokens.

What it does

Invoicing and payments for a small team, on a server you control.

  • Invoices and payment requests

    In 22 fiat currencies or bitcoin, with a PDF and a client page in nine languages: English, Slovak, Czech, German, Spanish, French, Polish, Korean and Russian.

  • Quotes that match themselves

    A client picks a network and a token and gets the exact amount at a fixed rate, held for 30 minutes, with a QR code. A few units of dust make each amount unique, so the payment finds its invoice without anyone looking.

  • Payment links

    One page for a service at a set price or an amount the buyer chooses, with coupons and usage caps. Every checkout becomes an ordinary invoice or payment request.

  • Needs a person

    Payments that matched nothing or matched badly, refunds due on overpayments, transfers not yet final and watchers that cannot see their chain land on one list. The rest stays quiet.

  • API, webhooks and agents

    A REST API with OpenAPI docs and an llms.txt, signed webhooks, and an MCP server for AI agents that will not start with a token able to confirm payments.

  • Several organizations

    One installation serves several issuers, each with its own numbering, bank accounts, payment methods and API tokens. CSV exports for the books.

Ways to be paid

Switch methods on per organization or per invoice. Crypto payments are read from the chains, through RPC endpoints you can replace with your own, or from your own BTCPay Server and Lightning node.

Stablecoins and ether

NetworkAcceptsCounted as paid
EthereumETHUSDCUSDTIn a finalized block
Arbitrum OneETHUSDCUSDT0In a finalized block, or after 5 minutes for up to 1,000 USD
OptimismETHUSDCUSDT0In a finalized block, or after 5 minutes for up to 1,000 USD
BaseETHUSDCIn a finalized block, or after 5 minutes for up to 1,000 USD
Polygon PoSUSDCUSDTIn a finalized block
BNB Smart ChainUSDCUSDTIn a finalized block
Avalanche C-ChainUSDCUSDTIn a finalized block
TronUSDTOnce TronGrid reports it confirmed
SolanaUSDCUSDTAt finalized commitment
TONUSDTOff by default, see below

Token contracts are a fixed allow-list in the code; bridged USDC.e, Binance-Peg tokens outside BNB Smart Chain and the legacy bridged USDT on Optimism are refused. Native ETH sent by a contract (an internal transfer) is not seen, so ask for a token or for ETH from an ordinary wallet. TON stays off until the credit to your own jetton wallet can be verified. apps/rails/networks.py

  • Bitcoin, Monero and Zcash

    Through your own BTCPay Server. Each quote gets its own BTCPay invoice, and its state is read back from BTCPay’s API. Bitcoin settles after 1, 2 or 6 confirmations, never 0; Monero and Zcash at your store’s threshold.

    apps/rails/gateways/btcpay.py

  • Lightning

    Through Nostr Wallet Connect, LND, Core Lightning or LNbits. Sealbill only makes invoices and looks them up.

    apps/rails/gateways/lightning/

  • Bank transfer

    Your bank accounts, each in its own currency, with SWIFT and intermediary bank details, shown on the invoice. For EUR to a SEPA account the pay page and the PDF also print PAY by square, payme, QR Platba and EPC QR codes, so the client scans instead of typing; on a phone the payme link opens a Slovak banking app with the transfer filled in. A person records the payment when it arrives.

    apps/orgs/models.py, apps/invoices/bank_qr.py

  • Fiat payment links

    Your Revolut, N26, PayPal, Wise or any other payment link, offered for the currencies you set. A person records the payment.

    apps/orgs/models.py

It holds nothing that can spend

Chain payments go to addresses you give it: there is no private key on the server. A gateway credential is stored only once it is shown to receive and do nothing more.

BackendWhat it accepts
Nostr Wallet ConnectA connection with make_invoice and lookup_invoice, and no method whose name contains pay. The wallet is asked what the connection allows.
LNDA macaroon limited to invoices:read, invoices:write and info:read, read from the macaroon itself. LND’s own invoice.macaroon is refused.
Core LightningA rune restricted to the methods invoice and listinvoices (waitinvoice and getinfo are allowed).
LNbitsThe wallet’s invoice key, never the admin key. The two look alike, so you vouch for it with a flag, and the audit trail records that you did.
BTCPay ServerA store key that may view and create invoices (and manage webhooks and read store settings), nothing else. BTCPay is asked what the key may do.

apps/rails/credentials.py, apps/rails/gateways/receive_only.py

Security

Every claim names the file where you can check it.

Each one in detail, and where it stops

  • Passkeys

    WebAuthn with user verification required. The relying party is pinned to your SITE_URL, never taken from the request’s Host header.

    apps/staff/passkeys.py

  • Authenticator codes

    TOTP as the other second factor, its secrets encrypted with the vault key. No staff page opens without a second factor.

    apps/staff/models.py, apps/staff/views.py

  • Step-up for sensitive changes

    API tokens, rail credentials, bank accounts, payment links and a client’s e-mail address need a superuser with a second factor from the last ten minutes. Every superuser is e-mailed.

    apps/staff/stepup.py

  • Sealed vault

    The key comes from your vault password (PBKDF2-SHA256, 600,000 iterations) and lives in RAM and on tmpfs only. After a reboot nothing client-facing opens until a person unlocks it.

    apps/vault/vault.py

  • Encrypted database fields

    56 fields are Fernet tokens: names, addresses, e-mail addresses, tax ids, line items, bank details, credentials, notes. A database dump without the password is unreadable.

    apps/vault/fields.py

  • Per-contact mail encryption

    A client’s PGP key or S/MIME certificate encrypts every letter to them. A new key works only after a link sent encrypted to it is answered.

    apps/keys/

  • Strict Content Security Policy

    default-src 'none', scripts only from the site or with a fresh nonce per response, no inline styles or handlers, no framing.

    apps/core/csp.py

  • Signed webhooks

    Outgoing events carry an HMAC-SHA256 signature and go only to public https addresses. Incoming BTCPay hooks need a valid signature, and their body decides nothing.

    apps/webhooks/delivery.py, apps/rails/views.py

  • Scoped API tokens

    Four scopes, stored as SHA-256 hashes, 120 requests a minute each. No token can confirm a payment that waits for a person.

    apps/api/models.py, apps/api/permissions.py

  • Audit trail

    Who did what to which record, and when, with the details encrypted. No screen edits or deletes an entry.

    apps/audit/

  • Two-source exchange rates

    Bitstamp and Coinbase, cross-checked: more than 1% apart and the quote is refused. Other fiat goes through the ECB rate, refused when stale or jumping.

    apps/rails/fx.py

  • Chain confirmations

    Credited only when final: finalized blocks, Solana at finalized, Tron when confirmed, BTCPay never at zero confirmations.

    apps/rails/chains/

  • No third-party trackers

    Fonts and scripts come from your own installation, and the policy lets a browser load nothing from anywhere else. No analytics, no CDN.

    apps/core/csp.py, static/

Leave Zaprite or Request Finance

Bring every client and every invoice with you, as paid history.

  1. Export

    From Zaprite through its API, with tools/migrate/zaprite_export.py. From Request Finance with tools/migrate/request_finance_export.js, pasted into the browser console while you are logged in. Both write NDJSON.

  2. Rehearse

    A dry run does the whole import, prints the report and rolls everything back.

    uv run manage.py import_invoices --source rf --org <slug> --dry-run < export.ndjson
  3. Read the report

    New and merged contacts, invoices per currency, totals, renumbered collisions, and every refused line with its reason. It prints ids, never a client’s name, address or amount.

  4. Import

    Run the same command without --dry-run. Run it twice and nothing is imported twice.

  • Paid and marked migrated. Every invoice arrives with a confirmed payment for its total, and afterwards nothing can send, pay, void or delete it.
  • Your numbers. A number already taken gets a suffix, -RF for Request Finance or -Z2 for Zaprite, counting up from there.
  • Quiet. No letter goes out, no webhook fires, and your own numbering does not move.

Read the migration guide

Run it yourself

One Linux server, one database, and a password you keep somewhere else.

Server
Linux, Python 3.12 or newer, Django 5.1, gunicorn.
Database
PostgreSQL. SQLite is for development and tests.
Processes
The web app, and a worker for chain watchers, e-mail and alerts.
In front
A TLS reverse proxy. Example Apache vhosts, systemd units and backup scripts are in deploy/; Docker Compose works too.
System packages
Pango and HarfBuzz for PDFs, Noto fonts (the CJK set for Korean), gnupg and openssl for encrypted mail and backups.
Memory
A tmpfs mount for the vault key, so it never reaches a disk.
Backups
One AES-256 encrypted archive a night: the database and vault.json, never the key.

Quick start with Docker Compose

git clone https://github.com/wilderko/sealbill.git && cd sealbill
cp .env.example .env    # SECRET_KEY, SITE_URL, ALLOWED_HOSTS, DJANGO_ADMIN_PATH,
                        # and one password in DATABASE_URL and POSTGRES_PASSWORD
docker compose up -d
read -rsp 'Vault password: ' p; echo
printf '%s\n' "$p" | docker compose exec -T web python manage.py init_vault
printf '%s\n' "$p" | docker compose exec -T web python manage.py unseal_vault
unset p
docker compose exec web python manage.py createsuperuser
docker compose exec web python manage.py create_staff_totp <username>

The web port listens on 127.0.0.1:8000 only: put your TLS proxy in front of it. After every reboot the vault is sealed, and client pages and the API answer 503 until someone unlocks it at /unlock/. The chain watchers keep matching payments in the meantime.

Keep vault.json, the vault password and the backup passphrase off the server. Without them nobody can read the database, you included.

Read the full deployment guide