cryptoadvance / cryptoadvance/specter-diy
Feature request: Optional Mempool Push QR for broadcasting finalized transactions
- Dominant language
- Python
- Stars
- 585
- Forks
- 108
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 5
Description
## Summary
Add an optional **Mempool Push** feature that lets users broadcast a fully signed and finalized Bitcoin transaction from Specter DIY via QR code, without first scanning the signed PSBT back into the originating wallet.
The feature should be:
- disabled by default;
- explicitly enabled in Specter DIY settings;
- non-invasive to the existing signed-PSBT QR workflow;
- available only when a complete, broadcastable raw transaction can be produced;
- based on a Mempool.space-compatible Push Tx URL, scanned by a normal phone camera.
Specter DIY would remain fully air-gapped. The phone would perform the network communication and broadcast through Mempool.space.
## Motivation
The normal workflow should remain unchanged:
```text
Wallet -> unsigned PSBT -> Specter DIY -> signed PSBT -> Wallet -> finalize -> Bitcoin network
```
When Specter DIY has produced the final required signature and the PSBT can already be finalized, the wallet round-trip may only be needed to extract the raw transaction for broadcasting. An optional QR-based Push Tx flow would provide a convenient alternative while preserving the existing PSBT workflow as the default.
This is conceptually similar to COLDCARD's NFC Push Tx feature, adapted to Specter DIY's QR-first air-gapped workflow:
```text
Wallet -> Specter DIY signs -> Mempool Push QR -> phone -> mempool.space -> Bitcoin network
```
## Proposed UX
### 1. Opt-in setting
Add a `Mempool Push` setting, either as a standalone setting or under the existing QR/communication settings.
- Default: `OFF`
- The first-time enable flow should explain that transactions are broadcast through Mempool.space using the phone's Internet connection.
- The privacy notice should state that the service may be able to associate network information, such as the phone's IP address, with the broadcast transaction.
- The notice should also make clear that no seed, private key, descriptor, xpub, or other wallet metadata is shared.
### 2. Preserve the existing signed-PSBT screen
The signed PSBT QR must remain the primary output and must work exactly as it does today, regardless of whether Mempool Push is enabled.
When the setting is enabled, show an additional small `Mempool Push` or `Broadcast` action on the signed transaction QR screen.
### 3. Generate a second QR code
Selecting the action should display a separate QR code containing a URL similar to:
```text
https://mempool.space/pushtx#t=&c=&n=
```
The `n` parameter should be omitted when not required. A `Back` action must return to the normal signed-PSBT QR screen.
The QR should be scannable with a normal smartphone camera; no Specter-specific scanner should be required.
## Transaction and URL handling
Mempool Push must only be offered if Specter DIY can safely produce a complete final raw transaction.
- Finalizable single-sig transactions: Push QR available.
- Partially signed multisig transactions: Push QR unavailable.
- Miniscript paths that still require signatures: Push QR unavailable.
- Unsupported networks: Push QR unavailable; never silently fall back to mainnet.
The existing signed PSBT must remain available and unchanged. Finalization and raw transaction extraction should be performed as an additional step for the Push QR.
The URL payload must contain only the final serialized raw transaction:
- `t`: raw transaction bytes encoded as unpadded Base64URL;
- `c`: the rightmost 8 bytes of `SHA256(raw_transaction)`, encoded as unpadded Base64URL;
- `n`: the appropriate Mempool network parameter where required.
Before implementation, verify the current Mempool `/pushtx` implementation and map Specter DIY's network modes, including mainnet, testnet, testnet4, and regtest. Network handling must fail closed when Mempool Push does not support a network.
The Push QR must not contain PSBT metadata, descriptors, xpubs, derivation paths, wallet names, fingerprints, seeds, private keys, or unrelated wallet information.
## QR size handling
Large transactions may produce URLs that are several kilobytes long. For the initial implementation, reject transactions that do not fit reliably in a QR code and show a clear error such as:
> Transaction is too large for Mempool Push QR.
Multipart or animated Push Tx transport can be considered separately in the future.
## Air-gap and privacy requirements
This feature must not add networking to Specter DIY. Specter DIY must make no HTTP or DNS requests and must not connect to Mempool.space. The phone is the only broadcasting device.
The feature is intentionally opt-in because broadcasting through a public third-party service has privacy implications.
## Reference implementation
- COLDCARD documentation: `Coldcard/firmware/docs/nfc-pushtx.md`
- COLDCARD menu tree: `Coldcard/firmware/docs/menu-tree.txt`
- Mempool Push Tx frontend: `mempool/mempool/frontend/src/app/components/push-transaction/push-transaction.component.ts`
- Mempool endpoint: `/pushtx`
## Acceptance criteria
- [ ] Add a `Mempool Push` setting.
- [ ] The setting defaults to `OFF`.
- [ ] The existing signing workflow is unchanged when the setting is disabled.
- [ ] The signed-PSBT QR remains the primary output when the setting is enabled.
- [ ] An optional Mempool Push/Broadcast action is shown when enabled.
- [ ] The action is available only when a complete final raw transaction can be produced.
- [ ] Partially signed multisig and Miniscript transactions cannot generate a Push QR.
- [ ] Finalization and raw transaction extraction do not destroy or replace the signed PSBT output.
- [ ] `t` contains the exact final serialized transaction as unpadded Base64URL.
- [ ] `c` contains the rightmost 8 bytes of SHA-256(raw transaction) as unpadded Base64URL.
- [ ] Network information is mapped correctly and unsupported networks fail closed.
- [ ] The QR uses Mempool's existing `/pushtx` implementation.
- [ ] The QR can be scanned with a normal smartphone camera.
- [ ] A Back action returns to the signed-PSBT QR.
- [ ] Oversized transactions fail cleanly.
- [ ] Enabling the feature communicates the third-party broadcast privacy trade-off.
- [ ] No seed, private key, descriptor, xpub, or PSBT metadata is sent to Mempool.space.
## Why this is useful
This combines Specter DIY's existing QR-based air gap and signed-PSBT workflow with COLDCARD's proven Push Tx concept and Mempool.space's existing browser-side broadcast flow, without adding networking capabilities to Specter DIY.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the existing settings, signed-PSBT QR screen, and finalization/raw-transaction extraction entry points; confirm how network modes and QR size limits are handled. Review the referenced Mempool Push Tx frontend and /pushtx behavior. Done means the opt-in flow, privacy notice, fail-closed network handling, unchanged PSBT output, and acceptance criteria are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- blockchain, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100