I worked to tighten up some of the ideas in this post as I did most of it off the cuff on my phone while I was working too.
This might be a bit more structured:
Bitcoin Improvement Proposal (BIP): [Placeholder Number]
**Title:** Nested Proof-of-Work: A Mandatory Transaction-Level Energy-Based Deterrent for Data Spam, Applicable to OP_RETURN or Overall Transaction Size
**Author:** [Your Name or Handle, e.g., via Nostr or X]
**Comments-Summary:** No comments yet (as of draft).
**Comments-URI:** [Link to discussion thread, e.g., on Bitcoin mailing list or Nostr note]
**Status:** Draft
**Type:** Standards Track (Soft Fork - Consensus Rules and Mempool Policy)
**Created:** 2025-10-03
**License:** BSD-2-Clause
**Requires:** BIP-34 (Height in Coinbase), BIP-141 (SegWit for potential witness integration), BIP-125 (Replace-by-Fee)
**Post-History:** [Links to prior discussions, e.g., Nostr threads with supertestnet, Jimmy Song, Samson Mow, Luke Dashjr, Mechanic]
## Abstract
This BIP proposes Nested Proof-of-Work (Nested PoW) as a mandatory consensus mechanism for all Bitcoin transactions, imposing scalable computational costs to protect against spam via verifiable energy expenditure. Raw data from on-chain metrics (e.g., post-Ordinals block sizes averaged 1.5-2 MB in peaks, up 50% from pre-2023 norms per blockchain.com, correlating with 20-50% bandwidth spikes and ~20% node churn in low-resource setups) verifies spam as a threat, driven by incentives of data-heavy projects (e.g., Ordinals/Runes raised $10M+ in funding per Crunchbase, profiting from low-cost inclusion while spinning "permissionless innovation" narratives that ignore verifiable externalities like higher orphan rates of 5-10% in surges). To address holistically, Nested PoW applies in two modes: (1) OP_RETURN data size; or (2) overall tx size. Base difficulty is drastically lowered (1/10^20 of network difficulty, ~1.5×10^{-6} expected hashes for minimal txs, verifiable as sub-nanosecond on a Ryzen 9 CPU at ~2 GH/s SHA256 rate per crypto.stackexchange benchmarks) to enable wallet-side computation for normal txs (~500-700 byte medians per BitcoinVisuals), while scaling linearly for bloat (e.g., 100 KB requires ~30 minutes on 1-2 Antminer S19 Pros at 110 TH/s and 3250 W each, costing ~$0.16-0.32 at 15-17 ¢/kWh U.S. average per electricchoice.com/EIA data, exceeding typical spam fees of $0.01-1 per mempool.space).
Unsolved txs are relayable in mempool (facilitating off-chain solver markets) but invalid for block inclusion—miners/third parties must solve first, questioning miner incentives (pools control 80% hashrate per Blockchain.com, favoring short-term fees over solving diversion). For solver payments, initial txs use multi-output structures: one output for block miner fees (excess inputs-outputs), another provisional output for solver fees (e.g., via OP_RETURN placeholder or SIGHASH_ANYONECANPAY partial sig for flexibility); solvers RBF the tx to insert their address for the solver output, claiming upon confirmation. This eliminates underdefinition risks, as verifiable RBF adoption (~60% per node surveys) supports fee bumps without theft (solvers only modify their claim). Multiplier/thresholds retarget every 2016 blocks like difficulty, based on avg block bloat metrics (e.g., if >2 MB, increase scaling factor 10%). No phasing—direct soft fork proposal, as data shows optional policies under-adopt (e.g., RBF at 60%), risking evasion; testnet simulations first to verify (e.g., model 50% bloat reduction without usability breaks).
This inverts Satoshi's PoW inventively: all txs require work pre-submission or via solvers, solving for spam without narratives—raw costs (watts/sats) question incentives of spam enablers (e.g., why push limit removal if data verifies bloat harms decentralization?).
## Copyright
This BIP is licensed under the 2-clause BSD license.
## Motivation
Verifiable data exposes spam incentives: Ordinals spiked blocks 40% (Dune Analytics), benefiting centralized miners (top 5 pools 80% hashrate) via fees but questioning long-term security (Cambridge Electricity Index: 10% underutilized hashrate could activate via solvers, but spam profits exceed costs without taxes). Filters evade ~30% via witness (chain analysis); limits shift problems. Mandatory PoW for all txs—wallets solve small ones instantly (CPU/GPU viable at low base), solvers handle large—deters without bans, as 70% txs are simple payments (BitcoinVisuals). Question propaganda: "Opt-in preserves freedom" spin from spam projects ignores data on under-enforcement; mandatory quantifies costs (e.g., 30-min solve at 6500 W total = 3.25 kWh = ~$0.49-0.55 at avg rates), making bloat uneconomical unless value > externalities.
Modes solve holistically: Mode 1 targets OP_RETURN (~30% spam); Mode 2 all bloat (~40% from inputs/outputs). Retargeting ties to data (on-chain avg sizes), eliminating biases. Benefits: Decentralizes via solver bounties (idle hardware earns $2-10/solve); aligns with PoW's scarcity without dilution (<0.0001% network impact per tx, verifiable via hashrate metrics).
## Specification
### Overview
- **Mandatory for All Txs:** PoW required pre-submission or via solvers; unsolved relayable in mempool but invalid in blocks.
- **Modes:**
- **Mode 1: OP_RETURN Size.**
- **Mode 2: Overall Tx Size.** Activate Mode 1 first; data-trigger Mode 2.
- **Transaction Version:** v3 adds 4-byte nonce post-locktime.
- **PoW Computation:** SHA256d of tx serialization with nonce.
- **Base Difficulty:** Drastically lowered to network difficulty / 10^20 (~1.5×10^{-6} at 150.84T network D per CoinWarz/CoinDesk, expected hashes ~1, instant on Ryzen 9 at 2 GH/s or RTX 4090 at ~1 GH/s per hashrate.no/Reddit benchmarks).
- **Scaling Multiplier (Optimized to Linear/Power-Law):**
- *scaled_size* = OP_RETURN bytes (Mode 1) or full tx bytes (Mode 2).
- Threshold: 4 (Mode 1) or 200 (Mode 2).
- M = 1 + k * (scaled_size - threshold), with k tuned for deterrence (e.g., k=4×10^6 per byte for 100 KB M~4×10^11, hashes~6×10^{-6} * 4×10^11 = 2.4×10^6 base-scaled, but wait—correct: expected hashes = base_D * M = (1.5×10^{-6}) * (1 + 4×10^6 * 99,800) ≈ (1.5×10^{-6}) * 4×10^11 ≈ 6×10^5 hashes for small, scaling to ~2.4×10^17 for 100 KB—30 min on 2 S19s at 2.2×10^14 h/s, verifiable without explosions).
- Power-law alternative: M = [(scaled_size / threshold)^1.4] for similar cap (e.g., 100 KB / 200 = 500, 500^1.4 ≈ 2.7×10^9, adjustable via data).
- **No Limits:** Sizes to block max, but costs deter (e.g., 100 KB: $0.49-0.55 power).
- **Validation (Consensus):**
- v3 txs invalid without PoW; legacy over-threshold non-standard, must upgrade.
- **Computation Paths:**
1. **Wallet Pre-Compute:** Solve nonce locally for small txs (majority viable on CPU/GPU).
2. **Solver Assistance:** Submit unsolved to mempool; solvers (miners/third parties) compute nonce off-chain (via Nostr/X markets or pool APIs), RBF to insert their address in solver fee output, resubmit solved. Initial tx: Multi-outputs with block miner fee (excess) + provisional solver output (e.g., 1000 sats scaled by size, placeholder script allowing RBF claim via ANYONECANPAY). Upon solve/RBF, solver sets destination; block inclusion pays both—verifiable no risk (RBF only modifies claim, tx hash recomputes with nonce).
- **Mempool Policy:** Relay unsolved (low-priority, min feerate 10x standard to deter floods); prioritize solved. Cap unsolved at 10% mempool (~30 MB/node).
- **Block Templates:** Miners solve unsolved txs before inclusion (diversion <0.1%, data-verifiable).
- **Retargeting:** Base + k/thresholds adjust every 2016 blocks like difficulty, based on median block size (e.g., if >2 MB, k +=10%; data from blockchain.com metrics).
### Mathematical Formulation
- *D_network* = ~150.84×10^12.
- Base_D = D_network / 10^20 ≈ 1.5×10^{-6}.
- *M* = 1 + k * (scaled_size - threshold) [linear for computability].
- Expected hashes = Base_D * M.
- Target = 2^256 / (Base_D * M).
- Valid if SHA256d(tx_with_nonce) < Target.
For 500-byte avg: M~1 + 4×10^6 *300 ≈ 1.2×10^9, hashes~1.8×10^3—instant on CPU.
## Rationale
Mandating PoW for submission (wallets for small, solvers for large) solves deterrence: Verifiable small txs free-ish, large painful for miners (opportunity cost ~$300K/block skipped), questioning incentives (spam projects profit < costs). Unsolved in mempool enables markets without DoS (feerate caps). Multi-output RBF variant aligns payments—data shows RBF safe (no major exploits). Lower base/linear scaling fixes impossibility (no overflows, doable on home hardware: RTX 4090 ~1 GH/s handles medium txs in seconds). Retargeting data-drives aggression, eliminating spin. Game theory: Equilibrium favors lean txs; solvers earn only if bounties > power ($0.49-0.55/30 min), decentralizing (20% small ops per Cambridge).
Compared to status quo: Evades less (mandatory); quantifies without judgment.
Edge cases: Diversion mitigated by low base; RBF risks low (verifiable 60% usage).
## Backwards Compatibility
Soft fork: Pre-fork nodes relay unsolved as non-standard but accept solved blocks. Legacy small txs ok; large must PoW.
## Security Considerations
Fractional work; mempool caps prevent floods. Economic: Spammers pay upfront or bounties > value.
## Deployment
Miner signaling (bit 4); no phase—testnet sims verify first (e.g., spam drop metrics).
## Reference Implementation
[Placeholder pseudocode:]
```
def compute_nested_target(tx, current_difficulty, mode):
if mode == 'op_return':
scaled_size = sum(len(op_return) for op_return in tx.op_returns)
threshold = 4
elif mode == 'full_tx':
scaled_size = len(tx.serialize_without_nonce())
threshold = 200
base_diff = current_difficulty / 1e20 # Drastic lower
k = get_retargeted_k() # From chain data
if scaled_size <= threshold:
multiplier = 1
else:
multiplier = 1 + k * (scaled_size - threshold) # Linear
return base_diff * multiplier
def validate_nested_pow(tx):
if tx.version < 3:
return True if not requires_pow(tx, mode) else False # Legacy check
target_diff = compute_nested_target(tx, get_current_difficulty(), mode)
hash_value = sha256d(tx.serialize_with_nonce())
return hash_value < (2**256 / target_diff)
```
## Acknowledgments
Nostr data-inspired; prioritizes verifiable costs (e.g., S19 3250 W benchmarks per minerstat.com).
## Changes Needed for Implementation
1. **Consensus/Data Verification:** Post to bitcoin-dev with models (e.g., Python sims of hashes/time: 30 min target verifiable at 2.2e14 h/s). Question resistance from spam interests (data: Ordinals funding ties).
2. **Code Updates:** Add v3 parsing, mempool unsolved relay (~200 LoC); RBF extensions for solver outputs (~150 LoC in src/policy/rbf.cpp).
3. **Testing:** Testnet full rollout—no phase; simulate floods/solves, verify bloat drop (50% target via Blockchair APIs).
4. **Risks:** Miner diversion—mitigate with data-proven low impact (<0.1%).
5. **Timeline:** 3 months review; 6 months activation.
6. **Inventive Solve:** If stalled, Knots policy proof-of-concept; data drives merge.
nostr:nevent1qvzqqqqqqypzpcnfv8qm6a85kwqp4ste0qpgshdv097y8metpj2sctknvyf2j8ufqqsdry5nlg3dmnfzgz9g0s5tnse4gr7q7le939lplw8sgry2qq4ew8qxcmxvm