Repository navigation
feat(wallet): experimental built-in Bitcoin wallet and paying from the chat (not audited) - #51
Merged
Merged
Conversation
…ng, Esplora) Pure Dart on pointycastle, no new dependency: separate BIP39 words with their own entropy (never the identity words), BIP32/BIP84 native SegWit accounts, secp256k1 ECDSA with RFC 6979 and low S, BIP143 signing with a self-check, RBF sequence, coin selection with change and dust handling, sweep, fee rates and broadcast through an Esplora server. Mainnet, testnet4, signet and regtest. Checked against embit (addresses and BIP84 vector; the transaction matches byte for byte except one signature, where embit grinds for a low R) and against a real bitcoind 28.1 in regtest: receive, pay with change, confirm, sweep (tool/wallet_regtest/). Not audited. The words live in the system key store, not behind the app lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eipts
Stage 3 UI: Settings → Bitcoin wallet (experimental). Create or restore a
wallet with its own 12 words, choose signet (default), testnet4, regtest or
mainnet (mainnet only after ticking "not audited, I can lose real money"),
set the Esplora server. Balance, receive address with QR, history, send with
a confirmation that shows the full address, amount, fee choice and total.
Restoring the identity's own words is refused. The keys leave memory when
the app locks; "delete everything" and the panic password delete the wallet.
Stage 4: a Bitcoin payment request in the chat gets "Pay with BitDM wallet"
when the wallet runs on the same network. Without an amount in the request
the user is asked for one (never "send all"). After broadcasting, a payment
receipt (txid, amount, address) goes to the chat as a new message kind in
its own payload field "zb", so an app that only knows requests never reads
it as a request. The recipient checks it with their own wallet: confirmations
and how much actually arrived at the address; a short payment is flagged.
Payment requests may now carry an explicit test network ("t"); without it
test addresses are rejected as before, with it only that network's addresses
are accepted, and the card says "test network, not real money".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (Linux, Android) Drives the compiled app through card, confirmation, hand-off to the system, Monero card, the request dialog with a typo, the wallet screen and paying from the chat, saving images rendered by the app itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n Android flutter test uninstalls the app afterwards, so on Android the images also go to the log as base64. The root layer already carries the device pixel ratio. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Proof from the real app (30.11.2026, CT 107):
Real broadcasting is proven separately against bitcoind 28.1 in regtest ( Images are with Henrik (local drop folder). |
…ceipts flagged From the review of this PR: - With Tor on, the wallet asks no server at all (TorGesperrt) instead of bypassing Tor with the real IP; the screen says why. - Showing the wallet words needs a fresh unlock and the secret screen flag, like the identity words. - A receipt whose transaction is older than the request is flagged as proving an earlier payment. - Spent coins leave the wallet state right after broadcasting. - The send dialog builds and signs once per fee rate, not per frame. - Receipt check results are cleared on lock; the wallet entry deletion is awaited briefly on wipe; Esplora needs https except locally or .onion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Stacked on #50 (base
feat/zahlungsanfrage). Stages 3 and 4 of the crypto plan. Experimental, not audited, off by default. Do not release this for real money before an independent audit.Stage 3: built-in Bitcoin wallet (
lib/core/wallet/)Bip39.generate), never the identity words. Restoring the identity's words as a wallet is refused. Stored under a separate key (bitdm_wallet_v1) in the system key store; a test checks the module imports nothing from key derivation, the identity store or the lock.bc1q), secp256k1 ECDSA with RFC 6979 and low S, DER, BIP143 sighash, every signature verified before broadcast, RBF sequence, version 2.Stage 4: pay in the chat
zahlungsbeleg, index 4, no schema change): txid, amount, address, reference to the request. It travels in its own payload fieldzb, so feat(payments): payment requests as messages, handed to the user's wallet #50-only apps (which readz) never mistake it for a request; 2.0.1 shows the readable text.t). Without it test addresses are rejected as in feat(payments): payment requests as messages, handed to the user's wallet #50; with it only that network's addresses pass, and the card and text say "test network, not real money".Not done (honestly)
Tests
test/wallet/wallet_test.dart: BIP84 vector and embit 0.8.0 addresses (mainnet, signet, regtest). A transaction signed by both: everything up to the witnesses and the second witness are byte-identical; the first signature differs only because its R is above 2^255 and embit (like Bitcoin Core) grinds for a low R. Low S, verification, network separation, scanning, change, sweep, dust, insufficient funds, wrong network, txid check on broadcast.test/wallet/wallet_regtest_test.dart(runs only withBITDM_REGTEST_ESPLORA): against a real bitcoind 28.1 (official binary, SHA256SUMS checked) with a small Esplora shim (tool/wallet_regtest/). bitcoind accepted the transactions: receive 0.5, pay 0.1234 with change, mempool then 1 confirmation, balance and history correct, sweep to zero, garbage rejected. Green in CT 107.test/zahlung/zahlungsbeleg_test.dart,test/oberflaeche/wallet_ui_test.dart(create, refuse identity words, pay from the chat → receipt with the server's txid, receipt check incl. a short payment), real-core E2E for receipts, identity-separation test.🤖 Generated with Claude Code