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