This Pull Request introduces Pay-to-WOTS (P2WOTS), a new native Bitcoin output type using witness version 3 that provides unconditional post quantum security using only SHA-256. P2WOTS contains no elliptic-curve key material anywhere.
The threat: Shor's algorithm breaks secp256k1 in polynomial time on a cryptographically relevant quantum computer.
-Design- scriptPubKey 34 bytes OP_3 (0x53) || PUSH32 (0x20) || commitment[32]
In single signer mode the 32 byte commitment is a Merkle Key Tree root over 64 independent WOTS+ key pairs derived from the owner's own master secret. Each incoming UTXO is spent using an independent slot key.
Single sig spending witness (42 items) Items | Content
[0..33] | 34 WOTS+ chain elements (32 bytes each) [34] | slot_nonce, per-slot domain separator [35] | key_index, which of 64 slots (0-63) [36..41] | auth_path[0..5], Merkle sibling nodes
The k-of-n multisig uses the same 34 byte scriptPubKey format with the commitment = SHA("wots39-multisig-v1" || k || n || root[0] || ... || root[n-1])
The Sighash is structurally identical to BIP-341, reusing PrecomputedTransactionData cache = TaggedHash("P2WOTS/sighash", epoch || hash_type || nVersion || nLockTime || sha_prevouts || sha_amounts || sha_scriptpubkeys || sha_sequences || sha_outputs || spend_type || input_index)
-Deployment- Deployed as a soft fork via witness version (v3). Pre-SegWit nodes see P2WOTS outputs as anyone-can-spend. Post-SegWit, pre-P2WOTS nodes classify it as WITNESS_UNKNOWN and relay without enforcing. SCRIPT_VERIFY_P2WOTS is currently activated unconditionally in GetBlockScriptFlags(). Production deployment would use a standard BIP9 / BIP8 activation entry.
-New Files- src/crypto/wots_sha256.h -complete WOTS+ library src/test/wots_tests.cpp -C++ unit tests test/functional/test_framework/wots39.py -Python mirror, byte identical test/functional/feature_wots39.py -end to end functional tests on regtest test/functional/bench_wots39.py -Per-block verification benchmarks doc/bip-p2wots.md -Full specification
-Modified Files- src/script/solver -WOTS Witness detection at witnessversion==3 && size==32 src/script/interpreter -SCRIPT_VERIFY_P2WOTS, sighash, full verifier src/script/script_error -SCRIPT_ERR_WOTS_VERIFY src/script/sign -stub case src/addresstype -WitnessUnknown{3, ...} for bech32m round trip src/validation -IsP2WOTSOutput() flag activation