Repository Public
1# QYVORA — Bitcoin23A short map of the Bitcoin support, pointing at the code. The chain table is in [CHAINS.md](CHAINS.md), recovery in4[RECOVERY.md](RECOVERY.md), what was verified in [STATUS.md](STATUS.md).56## Scope78- Networks: mainnet, Signet (default), Testnet (`BitcoinNetwork`, `Sources/QyvoraCore/Networks.swift`).9- One BIP-84 account (`m/84'/coin'/0'`), native SegWit P2WPKH addresses, a new receive address for every payment10 (`BIP84Account`, `Sources/QyvoraBitcoin/Account.swift`).11- Signatures: secp256k1 ECDSA with RFC 6979 nonces and low s, over the BIP-143 digest12 (`Sources/QyvoraBitcoin/Signing.swift`, `Sources/QyvoraSecp256k1`). BIP-340 Schnorr is implemented in the engine;13 the wallet does not spend with it and has no Taproot addresses.1415## Where things are1617| Subject | Code |18|---|---|19| Scripts and addresses (Bech32, Bech32m, Base58Check, CashAddr) | `Sources/QyvoraBitcoin/Script.swift`, `Address.swift`, `Sources/QyvoraCore` |20| Transactions, sighash, signing, verification | `Sources/QyvoraBitcoin/Transaction.swift`, `Signing.swift` |21| Coin selection, fee rates, dust | `Sources/QyvoraBitcoin/CoinSelection.swift`, `TransactionBuilder.swift` |22| Output descriptors | `Sources/QyvoraBitcoin/Descriptor.swift` |23| PSBT (BIP-174, version 0) | `Sources/QyvoraBitcoin/PSBT.swift` |24| Esplora client | `Sources/QyvoraNetworking` |25| Synchronization, payments, PSBT flows, sweep | `Sources/QyvoraWallet/WalletService+Bitcoin.swift` |26| Persistence of the last synchronization | `Sources/QyvoraWallet/SyncPersistence.swift` |2728## Behaviour worth knowing2930- Synchronization scans receive and change addresses with a gap limit of 20 and validates what the indexer says31 (each transaction must involve the address it was listed for; coins are cross-checked against the history). The32 history of an address whose counters did not change is reused at the next synchronization.33- A payment is built from the snapshot of the current session only; a snapshot restored from the previous launch is34 shown, never spent from.35- Fee: three rates from the indexer's estimates (or the minimum relay rate when it gives none), or a custom rate;36 coin control.37- Cold signing: the online device (possibly watch-only) exports a PSBT with the previous transactions attached, so38 that the cold device verifies the input amounts and therefore the fee itself. A PSBT whose amounts are only stated39 is refused unless the user confirms that separately (`signColdTransaction(acceptUnverifiedAmounts:)`), and always40 refused on mainnet with an unaudited build.41- Quantum Shield: per output, whether its public key is already on chain (address spent from, or a script that42 shows the key); exposed outputs can be swept to a never-used address in one transaction43 (`prepareSweepOfExposed(chain:)`). This hides the key again until the next spend. It does not make Bitcoin44 quantum-resistant.45- Unaudited mainnet: at most 0.002 BTC per transaction, fee at most 20 000 sat and 200 sat/vB (`MainnetPolicy`).4647## Litecoin, Dogecoin, Bitcoin Cash4849They share the transaction code and differ by the parameters of `BitcoinNetwork` (address formats, coin type,50signature digest, fee and dust policy) and by their indexers (Blockbook, Bitcore:51`Sources/QyvoraNetworking/UTXOIndexer.swift`). Their service code is52`Sources/QyvoraWallet/WalletService+UTXOCoins.swift`. They are signed on the device (no PSBT export), and each53synchronization reads every address again.5455## Not proven5657No Bitcoin transaction has been broadcast by this application: signing is checked against published vectors and by58the engine's own verifier, broadcast against scripted answers.59