mirror of
https://github.com/bitcoin/bips.git
synced 2025-05-12 12:03:29 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
8c494fc9b8
31
.github/workflows/github-action-checks.yml
vendored
Normal file
31
.github/workflows/github-action-checks.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: GitHub Actions Check
|
||||
run-name: ${{ github.actor }} Checks 🚀
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
Link-Format-Checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: scripts/link-format-chk.sh
|
||||
Build-Table-Checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: scripts/buildtable.pl >/tmp/table.mediawiki || exit 1
|
||||
Diff-Checks:
|
||||
name: "Diff Checks (fails until number assignment)"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- run: scripts/diffcheck.sh
|
||||
Typo-Checks:
|
||||
name: "Typo Checks"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Actions Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check spelling
|
||||
uses: crate-ci/typos@master
|
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
bip-0174/coinjoin-workflow.aux
|
||||
bip-0174/coinjoin-workflow.log
|
||||
bip-0174/coinjoin-workflow.pdf
|
||||
bip-0174/multisig-workflow.aux
|
||||
bip-0174/multisig-workflow.log
|
||||
bip-0174/multisig-workflow.pdf
|
@ -1,7 +0,0 @@
|
||||
os: linux
|
||||
language: generic
|
||||
script:
|
||||
- scripts/link-format-chk.sh
|
||||
- scripts/buildtable.pl >/tmp/table.mediawiki || exit 1
|
||||
- diff README.mediawiki /tmp/table.mediawiki | grep '^[<>] |' >/tmp/after.diff || true
|
||||
- if git checkout HEAD^ && scripts/buildtable.pl >/tmp/table.mediawiki 2>/dev/null; then diff README.mediawiki /tmp/table.mediawiki | grep '^[<>] |' >/tmp/before.diff || true; newdiff=$(diff -s /tmp/before.diff /tmp/after.diff -u | grep '^+'); if [ -n "$newdiff" ]; then echo "$newdiff"; exit 1; fi; else echo 'Cannot build previous commit table for comparison'; fi
|
44
.typos.toml
Normal file
44
.typos.toml
Normal file
@ -0,0 +1,44 @@
|
||||
[default]
|
||||
extend-ignore-re = [
|
||||
# NOTE: use here for regex patterns
|
||||
"xpub.*",
|
||||
"xprv.*",
|
||||
"3.*", # address
|
||||
"5.*", # address
|
||||
"private_key .*",
|
||||
"privkey .*",
|
||||
"tt.*", # <tt> tags
|
||||
"code.*", # <code> tags
|
||||
"\\w*<sub>", # prefix for <sub> tags
|
||||
"OP_SUCCESSx|\\d+",
|
||||
"pay.*",
|
||||
"ser.*",
|
||||
"prefix.*",
|
||||
"value: .*",
|
||||
]
|
||||
|
||||
[default.extend-words]
|
||||
# NOTE: use here for false-positives
|
||||
anc = "anc"
|
||||
PSBT = "PSBT"
|
||||
ser = "ser"
|
||||
# Names
|
||||
Atack = "Atack"
|
||||
Meni = "Meni"
|
||||
Ono = "Ono"
|
||||
|
||||
[files]
|
||||
extend-exclude = [
|
||||
"/*/*.csv",
|
||||
"/*.d*",
|
||||
"/*/*.d*",
|
||||
"/*/*.go",
|
||||
"/*/*.json",
|
||||
"/*/*/*.json",
|
||||
"/*/*.mod",
|
||||
"/*/*.proto",
|
||||
"/*/*.py",
|
||||
"scripts",
|
||||
"/*/*.s*",
|
||||
"/*/*.t*",
|
||||
]
|
12
CONTRIBUTING.md
Normal file
12
CONTRIBUTING.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Contributing Guidelines
|
||||
|
||||
Apart from following [BIP 2](./bip-0002.mediawiki),
|
||||
we do CI checks to ensure that the proposed BIPs do not have common typos.
|
||||
These checks are done using [`typos`](https://github.com/crate-ci/typos).
|
||||
To check for typos locally,
|
||||
install [`typos`](https://github.com/crate-ci/typos)
|
||||
and then run in the root directory:
|
||||
|
||||
```bash
|
||||
typos
|
||||
```
|
298
README.mediawiki
298
README.mediawiki
@ -1,4 +1,4 @@
|
||||
People wishing to submit BIPs, first should propose their idea or document to the [https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev bitcoin-dev@lists.linuxfoundation.org] mailing list (do <em>not</em> assign a number - read <a href="bip-0002.mediawiki">BIP 2</a> for the full process). After discussion, please open a PR. After copy-editing and acceptance, it will be published here.
|
||||
People wishing to submit BIPs, first should propose their idea or document to the [https://groups.google.com/g/bitcoindev bitcoindev@googlegroups.com] mailing list (do <em>not</em> assign a number - read <a href="bip-0002.mediawiki">BIP 2</a> for the full process). After discussion, please open a PR. After copy-editing and acceptance, it will be published here.
|
||||
|
||||
We are fairly liberal with approving BIPs, and try not to be too involved in decision making on behalf of the community. The exception is in very rare cases of dispute resolution when a decision is contentious and cannot be agreed upon. In those cases, the conservative option will always be preferred.
|
||||
|
||||
@ -202,13 +202,13 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Mike Caldwell, Aaron Voisine
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #ffffcf"
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0039.mediawiki|39]]
|
||||
| Applications
|
||||
| Mnemonic code for generating deterministic keys
|
||||
| Marek Palatinus, Pavol Rusnak, Aaron Voisine, Sean Bowe
|
||||
| Standard
|
||||
| Proposed
|
||||
| Final
|
||||
|-
|
||||
| 40
|
||||
| API/RPC
|
||||
@ -235,15 +235,15 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Applications
|
||||
| Purpose Field for Deterministic Wallets
|
||||
| Marek Palatinus, Pavol Rusnak
|
||||
| Informational
|
||||
| Standard
|
||||
| Final
|
||||
|- style="background-color: #ffffcf"
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0044.mediawiki|44]]
|
||||
| Applications
|
||||
| Multi-Account Hierarchy for Deterministic Wallets
|
||||
| Marek Palatinus, Pavol Rusnak
|
||||
| Standard
|
||||
| Proposed
|
||||
| Final
|
||||
|- style="background-color: #ffffcf"
|
||||
| [[bip-0045.mediawiki|45]]
|
||||
| Applications
|
||||
@ -252,12 +252,19 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Standard
|
||||
| Proposed
|
||||
|-
|
||||
| [[bip-0046.mediawiki|46]]
|
||||
| Applications
|
||||
| Address Scheme for Timelocked Fidelity Bonds
|
||||
| Chris Belcher, Thebora Kompanioni
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0047.mediawiki|47]]
|
||||
| Applications
|
||||
| Reusable Payment Codes for Hierarchical Deterministic Wallets
|
||||
| Justus Ranvier
|
||||
| Informational
|
||||
| Draft
|
||||
| Final
|
||||
|- style="background-color: #ffffcf"
|
||||
| [[bip-0048.mediawiki|48]]
|
||||
| Applications
|
||||
@ -270,7 +277,7 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Applications
|
||||
| Derivation scheme for P2WPKH-nested-in-P2SH based accounts
|
||||
| Daniel Weigl
|
||||
| Informational
|
||||
| Standard
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0050.mediawiki|50]]
|
||||
@ -434,27 +441,27 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Eric Lombrozo
|
||||
| Standard
|
||||
| Rejected
|
||||
|-
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0084.mediawiki|84]]
|
||||
| Applications
|
||||
| Derivation scheme for P2WPKH based accounts
|
||||
| Pavol Rusnak
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Standard
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0085.mediawiki|85]]
|
||||
| Applications
|
||||
| Deterministic Entropy From BIP32 Keychains
|
||||
| Ethan Kosakovsky
|
||||
| Ethan Kosakovsky, Aneesh Karve
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0086.mediawiki|86]]
|
||||
| Applications
|
||||
| Key Derivation for Single Key P2TR Outputs
|
||||
| Andrew Chow
|
||||
| Ava Chow
|
||||
| Standard
|
||||
| Draft
|
||||
| Final
|
||||
|- style="background-color: #ffffcf"
|
||||
| [[bip-0087.mediawiki|87]]
|
||||
| Applications
|
||||
@ -484,6 +491,20 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Standard
|
||||
| Final
|
||||
|-
|
||||
| [[bip-0093.mediawiki|93]]
|
||||
| Applications
|
||||
| codex32: Checksummed SSSS-aware BIP32 seeds
|
||||
| Leon Olsson Curr, Pearlwort Sneed, Andrew Poelstra
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0094.mediawiki|94]]
|
||||
| Applications
|
||||
| Testnet 4
|
||||
| Fabian Jahr
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0098.mediawiki|98]]
|
||||
| Consensus (soft fork)
|
||||
| Fast Merkle Trees
|
||||
@ -658,13 +679,13 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Eric Lombrozo, William Swanson
|
||||
| Informational
|
||||
| Rejected
|
||||
|- style="background-color: #ffffcf"
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0125.mediawiki|125]]
|
||||
| Applications
|
||||
| Opt-in Full Replace-by-Fee Signaling
|
||||
| David A. Harding, Peter Todd
|
||||
| Standard
|
||||
| Proposed
|
||||
| Final
|
||||
|-
|
||||
| [[bip-0126.mediawiki|126]]
|
||||
|
|
||||
@ -686,13 +707,13 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Hugo Nguyen, Peter Gray, Marko Bencun, Aaron Chen, Rodolfo Novak
|
||||
| Standard
|
||||
| Proposed
|
||||
|- style="background-color: #ffffcf"
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0130.mediawiki|130]]
|
||||
| Peer Services
|
||||
| sendheaders message
|
||||
| Suhas Daftuar
|
||||
| Standard
|
||||
| Proposed
|
||||
| Final
|
||||
|- style="background-color: #ffcfcf"
|
||||
| [[bip-0131.mediawiki|131]]
|
||||
| Consensus (hard fork)
|
||||
@ -707,13 +728,13 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Andy Chase
|
||||
| Process
|
||||
| Withdrawn
|
||||
|-
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0133.mediawiki|133]]
|
||||
| Peer Services
|
||||
| feefilter message
|
||||
| Alex Morcos
|
||||
| Standard
|
||||
| Draft
|
||||
| Final
|
||||
|- style="background-color: #ffcfcf"
|
||||
| [[bip-0134.mediawiki|134]]
|
||||
| Consensus (hard fork)
|
||||
@ -818,14 +839,14 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Peer Authentication
|
||||
| Jonas Schnelli
|
||||
| Standard
|
||||
| Draft
|
||||
| Deferred
|
||||
|- style="background-color: #ffcfcf"
|
||||
| [[bip-0151.mediawiki|151]]
|
||||
| Peer Services
|
||||
| Peer-to-Peer Communication Encryption
|
||||
| Jonas Schnelli
|
||||
| Standard
|
||||
| Withdrawn
|
||||
| Replaced
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0152.mediawiki|152]]
|
||||
| Peer Services
|
||||
@ -868,13 +889,13 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Olaoluwa Osuntokun, Alex Akselrod
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0159.mediawiki|159]]
|
||||
| Peer Services
|
||||
| NODE_NETWORK_LIMITED service bit
|
||||
| Jonas Schnelli
|
||||
| Standard
|
||||
| Draft
|
||||
| Final
|
||||
|- style="background-color: #ffcfcf"
|
||||
| [[bip-0171.mediawiki|171]]
|
||||
| Applications
|
||||
@ -893,7 +914,7 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| [[bip-0174.mediawiki|174]]
|
||||
| Applications
|
||||
| Partially Signed Bitcoin Transaction Format
|
||||
| Andrew Chow
|
||||
| Ava Chow
|
||||
| Standard
|
||||
| Final
|
||||
|- style="background-color: #ffcfcf"
|
||||
@ -980,6 +1001,13 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Karl-Johan Alm
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0324.mediawiki|324]]
|
||||
| Peer Services
|
||||
| Version 2 P2P Encrypted Transport Protocol
|
||||
| Dhruv Mehta, Tim Ruffing, Jonas Schnelli, Pieter Wuille
|
||||
| Standard
|
||||
| Final
|
||||
|- style="background-color: #ffffcf"
|
||||
| [[bip-0325.mediawiki|325]]
|
||||
| Applications
|
||||
@ -990,10 +1018,31 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
|-
|
||||
| [[bip-0326.mediawiki|326]]
|
||||
| Applications
|
||||
| Anti-fee-sniping protection in taproot transactions
|
||||
| Anti-fee-sniping in taproot transactions
|
||||
| Chris Belcher
|
||||
| Informational
|
||||
| Draft
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0327.mediawiki|327]]
|
||||
|
|
||||
| MuSig2 for BIP340-compatible Multi-Signatures
|
||||
| Jonas Nick, Tim Ruffing, Elliott Jin
|
||||
| Informational
|
||||
| Active
|
||||
|-
|
||||
| [[bip-0328.mediawiki|328]]
|
||||
| Applications
|
||||
| Derivation Scheme for MuSig2 Aggregate Keys
|
||||
| Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0329.mediawiki|329]]
|
||||
| Applications
|
||||
| Wallet Labels Export Format
|
||||
| Craig Raw
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0330.mediawiki|330]]
|
||||
| Peer Services
|
||||
@ -1002,54 +1051,96 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0331.mediawiki|331]]
|
||||
| Peer Services
|
||||
| Ancestor Package Relay
|
||||
| Gloria Zhao
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0337.mediawiki|337]]
|
||||
| API/RPC
|
||||
| Compressed Transactions
|
||||
| Tom Briar
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #ffcfcf"
|
||||
| [[bip-0338.mediawiki|338]]
|
||||
| Peer Services
|
||||
| Disable transaction relay message
|
||||
| Suhas Daftuar
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| Withdrawn
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0339.mediawiki|339]]
|
||||
| Peer Services
|
||||
| WTXID-based transaction relay
|
||||
| Suhas Daftuar
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0340.mediawiki|340]]
|
||||
|
|
||||
| Schnorr Signatures for secp256k1
|
||||
| Pieter Wuille, Jonas Nick, Tim Ruffing
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0341.mediawiki|341]]
|
||||
| Consensus (soft fork)
|
||||
| Taproot: SegWit version 1 spending rules
|
||||
| Pieter Wuille, Jonas Nick, Anthony Towns
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0342.mediawiki|342]]
|
||||
| Consensus (soft fork)
|
||||
| Validation of Taproot Scripts
|
||||
| Pieter Wuille, Jonas Nick, Anthony Towns
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #ffffcf"
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0343.mediawiki|343]]
|
||||
| Consensus (soft fork)
|
||||
| Mandatory activation of taproot deployment
|
||||
| Shinobius, Michael Folkson
|
||||
| Standard
|
||||
| Proposed
|
||||
| Final
|
||||
|-
|
||||
| [[bip-0345.mediawiki|345]]
|
||||
| Consensus (soft fork)
|
||||
| OP_VAULT
|
||||
| James O'Beirne, Greg Sanders
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0347.mediawiki|347]]
|
||||
| Consensus (soft fork)
|
||||
| OP_CAT in Tapscript
|
||||
| Ethan Heilman, Armin Sabouri
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0348.md|348]]
|
||||
| Consensus (soft fork)
|
||||
| CHECKSIGFROMSTACK
|
||||
| Brandon Black, Jeremy Rubin
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0349.md|349]]
|
||||
| Consensus (soft fork)
|
||||
| OP_INTERNALKEY
|
||||
| Brandon Black, Jeremy Rubin
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0350.mediawiki|350]]
|
||||
| Applications
|
||||
| Bech32m format for v1+ witness addresses
|
||||
| Pieter Wuille
|
||||
| Standard
|
||||
| Draft
|
||||
| Final
|
||||
|-
|
||||
| [[bip-0351.mediawiki|351]]
|
||||
| Applications
|
||||
@ -1057,20 +1148,34 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Alfred Hodler, Clark Moody
|
||||
| Informational
|
||||
| Draft
|
||||
|- style="background-color: #ffffcf"
|
||||
| [[bip-0352.mediawiki|352]]
|
||||
| Applications
|
||||
| Silent Payments
|
||||
| josibake, Ruben Somsen
|
||||
| Standard
|
||||
| Proposed
|
||||
|-
|
||||
| [[bip-0353.mediawiki|353]]
|
||||
| Applications
|
||||
| DNS Payment Instructions
|
||||
| Matt Corallo, Bastien Teinturier
|
||||
| Standard
|
||||
| Draft
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0370.mediawiki|370]]
|
||||
| Applications
|
||||
| PSBT Version 2
|
||||
| Andrew Chow
|
||||
| Ava Chow
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0371.mediawiki|371]]
|
||||
| Applications
|
||||
| Taproot Fields for PSBT
|
||||
| Andrew Chow
|
||||
| Ava Chow
|
||||
| Standard
|
||||
| Draft
|
||||
| Final
|
||||
|-
|
||||
| [[bip-0372.mediawiki|372]]
|
||||
| Applications
|
||||
@ -1079,52 +1184,115 @@ Those proposing changes should consider that ultimately consent may rest with th
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0373.mediawiki|373]]
|
||||
| Applications
|
||||
| MuSig2 PSBT Fields
|
||||
| Ava Chow
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0374.mediawiki|374]]
|
||||
| Applications
|
||||
| Discrete Log Equality Proofs
|
||||
| Andrew Toth, Ruben Somsen, Sebastian Falbesoner
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
| Applications
|
||||
| Sending Silent Payments with PSBTs
|
||||
| Andrew Toth, Ava Chow, josibake
|
||||
| Standard
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0379.md|379]]
|
||||
| Applications
|
||||
| Miniscript
|
||||
| Pieter Wuille, Andrew Poelstra, Sanket Kanjalkar, Antoine Poinsot, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0380.mediawiki|380]]
|
||||
| Applications
|
||||
| Output Script Descriptors General Operation
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0381.mediawiki|381]]
|
||||
| Applications
|
||||
| Non-Segwit Output Script Descriptors
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0382.mediawiki|382]]
|
||||
| Applications
|
||||
| Segwit Output Script Descriptors
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0383.mediawiki|383]]
|
||||
| Applications
|
||||
| Multisig Output Script Descriptors
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0384.mediawiki|384]]
|
||||
| Applications
|
||||
| combo() Output Script Descriptors
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0385.mediawiki|385]]
|
||||
| Applications
|
||||
| raw() and addr() Output Script Descriptors
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0386.mediawiki|386]]
|
||||
| Applications
|
||||
| tr() Output Script Descriptors
|
||||
| Pieter Wuille, Andrew Chow
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Final
|
||||
|- style="background-color: #cfffcf"
|
||||
| [[bip-0387.mediawiki|387]]
|
||||
| Applications
|
||||
| Tapscript Multisig Output Script Descriptors
|
||||
| Pieter Wuille, Ava Chow
|
||||
| Informational
|
||||
| Final
|
||||
|- style="background-color: #ffffcf"
|
||||
| [[bip-0388.mediawiki|388]]
|
||||
| Applications
|
||||
| Wallet Policies for Descriptor Wallets
|
||||
| Salvatore Ingala
|
||||
| Standard
|
||||
| Proposed
|
||||
|-
|
||||
| [[bip-0389.mediawiki|389]]
|
||||
| Applications
|
||||
| Multipath Descriptor Key Expressions
|
||||
| Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0390.mediawiki|390]]
|
||||
| Applications
|
||||
| musig() Descriptor Key Expression
|
||||
| Ava Chow
|
||||
| Informational
|
||||
| Draft
|
||||
|-
|
||||
| [[bip-0431.mediawiki|431]]
|
||||
| Applications
|
||||
| Topology Restrictions for Pinning
|
||||
| Gloria Zhao
|
||||
| Informational
|
||||
| Draft
|
||||
|}
|
||||
|
@ -32,13 +32,13 @@ The BIP process begins with a new idea for Bitcoin. Each potential BIP must have
|
||||
Small enhancements or patches to a particular piece of software often don't require standardisation between multiple projects; these don't need a BIP and should be injected into the relevant project-specific development workflow with a patch submission to the applicable issue tracker.
|
||||
Additionally, many ideas have been brought forward for changing Bitcoin that have been rejected for various reasons.
|
||||
The first step should be to search past discussions to see if an idea has been considered before, and if so, what issues arose in its progression.
|
||||
After investigating past work, the best way to proceed is by posting about the new idea to the [https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev Bitcoin development mailing list].
|
||||
After investigating past work, the best way to proceed is by posting about the new idea to the [https://groups.google.com/g/bitcoindev Bitcoin development mailing list].
|
||||
|
||||
Vetting an idea publicly before going as far as writing a BIP is meant to save both the potential author and the wider community time.
|
||||
Asking the Bitcoin community first if an idea is original helps prevent too much time being spent on something that is guaranteed to be rejected based on prior discussions (searching the internet does not always do the trick).
|
||||
It also helps to make sure the idea is applicable to the entire community and not just the author. Just because an idea sounds good to the author does not mean it will work for most people in most areas where Bitcoin is used.
|
||||
|
||||
Once the champion has asked the Bitcoin community as to whether an idea has any chance of acceptance, a draft BIP should be presented to the [https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev Bitcoin development mailing list].
|
||||
Once the champion has asked the Bitcoin community as to whether an idea has any chance of acceptance, a draft BIP should be presented to the [https://groups.google.com/g/bitcoindev Bitcoin development mailing list].
|
||||
This gives the author a chance to flesh out the draft BIP to make it properly formatted, of high quality, and to address additional concerns about the proposal.
|
||||
Following a discussion, the proposal should be submitted to the [https://github.com/bitcoin/bips BIPs git repository] as a pull request.
|
||||
This draft must be written in BIP style as described below, and named with an alias such as "bip-johndoe-infinitebitcoins" until an editor has assigned it a BIP number (authors MUST NOT self-assign BIP numbers).
|
||||
@ -67,8 +67,12 @@ If you are interested in assuming ownership of a BIP, send a message asking to t
|
||||
|
||||
The current BIP editors are:
|
||||
|
||||
* Bryan Bishop ([[mailto:kanzure@gmail.com|kanzure@gmail.com]])
|
||||
* Jon Atack ([[mailto:jon@atack.com|jon@atack.com]])
|
||||
* Luke Dashjr ([[mailto:luke_bipeditor@dashjr.org|luke_bipeditor@dashjr.org]])
|
||||
* Kalle Alm ([[mailto:karljohan-alm@garage.co.jp|karljohan-alm@garage.co.jp]])
|
||||
* Mark "Murch" Erhardt ([[mailto:murch@murch.one|murch@murch.one]])
|
||||
* Olaoluwa Osuntokun ([[mailto:laolu32@gmail.com|laolu32@gmail.com]])
|
||||
* Ruben Somsen ([[mailto:rsomsen@gmail.com|rsomsen@gmail.com]])
|
||||
|
||||
===BIP Editor Responsibilities & Workflow===
|
||||
|
||||
@ -98,11 +102,13 @@ The BIP editor will:
|
||||
|
||||
The BIP editors are intended to fulfill administrative and editorial responsibilities. The BIP editors monitor BIP changes, and update BIP headers as appropriate.
|
||||
|
||||
BIP editors may also, at their option, unilaterally make and merge strictly-editorial changes to BIPs, such as correcting misspellings, fixing broken links, etc.
|
||||
|
||||
==BIP format and structure==
|
||||
|
||||
===Specification===
|
||||
|
||||
BIPs should be written in mediawiki format.
|
||||
BIPs should be written in mediawiki or markdown format.
|
||||
|
||||
Each BIP should have the following parts:
|
||||
|
||||
@ -356,28 +362,28 @@ In this case, only the acceptable license(s) should be listed in the License and
|
||||
* BSD-2-Clause: [https://opensource.org/licenses/BSD-2-Clause OSI-approved BSD 2-clause license]
|
||||
* BSD-3-Clause: [https://opensource.org/licenses/BSD-3-Clause OSI-approved BSD 3-clause license]
|
||||
* CC0-1.0: [https://creativecommons.org/publicdomain/zero/1.0/ Creative Commons CC0 1.0 Universal]
|
||||
* GNU-All-Permissive: [http://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html GNU All-Permissive License]
|
||||
* GNU-All-Permissive: [https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html GNU All-Permissive License]
|
||||
|
||||
In addition, it is recommended that literal code included in the BIP be dual-licensed under the same license terms as the project it modifies. For example, literal code intended for Bitcoin Core would ideally be dual-licensed under the MIT license terms as well as one of the above with the rest of the BIP text.
|
||||
|
||||
====Not recommended, but acceptable licenses====
|
||||
|
||||
* Apache-2.0: [http://www.apache.org/licenses/LICENSE-2.0 Apache License, version 2.0]
|
||||
* BSL-1.0: [http://www.boost.org/LICENSE_1_0.txt Boost Software License, version 1.0]
|
||||
* Apache-2.0: [https://www.apache.org/licenses/LICENSE-2.0 Apache License, version 2.0]
|
||||
* BSL-1.0: [https://www.boost.org/LICENSE_1_0.txt Boost Software License, version 1.0]
|
||||
* CC-BY-4.0: [https://creativecommons.org/licenses/by/4.0/ Creative Commons Attribution 4.0 International]
|
||||
* CC-BY-SA-4.0: [https://creativecommons.org/licenses/by-sa/4.0/ Creative Commons Attribution-ShareAlike 4.0 International]
|
||||
* MIT: [https://opensource.org/licenses/MIT Expat/MIT/X11 license]
|
||||
* AGPL-3.0+: [http://www.gnu.org/licenses/agpl-3.0.en.html GNU Affero General Public License (AGPL), version 3 or newer]
|
||||
* FDL-1.3: [http://www.gnu.org/licenses/fdl-1.3.en.html GNU Free Documentation License, version 1.3]
|
||||
* GPL-2.0+: [http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html GNU General Public License (GPL), version 2 or newer]
|
||||
* LGPL-2.1+: [http://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html GNU Lesser General Public License (LGPL), version 2.1 or newer]
|
||||
* AGPL-3.0+: [https://www.gnu.org/licenses/agpl-3.0.en.html GNU Affero General Public License (AGPL), version 3 or newer]
|
||||
* FDL-1.3: [https://www.gnu.org/licenses/fdl-1.3.en.html GNU Free Documentation License, version 1.3]
|
||||
* GPL-2.0+: [https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html GNU General Public License (GPL), version 2 or newer]
|
||||
* LGPL-2.1+: [https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html GNU Lesser General Public License (LGPL), version 2.1 or newer]
|
||||
|
||||
====Not acceptable licenses====
|
||||
|
||||
All licenses not explicitly included in the above lists are not acceptable terms for a Bitcoin Improvement Proposal unless a later BIP extends this one to add them.
|
||||
However, BIPs predating the acceptance of this BIP were allowed under other terms, and should use these abbreviation when no other license is granted:
|
||||
|
||||
* OPL: [http://opencontent.org/openpub/ Open Publication License, version 1.0]
|
||||
* OPL: [https://opencontent.org/openpub/ Open Publication License, version 1.0]
|
||||
* PD: Released into the public domain
|
||||
|
||||
===Rationale===
|
||||
@ -409,7 +415,6 @@ Why is Public Domain no longer acceptable for new BIPs?
|
||||
* Non-image auxiliary files are permitted in the bip-XXXX subdirectory.
|
||||
* Email addresses are now required for authors.
|
||||
* The Post-History header may be provided as a link instead of a simple date.
|
||||
* Markdown format is no longer permitted for BIPs.
|
||||
* The Resolution header has been dropped, as it is not applicable to a decentralised system where no authority exists to make final decisions.
|
||||
|
||||
==See Also==
|
||||
|
@ -119,7 +119,7 @@ other one simultaneously transitions to STARTED, which would mean both would dem
|
||||
|
||||
Note that a block's state never depends on its own nVersion; only on that of its ancestors.
|
||||
|
||||
case STARTED:
|
||||
case STARTED:
|
||||
if (GetMedianTimePast(block.parent) >= timeout) {
|
||||
return FAILED;
|
||||
}
|
||||
|
22
bip-0009/states.gv
Normal file
22
bip-0009/states.gv
Normal file
@ -0,0 +1,22 @@
|
||||
/* There are many ways to compile this, but one of them is:
|
||||
*
|
||||
* $ dot -Tpng states.gv -o states.png
|
||||
*/
|
||||
digraph {
|
||||
/* States. */
|
||||
DEFINED; FAILED; STARTED; LOCKED_IN; ACTIVE;
|
||||
|
||||
/* Relationships between states, labeled where applicable. */
|
||||
DEFINED -> DEFINED;
|
||||
DEFINED -> FAILED [label = "timeout ≤ MTP"];
|
||||
DEFINED -> STARTED [label = "starttime ≤ MTP < timeout"];
|
||||
FAILED -> FAILED;
|
||||
STARTED -> STARTED;
|
||||
STARTED -> FAILED [label = "timeout ≤ MTP"];
|
||||
STARTED -> LOCKED_IN [label = "(MTP < timeout) AND (threshold reached)"];
|
||||
LOCKED_IN -> ACTIVE [label = "Always"];
|
||||
ACTIVE -> ACTIVE;
|
||||
|
||||
/* Visualization hack to unclutter output. */
|
||||
nodesep = 1.2;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 49 KiB |
@ -93,10 +93,10 @@ The following is an example TxDP from Armory, produced while running on the test
|
||||
|
||||
In this transaction, there are two inputs, one of 150 BTC and the other of 12 BTC. This transaction combines 162 BTC to create two outputs, one of 160 BTC, one 1.9995 BTC, and a tx fee of 0.0005. In this TxDP, both inputs have been signed, and thus could broadcast immediately.
|
||||
|
||||
The style of communication is taken directly from PGP/GPG, which uses blocks of ASCII like this to communicate encrypted messages and signatures. This serialization is compact, and will be interpretted the same in all character encodings. It can be copied inline into an email, or saved in a text file. The advantage over the analogous PGP encoding is that there are some human readable elements to it, for users that wish to examine the TxDP packet manually, instead of requiring a program to parse the core elements of the TxDP.
|
||||
The style of communication is taken directly from PGP/GPG, which uses blocks of ASCII like this to communicate encrypted messages and signatures. This serialization is compact, and will be interpreted the same in all character encodings. It can be copied inline into an email, or saved in a text file. The advantage over the analogous PGP encoding is that there are some human readable elements to it, for users that wish to examine the TxDP packet manually, instead of requiring a program to parse the core elements of the TxDP.
|
||||
|
||||
A party receiving this TxDP can simply add their signature to the appropriate _TXINPUT_ line. If that is the last signature required, they can broadcast it themselves. Any software that implements this standard should be able to combine multiple TxDPs into a single TxDP. However, even without the programmatic support, a user could manually combine them by copying the appropriate _TXSIGS_ lines between serializations, though it is not the recommended method for combining TxDPs.
|
||||
|
||||
== Reference Implementation ==
|
||||
|
||||
This proposal was implemented and tested in the older versions of ''Armory'' Bitcoin software for use in offline-wallet transaction signing (as a 1-of-1 transaction). Implementation can be found in https://github.com/etotheipi/BitcoinArmory/blob/v0.91-beta/armoryengine/Transaction.py under the class PyTxDistProposal. However, as of verion 0.92 released in July 2014, Armory no longer uses this proposal for offline wallet transaction signing and has moved on to a new format.
|
||||
This proposal was implemented and tested in the older versions of ''Armory'' Bitcoin software for use in offline-wallet transaction signing (as a 1-of-1 transaction). Implementation can be found in https://github.com/etotheipi/BitcoinArmory/blob/v0.91-beta/armoryengine/Transaction.py under the class PyTxDistProposal. However, as of version 0.92 released in July 2014, Armory no longer uses this proposal for offline wallet transaction signing and has moved on to a new format.
|
||||
|
@ -43,11 +43,11 @@ OP_EVAL allows the receiver of bitcoins to specify how they can be spent when th
|
||||
|
||||
If ''serialized script'' is a large or complicated multi-signature script, then the burden of paying for it (in increased transaction fees due to more signature operations or transaction size) is shifted from the sender to the receiver.
|
||||
|
||||
The main objection to OP_EVAL is that it adds complexity, and complexity is the enemy of security. Also, evaluating data as code has a long record of being a source of security vulnerabilties.
|
||||
The main objection to OP_EVAL is that it adds complexity, and complexity is the enemy of security. Also, evaluating data as code has a long record of being a source of security vulnerabilities.
|
||||
|
||||
That same argument can be applied to the existing Bitcoin 'scripting' system; scriptPubKeys are transmit as data across the network and are then interpreted by every bitcoin implementation. OP_EVAL just moves the data that will be interpreted. It is debatable whether or not the entire idea of putting a little interpreted expression evaluation language at the core of Bitcoin was brilliant or stupid, but the existence of OP_EVAL does not make the expression language less secure.
|
||||
|
||||
There is a 1-confirmation attack on old clients that interepret OP_EVAL as a no-op, but it is expensive and difficult in practice. The attack is:
|
||||
There is a 1-confirmation attack on old clients that interpret OP_EVAL as a no-op, but it is expensive and difficult in practice. The attack is:
|
||||
|
||||
# Attacker creates an OP_EVAL transaction that is valid as seen by old clients, but invalid for new clients.
|
||||
# Attacker also creates a standard transaction that spends the OP_EVAL transaction, and pays the victim.
|
||||
|
@ -28,7 +28,7 @@ Version bumping can also introduce incompatibilities and fracture the network. I
|
||||
|
||||
By using a protocol version, we set all implementations on the network to a common standard. Everybody is able to agree within their confines what is protocol and what is implementation-dependent. A user agent string is offered as a 'vanity-plate' for clients to distinguish themselves in the network.
|
||||
|
||||
Separation of the network protocol from the implemention, and forming development of said protocol by means of a mutual consensus among participants, has the democratic disadvantage when agreement is hard to reach on contentious issues. To mitigate this issue, strong communication channels and fast release schedules are needed, and are outside the scope of this document (concerning a process-BIP type).
|
||||
Separation of the network protocol from the implementation, and forming development of said protocol by means of a mutual consensus among participants, has the democratic disadvantage when agreement is hard to reach on contentious issues. To mitigate this issue, strong communication channels and fast release schedules are needed, and are outside the scope of this document (concerning a process-BIP type).
|
||||
|
||||
User agents provide extra tracking information that is useful for keeping tabs on network data such as client implementations used or common architectures/operating-systems. In the rare case they may even provide an emergency method of shunning faulty clients that threaten network health- although this is strongly unrecommended and extremely bad form. The user agent does not provide a method for clients to work around and behave differently to different implementations, as this will lead to protocol fracturing.
|
||||
|
||||
|
@ -36,7 +36,7 @@ Their FirstBits alias becomes:
|
||||
|
||||
It is enough information to be given the FirstBits alias ''1brmlab''. When someone wishes to make a purchase, without FirstBits, they either have to type out their address laboriously by hand, scan their QR code (which requires a mobile handset that this author does not own) or find their address on the internet to copy and paste into the client to send bitcoins. FirstBits alleviates this impracticality by providing an easy method to make payments.
|
||||
|
||||
Together with [[vanitygen|Vanitygen (vanity generator)]], it becomes possible to create memorable unique named addresses. Addresses that are meaningful, rather than an odd assemblage of letters and numbers but add context to the destination.
|
||||
Together with Vanitygen (vanity generator), it becomes possible to create memorable unique named addresses. Addresses that are meaningful, rather than an odd assemblage of letters and numbers but add context to the destination.
|
||||
|
||||
However FirstBits has its own problems. One is that the possible aliases one is able to generate is limited by the available computing power available. It may not be feasible to generate a complete or precise alias that is wanted- only approximates may be possible. It is also computationally resource intensive which means a large expenditure of power for generating unique aliases in the future, and may not scale up to the level of individuals at home or participants with hand-held devices in an environment of ubiquitous computing.
|
||||
|
||||
@ -208,7 +208,7 @@ NameResolutionService::~NameResolutionService()
|
||||
|
||||
void NameResolutionService::ExplodeHandle(const string& strHandle, string& strNickname, string& strDomain)
|
||||
{
|
||||
// split address at @ furthrest to the right
|
||||
// split address at @ furthest to the right
|
||||
size_t nPosAtsym = strHandle.rfind('@');
|
||||
strNickname = strHandle.substr(0, nPosAtsym);
|
||||
strDomain = strHandle.substr(nPosAtsym + 1, strHandle.size());
|
||||
@ -348,7 +348,7 @@ By using DNS lookups, the MITM problem with IP transactions could be mitigated b
|
||||
|
||||
=== Namecoin ID ===
|
||||
|
||||
This proposal uses the Namecoin blockchain to associate an alias with a bitcoin address. Bitcoin queries a namecoin node. This retreives the structured data containing the bitcoin address(es) associated with this alias.
|
||||
This proposal uses the Namecoin blockchain to associate an alias with a bitcoin address. Bitcoin queries a namecoin node. This retrieves the structured data containing the bitcoin address(es) associated with this alias.
|
||||
|
||||
Using a decentralised domain name system like Namecoin, means no external server or entity needs to be trusted unlike the other proposals listed here. This indicates a system with the advantage of having a high availability and ease of entry (no restrictions for users to create aliases).
|
||||
|
||||
@ -401,4 +401,4 @@ Any text can be put into the brackets, allowing merchants to adapt it to all the
|
||||
New features can be added later to support uncovered cases.
|
||||
|
||||
|
||||
See the specification of [http://dot-bit.org/Namespace:Identity Namecoin ID] for more informations.
|
||||
See the specification of [http://dot-bit.org/Namespace:Identity Namecoin ID] for more information.
|
||||
|
@ -86,7 +86,7 @@ Avoiding a block-chain split by malicious pay-to-script transactions requires ca
|
||||
|
||||
* A pay-to-script-hash transaction that is invalid for new clients/miners but valid for old clients/miners.
|
||||
|
||||
To gracefully upgrade and ensure no long-lasting block-chain split occurs, more than 50% of miners must support full validation of the new transaction type and must switch from the old validation rules to the new rules at the same time.
|
||||
To gracefully upgrade and ensure no long-lasting block-chain split occurs, more than 50% of miners must support full validation of the new transaction type and must switch from the old validation rules to the new rules at the same time.
|
||||
|
||||
To judge whether or not more than 50% of hashing power supports this BIP, miners are asked to upgrade their software and put the string "p2sh/CHV" in the input of the coinbase transaction for blocks that they create.
|
||||
|
||||
|
@ -37,7 +37,7 @@ Elements of the query component may contain characters outside the valid range.
|
||||
|
||||
=== ABNF grammar ===
|
||||
|
||||
(See also [[#Simpler syntax|a simpler representation of syntax]])
|
||||
(See also [[#simpler-syntax|a simpler representation of syntax]])
|
||||
|
||||
bitcoinurn = "bitcoin:" bitcoinaddress [ "?" bitcoinparams ]
|
||||
bitcoinaddress = *base58
|
||||
@ -120,11 +120,6 @@ Some future version that has variables which are (currently) not understood but
|
||||
|
||||
Characters must be URI encoded properly.
|
||||
|
||||
== Reference Implementations ==
|
||||
=== Bitcoin clients ===
|
||||
* Bitcoin-Qt supports the old version of Bitcoin URIs (ie without the req- prefix), with Windows and KDE integration as of commit 70f55355e29c8e45b607e782c5d76609d23cc858.
|
||||
== Reference Implementation ==
|
||||
|
||||
=== Libraries ===
|
||||
* Javascript - https://github.com/bitcoinjs/bip21
|
||||
* Java - https://github.com/SandroMachado/BitcoinPaymentURI
|
||||
* Swift - https://github.com/SandroMachado/BitcoinPaymentURISwift
|
||||
Bitcoin-Qt supports the old version of Bitcoin URIs (ie without the req- prefix), with Windows and KDE integration as of commit 70f55355e29c8e45b607e782c5d76609d23cc858.
|
||||
|
@ -25,7 +25,7 @@ This document describes hierarchical deterministic wallets (or "HD Wallets"): wa
|
||||
|
||||
The specification is intended to set a standard for deterministic wallets that can be interchanged between different clients. Although the wallets described here have many features, not all are required by supporting clients.
|
||||
|
||||
The specification consists of two parts. In a first part, a system for deriving a tree of keypairs from a single seed is presented. The second part demonstrates how to build a wallet structure on top of such a tree.
|
||||
The specification consists of two parts. In the first part, a system for deriving a tree of keypairs from a single seed is presented. The second part demonstrates how to build a wallet structure on top of such a tree.
|
||||
|
||||
==Copyright==
|
||||
|
||||
@ -37,7 +37,7 @@ The Bitcoin reference client uses randomly generated keys. In order to avoid the
|
||||
|
||||
Deterministic wallets do not require such frequent backups, and elliptic curve mathematics permit schemes where one can calculate the public keys without revealing the private keys. This permits for example a webshop business to let its webserver generate fresh addresses (public key hashes) for each order or for each customer, without giving the webserver access to the corresponding private keys (which are required for spending the received funds).
|
||||
|
||||
However, deterministic wallets typically consist of a single "chain" of keypairs. The fact that there is only one chain means that sharing a wallet happens on an all-or-nothing basis. However, in some cases one only wants some (public) keys to be shared and recoverable. In the example of a webshop, the webserver does not need access to all public keys of the merchant's wallet; only to those addresses which are used to receive customer's payments, and not for example the change addresses that are generated when the merchant spends money. Hierarchical deterministic wallets allow such selective sharing by supporting multiple keypair chains, derived from a single root.
|
||||
However, deterministic wallets typically consist of a single "chain" of keypairs. The fact that there is only one chain means that sharing a wallet happens on an all-or-nothing basis. However, in some cases one only wants some (public) keys to be shared and recoverable. In the example of a webshop, the webserver does not need access to all public keys of the merchant's wallet; only to those addresses which are used to receive customers' payments, and not for example the change addresses that are generated when the merchant spends money. Hierarchical deterministic wallets allow such selective sharing by supporting multiple keypair chains, derived from a single root.
|
||||
|
||||
==Specification: Key derivation==
|
||||
|
||||
@ -104,7 +104,7 @@ The function N((k, c)) → (K, c) computes the extended public key correspond
|
||||
To compute the public child key of a parent private key:
|
||||
* N(CKDpriv((k<sub>par</sub>, c<sub>par</sub>), i)) (works always).
|
||||
* CKDpub(N(k<sub>par</sub>, c<sub>par</sub>), i) (works only for non-hardened child keys).
|
||||
The fact that they are equivalent is what makes non-hardened keys useful (one can derive child public keys of a given parent key without knowing any private key), and also what distinguishes them from hardened keys. The reason for not always using non-hardened keys (which are more useful) is security; see further for more information.
|
||||
The fact that they are equivalent is what makes non-hardened keys useful (one can derive child public keys of a given parent key without knowing any private key), and also what distinguishes them from hardened keys. The reason for not always using non-hardened keys (which are more useful) is security; see further below for more information.
|
||||
|
||||
====Public parent key → private child key====
|
||||
|
||||
@ -184,7 +184,7 @@ When a business has several independent offices, they can all use wallets derive
|
||||
====Recurrent business-to-business transactions: N(m/i<sub>H</sub>/0)====
|
||||
|
||||
In case two business partners often transfer money, one can use the extended public key for the external chain of a specific account (M/i h/0) as a sort of "super address", allowing frequent transactions that cannot (easily) be associated, but without needing to request a new address for each payment.
|
||||
Such a mechanism could also be used by mining pool operators as variable payout address.
|
||||
Such a mechanism could also be used by mining pool operators as a variable payout address.
|
||||
|
||||
====Unsecure money receiver: N(m/i<sub>H</sub>/0)====
|
||||
|
||||
@ -212,7 +212,7 @@ Private and public keys must be kept safe as usual. Leaking a private key means
|
||||
Somewhat more care must be taken regarding extended keys, as these correspond to an entire (sub)tree of keys.
|
||||
|
||||
One weakness that may not be immediately obvious, is that knowledge of a parent extended public key plus any non-hardened private key descending from it is equivalent to knowing the parent extended private key (and thus every private and public key descending from it). This means that extended public keys must be treated more carefully than regular public keys.
|
||||
It is also the reason for the existence of hardened keys, and why they are used for the account level in the tree. This way, a leak of account-specific (or below) private key never risks compromising the master or other accounts.
|
||||
It is also the reason for the existence of hardened keys, and why they are used for the account level in the tree. This way, a leak of account-specific (or below) private keys never risks compromising the master or other accounts.
|
||||
|
||||
|
||||
==Test Vectors==
|
||||
|
@ -16,7 +16,7 @@ Make a network node's transaction memory pool accessible via a new "mempool" mes
|
||||
|
||||
==Motivation==
|
||||
|
||||
Several use cases make it desireable to expose a network node's transaction memory pool:
|
||||
Several use cases make it desirable to expose a network node's transaction memory pool:
|
||||
# SPV clients, wishing to obtain zero-confirmation transactions sent or received.
|
||||
# Miners, to avoid missing lucrative fees, downloading existing network transactions after a restart.
|
||||
# Remote network diagnostics.
|
||||
|
@ -36,10 +36,10 @@ Password and passphrase-protected private keys enable new practical use cases fo
|
||||
This proposal is hereby placed in the public domain.
|
||||
|
||||
==Rationale==
|
||||
:'''''User story:''' As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.''
|
||||
:'''''User story:''' As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds. I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).''
|
||||
:'''''User story:''' (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key. I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.''
|
||||
:'''''User story:''' (EC multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.
|
||||
:'' '''User story:''' As a Bitcoin user who uses paper wallets, I would like the ability to add encryption, so that my Bitcoin paper storage can be two factor: something I have plus something I know.''
|
||||
:'' '''User story:''' As a Bitcoin user who would like to pay a person or a company with a private key, I do not want to worry that any part of the communication path may result in the interception of the key and theft of my funds. I would prefer to offer an encrypted private key, and then follow it up with the password using a different communication channel (e.g. a phone call or SMS).''
|
||||
:'' '''User story:''' (EC-multiplied keys) As a user of physical bitcoins, I would like a third party to be able to create password-protected Bitcoin private keys for me, without them knowing the password, so I can benefit from the physical bitcoin without the issuer having access to the private key. I would like to be able to choose a password whose minimum length and required format does not preclude me from memorizing it or engraving it on my physical bitcoin, without exposing me to an undue risk of password cracking and/or theft by the manufacturer of the item.''
|
||||
:'' '''User story:''' (EC-multiplied keys) As a user of paper wallets, I would like the ability to generate a large number of Bitcoin addresses protected by the same password, while enjoying a high degree of security (highly expensive scrypt parameters), but without having to incur the scrypt delay for each address I generate.''
|
||||
|
||||
==Specification==
|
||||
This proposal makes use of the following functions and definitions:
|
||||
@ -47,12 +47,12 @@ This proposal makes use of the following functions and definitions:
|
||||
*'''AES256Encrypt, AES256Decrypt''': the simple form of the well-known AES block cipher without consideration for initialization vectors or block chaining. Each of these functions takes a 256-bit key and 16 bytes of input, and deterministically yields 16 bytes of output.
|
||||
*'''SHA256''', a well-known hashing algorithm that takes an arbitrary number of bytes as input and deterministically yields a 32-byte hash.
|
||||
*'''scrypt''': A well-known key derivation algorithm. It takes the following parameters: (string) password, (string) salt, (int) n, (int) r, (int) p, (int) length, and deterministically yields an array of bytes whose length is equal to the length parameter.
|
||||
*'''ECMultiply''': Multiplication of an elliptic curve point by a scalar integer with respect to the [[secp256k1]] elliptic curve.
|
||||
*'''G, N''': Constants defined as part of the [[secp256k1]] elliptic curve. G is an elliptic curve point, and N is a large positive integer.
|
||||
*'''[[Base58Check]]''': a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.
|
||||
*'''ECMultiply''': Multiplication of an elliptic curve point by a scalar integer with respect to the secp256k1 elliptic curve.
|
||||
*'''G, N''': Constants defined as part of the secp256k1 elliptic curve. G is an elliptic curve point, and N is a large positive integer.
|
||||
*'''Base58Check''': a method for encoding arrays of bytes using 58 alphanumeric characters commonly used in the Bitcoin ecosystem.
|
||||
|
||||
===Prefix===
|
||||
It is proposed that the resulting Base58Check-encoded string start with a '6'. The number '6' is intended to represent, from the perspective of the user, "a private key that needs something else to be usable" - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix '5' most commonly observed in [[Wallet Import Format]] which denotes an unencrypted private key.
|
||||
It is proposed that the resulting Base58Check-encoded string start with a '6'. The number '6' is intended to represent, from the perspective of the user, "a private key that needs something else to be usable" - an umbrella definition that could be understood in the future to include keys participating in multisig transactions, and was chosen with deference to the existing prefix '5' most commonly observed in Wallet Import Format which denotes an unencrypted private key.
|
||||
|
||||
It is proposed that the second character ought to give a hint as to what is needed as a second factor, and for an encrypted key requiring a passphrase, the uppercase letter P is proposed.
|
||||
|
||||
@ -64,7 +64,7 @@ To keep the size of the encrypted key down, no initialization vectors (IVs) are
|
||||
* How the user sees it: 58 characters always starting with '6P'
|
||||
** Visual cues are present in the third character for visually identifying the EC-multiply and compress flag.
|
||||
* Count of payload bytes (beyond prefix): 37
|
||||
** 1 byte (''flagbyte''):
|
||||
** 1 byte (''flagbyte''):
|
||||
*** the most significant two bits are set as follows to preserve the visibility of the compression flag in the prefix, as well as to keep the payload within the range of allowable values that keep the "6P" prefix intact. For non-EC-multiplied keys, the bits are 11. For EC-multiplied keys, the bits are 00.
|
||||
*** the bit with value 0x20 when set indicates the key should be converted to a base58check encoded P2PKH bitcoin address using the DER compressed public key format. When not set, it should be a base58check encoded P2PKH bitcoin address using the DER uncompressed public key format.
|
||||
*** the bits with values 0x10 and 0x08 are reserved for a future specification that contemplates using multisig as a way to combine the factors such that parties in possession of the separate factors can independently sign a proposed transaction without requiring that any party possess both factors. These bits must be 0 to comply with this version of the specification.
|
||||
@ -75,10 +75,10 @@ To keep the size of the encrypted key down, no initialization vectors (IVs) are
|
||||
**16 bytes: lasthalf: An AES-encrypted key material record (contents depend on whether EC multiplication is used)
|
||||
* Range in base58check encoding for non-EC-multiplied keys without compression (prefix 6PR):
|
||||
** Minimum value: 6PRHv1jg1ytiE4kT2QtrUz8gEjMQghZDWg1FuxjdYDzjUkcJeGdFj9q9Vi (based on 01 42 C0 plus thirty-six 00's)
|
||||
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF's)
|
||||
** Maximum value: 6PRWdmoT1ZursVcr5NiD14p5bHrKVGPG7yeEoEeRb8FVaqYSHnZTLEbYsU (based on 01 42 C0 plus thirty-six FF's)
|
||||
* Range in base58check encoding for non-EC-multiplied keys with compression (prefix 6PY):
|
||||
** Minimum value: 6PYJxKpVnkXUsnZAfD2B5ZsZafJYNp4ezQQeCjs39494qUUXLnXijLx6LG (based on 01 42 E0 plus thirty-six 00's)
|
||||
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF's)
|
||||
** Maximum value: 6PYXg5tGnLYdXDRZiAqXbeYxwDoTBNthbi3d61mqBxPpwZQezJTvQHsCnk (based on 01 42 E0 plus thirty-six FF's)
|
||||
* Range in base58check encoding for EC-multiplied keys without compression (prefix 6Pf):
|
||||
** Minimum value: 6PfKzduKZXAFXWMtJ19Vg9cSvbFg4va6U8p2VWzSjtHQCCLk3JSBpUvfpf (based on 01 43 00 plus thirty-six 00's)
|
||||
** Maximum value: 6PfYiPy6Z7BQAwEHLxxrCEHrH9kasVQ95ST1NnuEnnYAJHGsgpNPQ9dTHc (based on 01 43 00 plus thirty-six FF's)
|
||||
@ -170,7 +170,7 @@ To recalculate the address:
|
||||
# Derive ''passfactor'' using scrypt with ''ownerentropy'' and the user's passphrase and use it to recompute ''passpoint''
|
||||
# Derive decryption key for ''pointb'' using scrypt with ''passpoint'', ''addresshash'', and ''ownerentropy''
|
||||
# Decrypt ''encryptedpointb'' to yield ''pointb''
|
||||
# ECMultiply ''pointb'' by ''passfactor''. Use the resulting EC point as a public key and hash it into ''address'' using either compressed or uncompressed public key methodology as specifid in ''flagbyte''.
|
||||
# ECMultiply ''pointb'' by ''passfactor''. Use the resulting EC point as a public key and hash it into ''address'' using either compressed or uncompressed public key methodology as specified in ''flagbyte''.
|
||||
|
||||
=====Decryption=====
|
||||
# Collect encrypted private key and passphrase from user.
|
||||
@ -184,7 +184,7 @@ To recalculate the address:
|
||||
# Hash the Bitcoin address, and verify that ''addresshash'' from the encrypted private key record matches the hash. If not, report that the passphrase entry was incorrect.
|
||||
|
||||
==Backwards compatibility==
|
||||
Backwards compatibility is minimally applicable since this is a new standard that at most extends [[Wallet Import Format]]. It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and [[Wallet Import Format]]); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.
|
||||
Backwards compatibility is minimally applicable since this is a new standard that at most extends Wallet Import Format. It is assumed that an entry point for private key data may also accept existing formats of private keys (such as hexadecimal and Wallet Import Format); this draft uses a key format that cannot be mistaken for any existing one and preserves auto-detection capabilities.
|
||||
|
||||
==Suggestions for implementers of proposal with alt-chains==
|
||||
If this proposal is accepted into alt-chains, it is requested that the unused flag bytes not be used for denoting that the key belongs to an alt-chain.
|
||||
@ -209,14 +209,10 @@ The preliminary values of 16384, 8, and 8 are hoped to offer the following prope
|
||||
==Reference implementation==
|
||||
Added to alpha version of Casascius Bitcoin Address Utility for Windows available at:
|
||||
|
||||
* via https: https://casascius.com/btcaddress-alpha.zip
|
||||
* at github: https://github.com/casascius/Bitcoin-Address-Utility
|
||||
* https://github.com/casascius/Bitcoin-Address-Utility
|
||||
|
||||
Click "Tools" then "PPEC Keygen" (provisional name)
|
||||
|
||||
==Other implementations==
|
||||
* Javascript - https://github.com/bitcoinjs/bip38
|
||||
|
||||
==Test vectors==
|
||||
|
||||
===No compression, no EC multiply===
|
||||
@ -276,7 +272,7 @@ Test 2:
|
||||
|
||||
Test 1:
|
||||
*Passphrase: MOLON LABE
|
||||
*Passphrase code: passphraseaB8feaLQDENqCgr4gKZpmf4VoaT6qdjJNJiv7fsKvjqavcJxvuR1hy25aTu5sX
|
||||
*Passphrase code: passphraseaB8feaLQDENqCgr4gKZpmf4VoaT6qdjJNJiv7fsKvjqavcJxvuR1hy25aTu5sX
|
||||
*Encrypted key: 6PgNBNNzDkKdhkT6uJntUXwwzQV8Rr2tZcbkDcuC9DZRsS6AtHts4Ypo1j
|
||||
*Bitcoin address: 1Jscj8ALrYu2y9TD8NrpvDBugPedmbj4Yh
|
||||
*Unencrypted private key (WIF): 5JLdxTtcTHcfYcmJsNVy1v2PMDx432JPoYcBTVVRHpPaxUrdtf8
|
||||
@ -284,9 +280,9 @@ Test 1:
|
||||
*Confirmation code: cfrm38V8aXBn7JWA1ESmFMUn6erxeBGZGAxJPY4e36S9QWkzZKtaVqLNMgnifETYw7BPwWC9aPD
|
||||
*Lot/Sequence: 263183/1
|
||||
|
||||
Test 2:
|
||||
Test 2:
|
||||
*Passphrase (all letters are Greek - test UTF-8 compatibility with this): ΜΟΛΩΝ ΛΑΒΕ
|
||||
*Passphrase code: passphrased3z9rQJHSyBkNBwTRPkUGNVEVrUAcfAXDyRU1V28ie6hNFbqDwbFBvsTK7yWVK
|
||||
*Passphrase code: passphrased3z9rQJHSyBkNBwTRPkUGNVEVrUAcfAXDyRU1V28ie6hNFbqDwbFBvsTK7yWVK
|
||||
*Encrypted private key: 6PgGWtx25kUg8QWvwuJAgorN6k9FbE25rv5dMRwu5SKMnfpfVe5mar2ngH
|
||||
*Bitcoin address: 1Lurmih3KruL4xDB5FmHof38yawNtP9oGf
|
||||
*Unencrypted private key (WIF): 5KMKKuUmAkiNbA3DazMQiLfDq47qs8MAEThm4yL8R2PhV1ov33D
|
||||
|
@ -8,7 +8,7 @@
|
||||
Sean Bowe <ewillbefull@gmail.com>
|
||||
Comments-Summary: Unanimously Discourage for implementation
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0039
|
||||
Status: Proposed
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2013-09-10
|
||||
</pre>
|
||||
@ -39,7 +39,7 @@ security is improved but the sentence length increases. We refer to the
|
||||
initial entropy length as ENT. The allowed size of ENT is 128-256 bits.
|
||||
|
||||
First, an initial entropy of ENT bits is generated. A checksum is generated by
|
||||
taking the first <pre>ENT / 32</pre> bits of its SHA256 hash. This checksum is
|
||||
taking the first <code>ENT / 32</code> bits of its SHA256 hash. This checksum is
|
||||
appended to the end of the initial entropy. Next, these concatenated bits
|
||||
are split into groups of 11 bits, each encoding a number from 0-2047, serving
|
||||
as an index into a wordlist. Finally, we convert these numbers into words and
|
||||
@ -138,67 +138,3 @@ Also see https://github.com/bip32JP/bip32JP.github.io/blob/master/test_JP_BIP39.
|
||||
Reference implementation including wordlists is available from
|
||||
|
||||
http://github.com/trezor/python-mnemonic
|
||||
|
||||
==Other Implementations==
|
||||
|
||||
Go:
|
||||
* https://github.com/tyler-smith/go-bip39
|
||||
|
||||
Python:
|
||||
* https://github.com/meherett/python-hdwallet
|
||||
|
||||
Elixir:
|
||||
* https://github.com/aerosol/mnemo
|
||||
|
||||
Objective-C:
|
||||
* https://github.com/nybex/NYMnemonic
|
||||
|
||||
Haskell:
|
||||
* https://github.com/haskoin/haskoin
|
||||
|
||||
.NET (Standard):
|
||||
* https://www.nuget.org/packages/dotnetstandard-bip39/
|
||||
|
||||
.NET C# (PCL):
|
||||
* https://github.com/Thashiznets/BIP39.NET
|
||||
|
||||
.NET C# (PCL):
|
||||
* https://github.com/NicolasDorier/NBitcoin
|
||||
|
||||
JavaScript:
|
||||
* https://github.com/bitpay/bitcore/tree/master/packages/bitcore-mnemonic
|
||||
* https://github.com/bitcoinjs/bip39 (used by [[https://github.com/blockchain/My-Wallet-V3/blob/v3.8.0/src/hd-wallet.js#L121-L146|blockchain.info]])
|
||||
* https://github.com/hujiulong/web-bip39
|
||||
|
||||
Java:
|
||||
* https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/crypto/MnemonicCode.java
|
||||
|
||||
Ruby:
|
||||
* https://github.com/sreekanthgs/bip_mnemonic
|
||||
|
||||
Rust:
|
||||
* https://github.com/maciejhirsz/tiny-bip39/
|
||||
* https://github.com/koushiro/bip0039-rs
|
||||
|
||||
Smalltalk:
|
||||
* https://github.com/eMaringolo/pharo-bip39mnemonic
|
||||
|
||||
Swift:
|
||||
* https://github.com/CikeQiu/CKMnemonic
|
||||
* https://github.com/yuzushioh/WalletKit
|
||||
* https://github.com/pengpengliu/BIP39
|
||||
* https://github.com/matter-labs/web3swift/blob/develop/Sources/web3swift/KeystoreManager/BIP39.swift
|
||||
* https://github.com/zcash-hackworks/MnemonicSwift
|
||||
* https://github.com/ShenghaiWang/BIP39
|
||||
|
||||
C++:
|
||||
* https://github.com/libbitcoin/libbitcoin-system/blob/master/include/bitcoin/system/wallet/mnemonic.hpp
|
||||
|
||||
C (with Python/Java/Javascript bindings):
|
||||
* https://github.com/ElementsProject/libwally-core
|
||||
|
||||
Python:
|
||||
* https://github.com/scgbckbone/btc-hd-wallet
|
||||
|
||||
Dart:
|
||||
* https://github.com/dart-bitcoin/bip39
|
||||
|
@ -28,7 +28,7 @@ for two smaller words (This would be a problem with any of the 3 character sets
|
||||
|
||||
### Spanish
|
||||
|
||||
1. Words can be uniquely determined typing the first 4 characters (sometimes less).
|
||||
1. Words can be uniquely determined by typing the first 4 characters (sometimes less).
|
||||
|
||||
2. Special Spanish characters like 'ñ', 'ü', 'á', etc... are considered equal to 'n', 'u', 'a', etc... in terms of identifying a word. Therefore, there is no need to use a Spanish keyboard to introduce the passphrase, an application with the Spanish wordlist will be able to identify the words after the first 4 chars have been typed even if the chars with accents have been replaced with the equivalent without accents.
|
||||
|
||||
@ -53,7 +53,7 @@ Credits: @Kirvx @NicolasDorier @ecdsa @EricLarch
|
||||
7. No words in the plural (except invariable words like "univers", or same spelling than singular like "heureux").
|
||||
8. No female adjectives (except words with same spelling for male and female adjectives like "magique").
|
||||
9. No words with several senses AND different spelling in speaking like "verre-vert", unless a word has a meaning much more popular than another like "perle" and "pairle".
|
||||
10. No very similar words with 1 letter of difference.
|
||||
10. No very similar words with only 1 letter of difference.
|
||||
11. No essentially reflexive verbs (unless a verb is also a noun like "souvenir").
|
||||
12. No words with "ô;â;ç;ê;œ;æ;î;ï;û;ù;à;ë;ÿ".
|
||||
13. No words ending by "é;ée;è;et;ai;ait".
|
||||
@ -76,7 +76,7 @@ Words chosen using the following rules:
|
||||
6. No plural words.
|
||||
7. No words that remind negative/sad/bad things.
|
||||
8. If both female/male words are available, choose male version.
|
||||
9. No words with double vocals (like: lineetta).
|
||||
9. No words with double vowels (like: lineetta).
|
||||
10. No words already used in other language mnemonic sets.
|
||||
11. If 3 of the first 4 letters are already used in the same sequence in another mnemonic word, there must be at least other 3 different letters.
|
||||
12. If 3 of the first 4 letters are already used in the same sequence in another mnemonic word, there must not be the same sequence of 3 or more letters.
|
||||
@ -92,26 +92,26 @@ Credits: @zizelevak (Jan Lansky zizelevak@gmail.com)
|
||||
Words chosen using the following rules:
|
||||
|
||||
1. Words are 4-8 letters long.
|
||||
2. Words can be uniquely determined typing the first 4 letters.
|
||||
3. Only words containing all letters without diacritical marks. (It was the hardest task, because in one third of all Czech letters has diacritical marks.)
|
||||
2. Words can be uniquely determined by typing the first 4 letters.
|
||||
3. Only words containing all letters without diacritical marks. (It was the hardest task, because one third of all Czech letters has diacritical marks.)
|
||||
4. Only nouns, verbs and adverbs, no other word types. All words are in basic form.
|
||||
5. No personal names or geographical names.
|
||||
6. No very similar words with 1 letter of difference.
|
||||
7. Words are sorting according English alphabet (Czech sorting has difference in "ch").
|
||||
8. No words already used in other language mnemonic sets (english, italian, french, spanish). Letters with diacritical marks from these sets are counted as analogous letters without diacritical marks.
|
||||
7. Words are sorted according to English alphabet (Czech sorting has difference in "ch").
|
||||
8. No words already used in other language mnemonic sets (english, italian, french, spanish). Letters with diacritical marks from these sets are counted as analogous letters without diacritical marks.
|
||||
|
||||
### Portuguese
|
||||
|
||||
Credits: @alegotardo @bitmover-studio @brenorb @kuthullu @ninjastic @sabotag3x @Trimegistus
|
||||
|
||||
1. Words can be uniquely determined typing the first 4 characters.
|
||||
1. Words can be uniquely determined by typing the first 4 characters.
|
||||
2. No accents or special characters.
|
||||
3. No complex verb forms.
|
||||
4. No plural words, unless there's no singular form.
|
||||
5. No words with double spelling.
|
||||
6. No words with the exact sound of another word with different spelling.
|
||||
6. No words with the exact sound as another word with different spelling.
|
||||
7. No offensive words.
|
||||
8. No words already used in other language mnemonic sets.
|
||||
9. The words which have not the same spelling in Brazil and in Portugal are excluded.
|
||||
10. No words that remind negative/sad/bad things.
|
||||
11. No very similar words with 1 letter of difference.
|
||||
10. No words that remind one of negative/sad/bad things.
|
||||
11. No very similar words with only 1 letter of difference.
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
Although it is widely believed that Satoshi was an inflation-hating goldbug he never said this, and in fact programmed Bitcoin's money supply to grow indefinitely, forever. He modeled the monetary supply as 4 gold mines being discovered per mibillenium (1024 years), with equal intervals between them, each one being depleted over the course of 140 years.
|
||||
|
||||
This poses obvious problems, however. Prominent among them is the discussion on what to call 1 billion Bitcoin, which symbol color to use for it, and when wallet clients should switch to it by default.
|
||||
This poses obvious problems, however. Prominent among them is the discussion on what to call 1 billion bitcoin, which symbol color to use for it, and when wallet clients should switch to it by default.
|
||||
|
||||
To combat this, this document proposes a controversial change: making Bitcoin's monetary supply finite.
|
||||
|
||||
@ -42,7 +42,7 @@ Note that several other programming languages do not exhibit this behaviour, mak
|
||||
|
||||
===Floating-point approximation===
|
||||
|
||||
An obvious solution would be to reimplement the shape of the subsidy curve using floating-point approximations, such as simulated annealing or quantitative easing, which have already proven their worth in consensus systems. Unfortunately, since the financial crisis everyone considers numbers with decimal points in them fishy, and integers are not well supported by Javascript.
|
||||
An obvious solution would be to reimplement the shape of the subsidy curve using floating-point approximations, such as simulated annealing or quantitative easing, which have already proven their worth in consensus systems. Unfortunately, since the financial crisis everyone considers numbers with decimal points in them fishy, and integers are not well supported by Javascript.
|
||||
|
||||
===Truncation===
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0043
|
||||
Status: Final
|
||||
Type: Informational
|
||||
Type: Standards Track
|
||||
Created: 2014-04-24
|
||||
</pre>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
Pavol Rusnak <stick@satoshilabs.com>
|
||||
Comments-Summary: Mixed review (one person)
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0044
|
||||
Status: Proposed
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2014-04-24
|
||||
</pre>
|
||||
|
193
bip-0046.mediawiki
Normal file
193
bip-0046.mediawiki
Normal file
@ -0,0 +1,193 @@
|
||||
<pre>
|
||||
BIP: 46
|
||||
Layer: Applications
|
||||
Title: Address Scheme for Timelocked Fidelity Bonds
|
||||
Author: Chris Belcher <belcher@riseup.net>
|
||||
Thebora Kompanioni <theborakompanioni+bip46@gmail.com>
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0046
|
||||
Status: Draft
|
||||
Type: Standards Track
|
||||
Created: 2022-04-01
|
||||
License: CC0-1.0
|
||||
Post-History: 2022-05-01: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-May/020389.html
|
||||
</pre>
|
||||
|
||||
== Abstract ==
|
||||
|
||||
This BIP defines the derivation scheme for HD wallets which create timelocked addresses used for creating fidelity bonds. It also gives advice to wallet developers on how to use fidelity bonds to sign over messages, such as certificates, which are needed when using fidelity bonds that are stored offline.
|
||||
|
||||
== Copyright ==
|
||||
|
||||
This document is licensed under the Creative Commons CC0 1.0 Universal license.
|
||||
|
||||
== Motivation ==
|
||||
|
||||
Fidelity bonds are used to resist sybil attacks in certain decentralized anonymous protocols. They are created by locking up bitcoins using the `OP_CHECKLOCKTIMEVERIFY` opcode.
|
||||
|
||||
Having a common derivation scheme allows users of wallet software to have a backup of their fidelity bonds by storing only the HD seed and a reference to this BIP. Importantly the user does not need to backup any timelock values.
|
||||
|
||||
We largely use the same approach used in BIPs 49, 84 and 86 for ease of implementation.
|
||||
|
||||
This allows keeping the private keys of fidelity bonds in cold storage, which increases the sybil resistance of a system without hot wallet risk.
|
||||
|
||||
== Backwards Compatibility ==
|
||||
|
||||
This BIP is not backwards compatible by design as described in the Considerations section of [[bip-0049.mediawiki|BIP 49]]. An incompatible wallet will not discover fidelity bonds at all and the user will notice that something is wrong.
|
||||
|
||||
== Background ==
|
||||
|
||||
=== Fidelity bonds ===
|
||||
|
||||
A fidelity bond is a mechanism where bitcoin value is deliberately sacrificed to make a cryptographic identity expensive to obtain. A way to create a fidelity bond is to lock up bitcoins by sending them to a timelocked address. The valuable thing being sacrificed is the time-value-of-money.
|
||||
|
||||
The sacrifice must be done in a way that can be proven to a third party. This proof can be made by showing the UTXO outpoint, the address redeemscript and a signature which signs a message using the private key corresponding to the public key in the redeemscript.
|
||||
|
||||
The sacrificed value is an objective measurement that can't be faked and which can be verified by anybody (just like, for example PoW mining). Sybil attacks can be made very expensive by forcing a hypothetical sybil attacker to lock up many bitcoins for a long time. JoinMarket implements fidelity bonds for protection from sybil attackers. At the time of writing over 600 BTC in total have been locked up with some for many years. Their UTXOs and signatures have been advertised to the world as proof. We can calculate that for a sybil attacker to succeed in unmixing all the CoinJoins, they would have to lock up over 100k BTC for several years.
|
||||
|
||||
=== Fidelity bonds in cold storage ===
|
||||
|
||||
To allow for holding fidelity bonds in cold storage, there is an intermediate keypair called the certificate.
|
||||
|
||||
UTXO key ---signs---> certificate ---signs---> endpoint
|
||||
|
||||
Where the endpoint might be a IRC nickname or Tor onion hostname. The certificate keypair can be kept online and used to prove ownership of the fidelity bond. Even if the hot wallet private keys are stolen, the coins in the timelocked address will still be safe, although the thief will be able to impersonate the fidelity bond until the expiry.
|
||||
|
||||
== Rationale ==
|
||||
|
||||
It is useful for the user to avoid having to keep a record of the timelocks in the time-locked addresses. So only a limited small set of timelocks are defined by this BIP. This way the user must only store their seed phrase, and knowledge that they have coins stored using this BIP standard. The user doesn't need to remember or store any dates.
|
||||
|
||||
This standard is already implemented and deployed in JoinMarket. As most changes would require a protocol change of a live system, there is limited scope for changing this standard in review. This BIP is more about documenting something which already exists, warts and all.
|
||||
|
||||
== Specifications ==
|
||||
|
||||
This BIP defines the two needed steps to derive multiple deterministic addresses based on a [[bip-0032.mediawiki|BIP 32]] master private key. It also defines the format of the certificate that can be signed by the deterministic address key.
|
||||
|
||||
=== Public key derivation ===
|
||||
|
||||
To derive a public key from the root account, this BIP uses a similar account-structure as defined in BIP [[bip-0084.mediawiki|44]] but with <tt>change</tt> set to <tt>2</tt>.
|
||||
|
||||
<pre>
|
||||
m / 84' / 0' / 0' / 2 / index
|
||||
</pre>
|
||||
|
||||
A key derived with this derivation path pattern will be referred to as <tt>derived_key</tt> further
|
||||
in this document.
|
||||
|
||||
For <tt>index</tt>, addresses are numbered from 0 in a sequentially increasing manner with a fixed upper bound: The index only goes up to <tt>959</tt> inclusive. Only 960 addresses can be derived for a given BIP32 master key. Furthermore there is no concept of a gap limit, instead wallets must always generate all 960 addresses and check for all of them if they have a balance and history.
|
||||
|
||||
=== Timelock derivation ===
|
||||
|
||||
The timelock used in the time-locked address is derived from the <tt>index</tt>. The timelock is a unix time. It is always at the start of the first second at the beginning of the month (see [[#Test vectors|Test vectors]]). The <tt>index</tt> counts upwards the months from January 2020, ending in December 2099. At 12 months per year for 80 years this totals 960 timelocks. Note that care must be taken with the year 2038 problem on 32-bit systems.
|
||||
|
||||
<pre>
|
||||
year = 2020 + index // 12
|
||||
month = 1 + index % 12
|
||||
</pre>
|
||||
|
||||
|
||||
=== Address derivation ===
|
||||
|
||||
To derive the address from the above calculated public key and timelock, we create a <tt>witness script</tt> which locks the funds until the <tt>timelock</tt>, and then checks the signature of the <tt>derived_key</tt>. The <tt>witness script</tt> is hashed with SHA256 to produce a 32-byte hash value that forms the <tt>witness program</tt> in the output script of the P2WSH address.
|
||||
|
||||
witnessScript: <timelock> OP_CHECKLOCKTIMEVERIFY OP_DROP <derived_key> OP_CHECKSIG
|
||||
witness: <signature> <witnessScript>
|
||||
scriptSig: (empty)
|
||||
scriptPubKey: 0 <32-byte-hash>
|
||||
(0x0020{32-byte-hash})
|
||||
|
||||
=== Message signing ===
|
||||
|
||||
In order to support signing of certificates, implementors should support signing ASCII messages.
|
||||
|
||||
The certificate message is defined as `"fidelity-bond-cert" || "|" || cert_pubkey || "|" || cert_expiry`.
|
||||
|
||||
The certificate expiry `cert_expiry` is the number of the 2016-block period after which the certificate is no longer valid. For example, if `cert_expiry` is 330 then the certificate will become invalid after block height 665280 (:=330x2016). The purpose of the expiry parameter is so that in case the certificate keypair is compromised, the attacker can only impersonate the fidelity bond for a limited amount of time.
|
||||
|
||||
A certificate message can be created by another application external to this standard. It is then prepended with the string `0x18 || "Bitcoin Signed Message:\n"` and a byte denoting the length of the certificate message. The whole thing is then signed with the private key of the <tt>derived_key</tt>. This part is identical to the "Sign Message" function which many wallets already implement.
|
||||
|
||||
Almost all wallets implementing this standard can use their already-existing "Sign Message" function to sign the certificate message. As the certificate message itself is always an ASCII string, the wallet may not need to specially implement this section at all but just rely on users copypasting their certificate message into the already-existing "Sign Message" user interface. This works as long as the wallet knows how to use the private key of the timelocked address for signing messages.
|
||||
|
||||
It is most important for wallet implementations of this standard to support creating the certificate signature. Verifying the certificate signature is less important.
|
||||
|
||||
|
||||
== Test vectors ==
|
||||
|
||||
<pre>
|
||||
mnemonic = abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
|
||||
rootpriv = xprv9s21ZrQH143K3GJpoapnV8SFfukcVBSfeCficPSGfubmSFDxo1kuHnLisriDvSnRRuL2Qrg5ggqHKNVpxR86QEC8w35uxmGoggxtQTPvfUu
|
||||
rootpub = xpub661MyMwAqRbcFkPHucMnrGNzDwb6teAX1RbKQmqtEF8kK3Z7LZ59qafCjB9eCRLiTVG3uxBxgKvRgbubRhqSKXnGGb1aoaqLrpMBDrVxga8
|
||||
|
||||
// First timelocked address = m/84'/0'/0'/2/0
|
||||
derived private_key = L2tQBEdhC48YLeEWNg3e4msk94iKfyVa9hdfzRwUERabZ53TfH3d
|
||||
derived public_key = 02a1b09f93073c63f205086440898141c0c3c6d24f69a18db608224bcf143fa011
|
||||
unix locktime = 1577836800
|
||||
string locktime = 2020-01-01 00:00:00
|
||||
redeemscript = 0400e10b5eb1752102a1b09f93073c63f205086440898141c0c3c6d24f69a18db608224bcf143fa011ac
|
||||
scriptPubKey = 0020bdee9515359fc9df912318523b4cd22f1c0b5410232dc943be73f9f4f07e39ad
|
||||
address = bc1qhhhf29f4nlyalyfrrpfrknxj9uwqk4qsyvkujsa7w0ulfur78xkspsqn84
|
||||
|
||||
// Test certificate using the first timelocked address
|
||||
// Note that as signatures contains a random nonce, it might not be exactly the same when your code generates it
|
||||
// p2pkh address is the p2pkh address corresponding to the derived public key, it can be used to verify the message
|
||||
// signature in any wallet that supports Verify Message.
|
||||
// As mentioned before, it is more important for implementors of this standard to support signing such messages, not verifying them
|
||||
message = fidelity-bond-cert|020000000000000000000000000000000000000000000000000000000000000001|375
|
||||
address = bc1qhhhf29f4nlyalyfrrpfrknxj9uwqk4qsyvkujsa7w0ulfur78xkspsqn84
|
||||
p2pkh address = 16vmiGpY1rEaYnpGgtG7FZgr2uFCpeDgV6
|
||||
signature = H2b/90XcKnIU/D1nSCPhk8OcxrHebMCr4Ok2d2yDnbKDTSThNsNKA64CT4v2kt+xA1JmGRG/dMnUUH1kKqCVSHo=
|
||||
|
||||
// 2nd timelocked address = m/84'/0'/0'/2/1
|
||||
derived private_key = KxctaFBzetyc9KXeUr6jxESCZiCEXRuwnQMw7h7hroP6MqnWN6Pf
|
||||
derived public_key = 02599f6db8b33265a44200fef0be79c927398ed0b46c6a82fa6ddaa5be2714002d
|
||||
unix locktime = 1580515200
|
||||
string locktime = 2020-02-01 00:00:00
|
||||
redeemscript = 0480bf345eb1752102599f6db8b33265a44200fef0be79c927398ed0b46c6a82fa6ddaa5be2714002dac
|
||||
scriptPubKey = 0020b8f898643991608524ed04e0c6779f632a57f1ffa3a3a306cd81432c5533e9ae
|
||||
address = bc1qhrufsepej9sg2f8dqnsvvaulvv490u0l5w36xpkds9pjc4fnaxhq7pcm4h
|
||||
|
||||
// timelocked address after the year 2038 = m/84'/0'/0'/2/240
|
||||
derived private_key = L3SYqae23ZoDDcyEA8rRBK83h1MDqxaDG57imMc9FUx1J8o9anQe
|
||||
derived public_key = 03ec8067418537bbb52d5d3e64e2868e67635c33cfeadeb9a46199f89ebfaab226
|
||||
unix locktime = 2208988800
|
||||
string locktime = 2040-01-01 00:00:00
|
||||
redeemscript = 05807eaa8300b1752103ec8067418537bbb52d5d3e64e2868e67635c33cfeadeb9a46199f89ebfaab226ac
|
||||
scriptPubKey = 0020e7de0ad2720ae1d6cc9b6ad91af57eb74646762cf594c91c18f6d5e7a873635a
|
||||
address = bc1qul0q45njptsadnymdtv34at7karyva3v7k2vj8qc7m2702rnvddq0z20u5
|
||||
|
||||
// last timelocked address = m/84'/0'/0'/2/959
|
||||
derived private_key = L5Z9DDMnj5RZMyyPiQLCvN48Xt7GGmev6cjvJXD8uz5EqiY8trNJ
|
||||
derived public_key = 0308c5751121b1ae5c973cdc7071312f6fc10ab864262f0cbd8134f056166e50f3
|
||||
unix locktime = 4099766400
|
||||
string locktime = 2099-12-01 00:00:00
|
||||
redeemscript = 0580785df400b175210308c5751121b1ae5c973cdc7071312f6fc10ab864262f0cbd8134f056166e50f3ac
|
||||
scriptPubKey = 0020803268e042008737cf439748cbb5a4449e311da9aa64ae3ac56d84d059654f85
|
||||
address = bc1qsqex3czzqzrn0n6rjayvhddygj0rz8df4fj2uwk9dkzdqkt9f7zs5c493u
|
||||
|
||||
// Test certificate and endpoint signing using the first timelocked address = m/84'/0'/0'/2/0 (see above)
|
||||
bond private_key = L2tQBEdhC48YLeEWNg3e4msk94iKfyVa9hdfzRwUERabZ53TfH3d
|
||||
bond p2pkh address = 16vmiGpY1rEaYnpGgtG7FZgr2uFCpeDgV6
|
||||
|
||||
certificate private_key = KyZpNDKnfs94vbrwhJneDi77V6jF64PWPF8x5cdJb8ifgg2DUc9d
|
||||
certificate public_key = 0330d54fd0dd420a6e5f8d3624f5f3482cae350f79d5f0753bf5beef9c2d91af3c
|
||||
certificate p2pkh address = 1JaUQDVNRdhfNsVncGkXedaPSM5Gc54Hso
|
||||
|
||||
certificate message = fidelity-bond-cert|0330d54fd0dd420a6e5f8d3624f5f3482cae350f79d5f0753bf5beef9c2d91af3c|375
|
||||
certificate signature = INOP3cB9UW7F1e1Aglj8rI9QhnyxmgWDEPt+nOMvl7hJJne7rH/KCNDYvLiqNuB9qWaWUojutjRsgPJrvyDQ+0Y=
|
||||
|
||||
// example endpoint signing two IRC nicknames (used in JoinMarket)
|
||||
endpoint message = J54LS6YyJPoseqFS|J55VZ6U6ZyFDNeuv
|
||||
endpoint signature = H18WE4MugDNoWZIf9jU0njhQptdUyBDUf7lToG9bpMKmeJK0lOoABaDs5bKnohSuZ0e9gnSco5OL9lXdKU7gP5E=
|
||||
</pre>
|
||||
|
||||
Code generating these test vectors can be found here: https://github.com/chris-belcher/timelocked-addresses-fidelity-bond-bip-testvectors
|
||||
|
||||
== Reference ==
|
||||
|
||||
* [[https://gist.github.com/chris-belcher/18ea0e6acdb885a2bfbdee43dcd6b5af/|Design for improving JoinMarket's resistance to sybil attacks using fidelity bonds]]
|
||||
* [[https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/fidelity-bonds.md|JoinMarket fidelity bonds doc page]]
|
||||
* [[bip-0065.mediawiki|BIP65 - OP_CHECKLOCKTIMEVERIFY]]
|
||||
* [[bip-0032.mediawiki|BIP32 - Hierarchical Deterministic Wallets]]
|
||||
* [[bip-0044.mediawiki|BIP44 - Multi-Account Hierarchy for Deterministic Wallets]]
|
||||
* [[bip-0049.mediawiki|BIP49 - Derivation scheme for P2WPKH-nested-in-P2SH based accounts]]
|
||||
* [[bip-0084.mediawiki|BIP84 - Derivation scheme for P2WPKH based accounts]]
|
||||
* [[bip-0086.mediawiki|BIP86 - Key Derivation for Single Key P2TR Outputs]]
|
@ -1,7 +1,7 @@
|
||||
RECENT CHANGES:
|
||||
* (15 Feb 2021) Finalize specification
|
||||
* (28 Sep 2017) Adjust text to match test vectors
|
||||
* (19 Apr 2016) Define version 2 payment codes
|
||||
* (17 Apr 2016) Clarify usage of outpoints in notification transactions
|
||||
* (18 Dec 2015) Update explanations to resolve FAQs
|
||||
|
||||
<pre>
|
||||
BIP: 47
|
||||
@ -10,11 +10,17 @@ RECENT CHANGES:
|
||||
Author: Justus Ranvier <justus@openbitcoinprivacyproject.org>
|
||||
Comments-Summary: Unanimously Discourage for implementation
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0047
|
||||
Status: Draft
|
||||
Status: Final
|
||||
Type: Informational
|
||||
Created: 2015-04-24
|
||||
</pre>
|
||||
|
||||
==Status==
|
||||
|
||||
This BIP can be considered final in terms of enabling compatibility with wallets that implement version 1 and version 2 reusable payment codes, however future developments of the reusable payment codes specification will not be distributed via the BIP process.
|
||||
|
||||
The Open Bitcoin Privacy Project RFC repo should be consulted for specifications related to version 3 or higher payment codes: https://github.com/OpenBitcoinPrivacyProject/rfc
|
||||
|
||||
==Abstract==
|
||||
|
||||
This BIP defines a technique for creating a payment code which can be publicly advertised and associated with a real-life identity without creating the loss of security or privacy inherent to P2PKH address reuse.
|
||||
@ -150,7 +156,7 @@ It is assumed that Alice can easily obtain Bob's payment code via a suitable met
|
||||
|
||||
Prior to the first time Alice initiates a transaction to Bob, Alice MUST inform Bob of her payment code via the following procedure:
|
||||
|
||||
Note: this procedure is used if Bob uses a version 1 payment code (regardless of the the version of Alice's payment code). If Bob's payment code is not version 1, see the appropriate section in this specification.
|
||||
Note: this procedure is used if Bob uses a version 1 payment code (regardless of the version of Alice's payment code). If Bob's payment code is not version 1, see the appropriate section in this specification.
|
||||
|
||||
# Alice constructs a transaction which sends a small quantity of bitcoins to Bob's notification address (notification transaction)
|
||||
## The inputs selected for this transaction MUST NOT be easily associated with Alice's notification address
|
||||
@ -158,7 +164,7 @@ Note: this procedure is used if Bob uses a version 1 payment code (regardless of
|
||||
## Alice selects the private key corresponding to the designated pubkey: <pre>a</pre>
|
||||
## Alice selects the public key associated with Bob's notification address: <pre>B, where B = bG</pre>
|
||||
## Alice calculates a secret point: <pre>S = aB</pre>
|
||||
## Alice calculates a 64 byte blinding factor: <pre>s = HMAC-SHA512(x, o)</pre>
|
||||
## Alice calculates a 64 byte blinding factor: <pre>s = HMAC-SHA512(o, x)</pre>
|
||||
### "x" is the x value of the secret point
|
||||
### "o" is the outpoint being spent by the designated input
|
||||
# Alice serializes her payment code in binary form.
|
||||
@ -229,7 +235,7 @@ The following actions are recommended to reduce this risk:
|
||||
<img src="bip-0047/reusable_payment_codes-04.png" />
|
||||
<img src="bip-0047/reusable_payment_codes-05.png" />
|
||||
# Bob is watching for incoming payments on B' ever since he received the notification transaction from Alice.
|
||||
## Bob calculates n shared secrets with Alice, using the 0<sup>th</sup> public key derived Alice's payment code, and private keys 0 - n derived from Bob's payment code, where n is his desired lookahead window.
|
||||
## Bob calculates n shared secrets with Alice, using the 0<sup>th</sup> public key derived from Alice's payment code, and private keys 0 - n derived from Bob's payment code, where n is his desired lookahead window.
|
||||
## Bob calculates the ephemeral deposit addresses using the same procedure as Alice: <pre>B' = B + sG</pre>
|
||||
## Bob calculate the private key for each ephemeral address as: <pre>b' = b + s</pre>
|
||||
<img src="bip-0047/reusable_payment_codes-02.png" />
|
||||
@ -269,7 +275,7 @@ Normal operation of a payment code-enabled wallet can be performed by an SPV cli
|
||||
|
||||
Recovering a wallet from a seed, however, does require access to a fully-indexed blockchain.
|
||||
|
||||
The required data may be obtained from copy of the blockchain under the control of the user, or via a publicly-queriable blockchain explorer.
|
||||
The required data may be obtained from copy of the blockchain under the control of the user, or via a publicly-queryable blockchain explorer.
|
||||
|
||||
When querying a public blockchain explorer, wallets SHOULD connect to the explorer through Tor (or equivalent) and SHOULD avoid grouping queries in a manner that associates ephemeral addresses with each other.
|
||||
|
||||
@ -344,12 +350,12 @@ Version 2 payment codes behave identifically to version 1 payment codes, except
|
||||
|
||||
====Definitions====
|
||||
|
||||
* Notification change output: the change output from a notification transaction which which resides in the sender's wallet, but can be automatically located by the intended recipient
|
||||
* Notification change output: the change output from a notification transaction which resides in the sender's wallet, but can be automatically located by the intended recipient
|
||||
* Payment code identifier: a 33 byte representation of a payment code constructed by prepending 0x02 to the SHA256 hash of the binary serialization of the payment code
|
||||
|
||||
====Notification Transaction====
|
||||
|
||||
Note: this procedure is used if Bob uses a version 2 payment code (regardless of the the version of Alice's payment code). If Bob's payment code is not version 2, see the appropriate section in this specification.
|
||||
Note: this procedure is used if Bob uses a version 2 payment code (regardless of the version of Alice's payment code). If Bob's payment code is not version 2, see the appropriate section in this specification.
|
||||
|
||||
# Construct a notification transaction as per the version 1 instructions, except do not create the output to Bob's notification address
|
||||
# Create a notification change address as follows:
|
||||
|
@ -6,7 +6,7 @@
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0049
|
||||
Status: Final
|
||||
Type: Informational
|
||||
Type: Standards Track
|
||||
Created: 2016-05-19
|
||||
License: PD
|
||||
</pre>
|
||||
@ -92,10 +92,10 @@ This BIP is not backwards compatible by design as described under [[#considerati
|
||||
// Account 0, first receiving private key = m/49'/1'/0'/0/0
|
||||
account0recvPrivateKey = cULrpoZGXiuC19Uhvykx7NugygA3k86b3hmdCeyvHYQZSxojGyXJ
|
||||
account0recvPrivateKeyHex = 0xc9bdb49cfbaedca21c4b1f3a7803c34636b1d7dc55a717132443fc3f4c5867e8
|
||||
account0recvPublickKeyHex = 0x03a1af804ac108a8a51782198c2d034b28bf90c8803f5a53f76276fa69a4eae77f
|
||||
account0recvPublicKeyHex = 0x03a1af804ac108a8a51782198c2d034b28bf90c8803f5a53f76276fa69a4eae77f
|
||||
|
||||
// Address derivation
|
||||
keyhash = HASH160(account0recvPublickKeyHex) = 0x38971f73930f6c141d977ac4fd4a727c854935b3
|
||||
keyhash = HASH160(account0recvPublicKeyHex) = 0x38971f73930f6c141d977ac4fd4a727c854935b3
|
||||
scriptSig = <0 <keyhash>> = 0x001438971f73930f6c141d977ac4fd4a727c854935b3
|
||||
addressBytes = HASH160(scriptSig) = 0x336caa13e08b96080a32b5d818d59b4ab3b36742
|
||||
|
||||
|
@ -25,7 +25,7 @@ Bitcoin network cannot profitably mine Bitcoin even if they have the capital to
|
||||
invest in mining hardware. From a practical perspective, Bitcoin adoption by
|
||||
companies like Tesla (which recently rescinded its acceptance of Bitcoin as
|
||||
payment) has been hampered by its massive energy consumption and perceived
|
||||
environmental impact.
|
||||
environmental impact.
|
||||
|
||||
<img src="bip-0052/btc_energy-small.png"></img>
|
||||
|
||||
@ -137,7 +137,7 @@ x1 <- keccak(input)
|
||||
x2 <- reshape(x1, 64)
|
||||
|
||||
// Perform a matrix-vector multiplication.
|
||||
// The result is 64-vector of 14-bit unsigned.
|
||||
// The result is 64-vector of 14-bit unsigned.
|
||||
x3 <- vector_matrix_mult(x2, M)
|
||||
|
||||
// Truncate all values to 4 most significant bits.
|
||||
|
@ -23,14 +23,14 @@ The implementation is problematic because the RelayTransactions flag is an optio
|
||||
|
||||
One property of Bitcoin messages is their fixed number of fields. This keeps the format simple and easily understood. Adding optional fields to messages will cause deserialisation issues when other fields come after the optional one.
|
||||
|
||||
As an example, the length of version messages might be checked to ensure the byte stream is consistent. With optional fields, this checking is no longer possible. This is desirable to check for consistency inside internal deserialization code, and proper formatting of version messages originating from other nodes. In the future with diversification of the Bitcoin network, it will become desirable to enforce this kind of strict adherance to standard messages with field length compliance with every protocol version.
|
||||
As an example, the length of version messages might be checked to ensure the byte stream is consistent. With optional fields, this checking is no longer possible. This is desirable to check for consistency inside internal deserialization code, and proper formatting of version messages originating from other nodes. In the future with diversification of the Bitcoin network, it will become desirable to enforce this kind of strict adherence to standard messages with field length compliance with every protocol version.
|
||||
|
||||
Another property of fixed-length field messages is the ability to pass stream operators around for deserialization. This property is also lost, as now the deserialisation code must know the remaining length of bytes to parse. The parser now requires an additional piece of information (remaining size of the stream) for parsing instead of being a dumb reader.
|
||||
|
||||
==Specification==
|
||||
=== version ===
|
||||
|
||||
When a node creates an outgoing connection, it will immediately advertise its version. The remote node will respond with its version. No futher communication is possible until both peers have exchanged their version.
|
||||
When a node creates an outgoing connection, it will immediately advertise its version. The remote node will respond with its version. No further communication is possible until both peers have exchanged their version.
|
||||
|
||||
Payload:
|
||||
|
||||
|
@ -57,7 +57,7 @@ Every reject message begins with the following fields. Some messages append extr
|
||||
|}
|
||||
|
||||
The human-readable string is intended only for debugging purposes; in particular, different implementations may
|
||||
use different strings. The string should not be shown to users or used for anthing besides diagnosing
|
||||
use different strings. The string should not be shown to users or used for anything besides diagnosing
|
||||
interoperability problems.
|
||||
|
||||
The following reject code categories are used; in the descriptions below, "server" is the peer generating
|
||||
|
@ -86,7 +86,7 @@ If the requesting client is looking up outputs for a signed transaction that the
|
||||
client can partly verify the returned output by running the input scripts with it. Currently this
|
||||
verifies only that the script is correct. A future version of the Bitcoin protocol is likely to also
|
||||
allow the value to be checked in this way. It does not show that the output is really unspent or was
|
||||
ever actually created in the block chain however. Additionally, the form of the provided scriptPubKey
|
||||
ever actually created in the block chain however. Additionally, the form of the provided scriptPubKey
|
||||
should be checked before execution to ensure the remote peer doesn't just set the script to OP_TRUE.
|
||||
|
||||
If the requesting client has a mapping of chain heights to block hashes in the best chain e.g.
|
||||
|
@ -170,7 +170,7 @@ Proving the sacrifice of some limited resource is a common technique in a
|
||||
variety of cryptographic protocols. Proving sacrifices of coins to mining fees
|
||||
has been proposed as a ''universal public good'' to which the sacrifice could
|
||||
be directed, rather than simply destroying the coins. However doing so is
|
||||
non-trivial, and even the best existing technqiue - announce-commit sacrifices
|
||||
non-trivial, and even the best existing technique - announce-commit sacrifices
|
||||
- could encourage mining centralization. CHECKLOCKTIMEVERIFY can be used to
|
||||
create outputs that are provably spendable by anyone (thus to mining fees
|
||||
assuming miners behave optimally and rationally) but only at a time
|
||||
@ -205,19 +205,19 @@ transaction output ''can'' be spent.
|
||||
Refer to the reference implementation, reproduced below, for the precise
|
||||
semantics and detailed rationale for those semantics.
|
||||
|
||||
|
||||
|
||||
case OP_NOP2:
|
||||
{
|
||||
// CHECKLOCKTIMEVERIFY
|
||||
//
|
||||
// (nLockTime -- nLockTime )
|
||||
|
||||
|
||||
if (!(flags & SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY))
|
||||
break; // not enabled; treat as a NOP
|
||||
|
||||
|
||||
if (stack.size() < 1)
|
||||
return false;
|
||||
|
||||
|
||||
// Note that elsewhere numeric opcodes are limited to
|
||||
// operands in the range -2**31+1 to 2**31-1, however it is
|
||||
// legal for opcodes to produce results exceeding that
|
||||
@ -233,13 +233,13 @@ semantics and detailed rationale for those semantics.
|
||||
// to 5-byte bignums, which are good until 2**32-1, the
|
||||
// same limit as the nLockTime field itself.
|
||||
const CScriptNum nLockTime(stacktop(-1), 5);
|
||||
|
||||
|
||||
// In the rare event that the argument may be < 0 due to
|
||||
// some arithmetic being done first, you can always use
|
||||
// 0 MAX CHECKLOCKTIMEVERIFY.
|
||||
if (nLockTime < 0)
|
||||
return false;
|
||||
|
||||
|
||||
// There are two types of nLockTime: lock-by-blockheight
|
||||
// and lock-by-blocktime, distinguished by whether
|
||||
// nLockTime < LOCKTIME_THRESHOLD.
|
||||
@ -252,12 +252,12 @@ semantics and detailed rationale for those semantics.
|
||||
(txTo.nLockTime >= LOCKTIME_THRESHOLD && nLockTime >= LOCKTIME_THRESHOLD)
|
||||
))
|
||||
return false;
|
||||
|
||||
|
||||
// Now that we know we're comparing apples-to-apples, the
|
||||
// comparison is a simple numeric one.
|
||||
if (nLockTime > (int64_t)txTo.nLockTime)
|
||||
return false;
|
||||
|
||||
|
||||
// Finally the nLockTime feature can be disabled and thus
|
||||
// CHECKLOCKTIMEVERIFY bypassed if every txin has been
|
||||
// finalized by setting nSequence to maxint. The
|
||||
@ -270,9 +270,9 @@ semantics and detailed rationale for those semantics.
|
||||
// required to prove correct CHECKLOCKTIMEVERIFY execution.
|
||||
if (txTo.vin[nIn].IsFinal())
|
||||
return false;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
https://github.com/petertodd/bitcoin/commit/ab0f54f38e08ee1e50ff72f801680ee84d0f1bf4
|
||||
|
@ -75,7 +75,7 @@ bool static IsValidSignatureEncoding(const std::vector<unsigned char> &sig) {
|
||||
// Verify that the length of the signature matches the sum of the length
|
||||
// of the elements.
|
||||
if ((size_t)(lenR + lenS + 7) != sig.size()) return false;
|
||||
|
||||
|
||||
// Check whether the R element is an integer.
|
||||
if (sig[2] != 0x02) return false;
|
||||
|
||||
@ -140,7 +140,7 @@ An implementation for the reference client is available at https://github.com/bi
|
||||
|
||||
==Acknowledgements==
|
||||
|
||||
This document is extracted from the previous BIP62 proposal, which had input from various people, in particular Greg Maxwell and Peter Todd, who gave feedback about this document as well.
|
||||
This document is extracted from the previous BIP62 proposal, which had input from various people, in particular Greg Maxwell and Peter Todd, who gave feedback about this document as well.
|
||||
|
||||
==Disclosures==
|
||||
|
||||
|
@ -19,7 +19,7 @@ This BIP describes a method to deterministically generate multi-signature pay-to
|
||||
|
||||
==Motivation==
|
||||
|
||||
Pay-to-script-hash (BIP-0011<ref>[https://github.com/bitcoin/bips/blob/master/bip-0011.mediawiki BIP-0011]</ref>) is a transaction type that allows funding of arbitrary scripts, where the recipient carries the cost of fee's associated with using longer, more complex scripts.
|
||||
Pay-to-script-hash (BIP-0011<ref>[https://github.com/bitcoin/bips/blob/master/bip-0011.mediawiki BIP-0011]</ref>) is a transaction type that allows funding of arbitrary scripts, where the recipient carries the cost of fee's associated with using longer, more complex scripts.
|
||||
|
||||
Multi-signature pay-to-script-hash transactions are defined in BIP-0016<ref>[https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki BIP-0016]</ref>. The redeem script does not require a particular ordering or encoding for public keys. This means that for a given set of keys and number of required signatures, there are as many as 2(n!) possible standard redeem scripts, each with its separate P2SH address. Adhering to an ordering and key encoding would ensure that a multi-signature “account” (set of public keys and required signature count) has a canonical P2SH address.
|
||||
|
||||
@ -27,36 +27,36 @@ By adopting a sorting and encoding standard, compliant wallets will always produ
|
||||
|
||||
While most web wallets do not presently facilitate the setup of multisignature accounts with users of a different service, conventions which ensure cross-compatibility should make it easier to achieve this.
|
||||
|
||||
Many wallet as a service providers use a 2of3 multi-signature schema where the user stores 1 of the keys (offline) as backup while using the other key for daily use and letting the service cosign his transactions.
|
||||
Many wallet as a service providers use a 2of3 multi-signature schema where the user stores 1 of the keys (offline) as backup while using the other key for daily use and letting the service cosign his transactions.
|
||||
This standard will help in enabling a party other than the service provider to recover the wallet without any help from the service provider.
|
||||
|
||||
==Specification==
|
||||
|
||||
For a set of public keys, ensure that they have been received in compressed form:
|
||||
|
||||
|
||||
022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da
|
||||
03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9
|
||||
03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9
|
||||
021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18
|
||||
|
||||
Sort them lexicographically according to their binary representation:
|
||||
|
||||
|
||||
Sort them lexicographically according to their binary representation:
|
||||
|
||||
021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18
|
||||
022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da
|
||||
03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9
|
||||
|
||||
..before using the resulting list of keys in a standard multisig redeem script:
|
||||
|
||||
..before using the resulting list of keys in a standard multisig redeem script:
|
||||
|
||||
OP_2 021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18 022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da 03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9 OP_3 OP_CHECKMULTISIG
|
||||
|
||||
Hash the redeem script according to BIP-0016 to get the P2SH address.
|
||||
|
||||
|
||||
3Q4sF6tv9wsdqu2NtARzNCpQgwifm2rAba
|
||||
|
||||
|
||||
==Compatibility==
|
||||
* Uncompressed keys are incompatible with this specificiation. A compatible implementation should not automatically compress keys. Receiving an uncompressed key from a multisig participant should be interpreted as a sign that the user has an incompatible implementation.
|
||||
* P2SH addressses do not reveal information about the script that is receiving the funds. For this reason it is not technically possible to enforce this BIP as a rule on the network. Also, it would cause a hard fork.
|
||||
* Uncompressed keys are incompatible with this specification. A compatible implementation should not automatically compress keys. Receiving an uncompressed key from a multisig participant should be interpreted as a sign that the user has an incompatible implementation.
|
||||
* P2SH addresses do not reveal information about the script that is receiving the funds. For this reason it is not technically possible to enforce this BIP as a rule on the network. Also, it would cause a hard fork.
|
||||
* Implementations that do not conform with this BIP will have compatibility issues with strictly-compliant wallets.
|
||||
* Implementations which do adopt this standard will be cross-compatible when choosing multisig addressses.
|
||||
* Implementations which do adopt this standard will be cross-compatible when choosing multisig addresses.
|
||||
* If a group of users were not entirely compliant, there is the possibility that a participant will derive an address that the others will not recognize as part of the common multisig account.
|
||||
|
||||
==Test vectors==
|
||||
@ -75,11 +75,11 @@ Vector 1
|
||||
** 39bgKC7RFbpoCRbtD5KEdkYKtNyhpsNa3Z
|
||||
|
||||
Vector 2 (Already sorted, no action required)
|
||||
* List:
|
||||
* List:
|
||||
** 02632b12f4ac5b1d1b72b2a3b508c19172de44f6f46bcee50ba33f3f9291e47ed0
|
||||
** 027735a29bae7780a9755fae7a1c4374c656ac6a69ea9f3697fda61bb99a4f3e77
|
||||
** 02e2cc6bd5f45edd43bebe7cb9b675f0ce9ed3efe613b177588290ad188d11b404
|
||||
* Sorted:
|
||||
* Sorted:
|
||||
** 02632b12f4ac5b1d1b72b2a3b508c19172de44f6f46bcee50ba33f3f9291e47ed0
|
||||
** 027735a29bae7780a9755fae7a1c4374c656ac6a69ea9f3697fda61bb99a4f3e77
|
||||
** 02e2cc6bd5f45edd43bebe7cb9b675f0ce9ed3efe613b177588290ad188d11b404
|
||||
@ -89,12 +89,12 @@ Vector 2 (Already sorted, no action required)
|
||||
** 3CKHTjBKxCARLzwABMu9yD85kvtm7WnMfH
|
||||
|
||||
Vector 3:
|
||||
* List:
|
||||
* List:
|
||||
** 030000000000000000000000000000000000004141414141414141414141414141
|
||||
** 020000000000000000000000000000000000004141414141414141414141414141
|
||||
** 020000000000000000000000000000000000004141414141414141414141414140
|
||||
** 030000000000000000000000000000000000004141414141414141414141414140
|
||||
* Sorted:
|
||||
* Sorted:
|
||||
** 020000000000000000000000000000000000004141414141414141414141414140
|
||||
** 020000000000000000000000000000000000004141414141414141414141414141
|
||||
** 030000000000000000000000000000000000004141414141414141414141414140
|
||||
@ -105,11 +105,11 @@ Vector 3:
|
||||
** 32V85igBri9zcfBRVupVvwK18NFtS37FuD
|
||||
|
||||
Vector 4: (from bitcore)
|
||||
* List:
|
||||
* List:
|
||||
** 022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da
|
||||
** 03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9
|
||||
** 03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9
|
||||
** 021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18
|
||||
* Sorted:
|
||||
* Sorted:
|
||||
** 021f2f6e1e50cb6a953935c3601284925decd3fd21bc445712576873fb8c6ebc18
|
||||
** 022df8750480ad5b26950b25c7ba79d3e37d75f640f8e5d9bcd5b150a0f85014da
|
||||
** 03e3818b65bcc73a7d64064106a859cc1a5a728c4345ff0b641209fba0d90de6e9
|
||||
@ -119,13 +119,13 @@ Vector 4: (from bitcore)
|
||||
** 3Q4sF6tv9wsdqu2NtARzNCpQgwifm2rAba
|
||||
|
||||
==Acknowledgements==
|
||||
The authors wish to thank BtcDrak and Luke-Jr for their involvement & contributions in the early discussions of this BIP.
|
||||
The authors wish to thank BtcDrak and Luke-Jr for their involvement & contributions in the early discussions of this BIP.
|
||||
|
||||
==Usage & Implementations==
|
||||
* [[https://github.com/bitcoin/bips/blob/master/bip-0045.mediawiki#address-generation-procedure|BIP-0045]] - Structure for Deterministic P2SH Multisignature Wallets
|
||||
* [[https://github.com/bitpay/bitcore/blob/50a868cb8cdf2be04bb1c5bf4bcc064cc06f5888/lib/script/script.js#L541|Bitcore]]
|
||||
==Usage & Implementations==
|
||||
* [[https://github.com/bitcoin/bips/blob/master/bip-0045.mediawiki#address-generation-procedure|BIP-0045]] - Structure for Deterministic P2SH Multisignature Wallets
|
||||
* [[https://github.com/bitpay/bitcore/blob/50a868cb8cdf2be04bb1c5bf4bcc064cc06f5888/lib/script/script.js#L541|Bitcore]]
|
||||
* [[https://github.com/haskoin/haskoin-core/blob/b41b1deb0989334a7ead6fc993fb8b02f0c00810/haskoin-core/Network/Haskoin/Script/Parser.hs#L112-L122|Haskoin]] - Bitcoin implementation in Haskell
|
||||
* [[https://github.com/etotheipi/BitcoinArmory/blob/268db0f3fa20c989057bd43343a43b2edbe89aeb/armoryengine/ArmoryUtils.py#L1441|Armory]]
|
||||
* [[https://github.com/etotheipi/BitcoinArmory/blob/268db0f3fa20c989057bd43343a43b2edbe89aeb/armoryengine/ArmoryUtils.py#L1441|Armory]]
|
||||
* [[https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L331|BitcoinJ]]
|
||||
|
||||
== References ==
|
||||
|
@ -33,7 +33,7 @@ If bit (1 << 31) of the sequence number is set, then no consensus meaning is app
|
||||
|
||||
If bit (1 << 31) of the sequence number is not set, then the sequence number is interpreted as an encoded relative lock-time.
|
||||
|
||||
The sequence number encoding is interpreted as follows:
|
||||
The sequence number encoding is interpreted as follows:
|
||||
|
||||
Bit (1 << 22) determines if the relative lock-time is time-based or block based: If the bit is set, the relative lock-time specifies a timespan in units of 512 seconds granularity. The timespan starts from the median-time-past of the output’s previous block, and ends at the MTP of the previous block. If the bit is not set, the relative lock-time specifies a number of blocks.
|
||||
|
||||
@ -65,7 +65,7 @@ enum {
|
||||
/* Interpret sequence numbers as relative lock-time constraints. */
|
||||
LOCKTIME_VERIFY_SEQUENCE = (1 << 0),
|
||||
};
|
||||
|
||||
|
||||
/* Setting nSequence to this value for every input in a transaction
|
||||
* disables nLockTime. */
|
||||
static const uint32_t SEQUENCE_FINAL = 0xffffffff;
|
||||
@ -245,7 +245,7 @@ The most efficient way to calculate sequence number from relative lock-time is w
|
||||
// 0 <= nHeight < 65,535 blocks (1.25 years)
|
||||
nSequence = nHeight;
|
||||
nHeight = nSequence & 0x0000ffff;
|
||||
|
||||
|
||||
// 0 <= nTime < 33,554,431 seconds (1.06 years)
|
||||
nSequence = (1 << 22) | (nTime >> 9);
|
||||
nTime = (nSequence & 0x0000ffff) << 9;
|
||||
|
@ -69,4 +69,4 @@ bitcoin:?r=https://merchant.com/pay.php?h%3D2a8628fc2fbe
|
||||
|
||||
==References==
|
||||
|
||||
[[http://www.w3.org/Protocols/rfc2616/rfc2616.html|RFC 2616]] : Hypertext Transfer Protocol -- HTTP/1.1
|
||||
[[http://www.w3.org/Protocols/rfc2616/rfc2616.html|RFC 2616]] : Hypertext Transfer Protocol -- HTTP/1.1
|
||||
|
@ -18,11 +18,11 @@
|
||||
|
||||
This BIP is an extension to BIP 70 that provides two enhancements to the existing Payment Protocol.
|
||||
|
||||
# It allows the requester (Sender) of a PaymentRequest to voluntarily sign the original request and provide a certificate to allow the payee to know the identity of who they are transacting with.
|
||||
# It allows the requester (Sender) of a PaymentRequest to voluntarily sign the original request and provide a certificate to allow the payee to know the identity of who they are transacting with.
|
||||
|
||||
# It encrypts the PaymentRequest that is returned, before handing it off to the SSL/TLS layer to prevent man in the middle viewing of the Payment Request details.
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
|
||||
"OPTIONAL" in this document are to be interpreted as described in RFC 2119.
|
||||
|
||||
==Copyright==
|
||||
@ -217,9 +217,9 @@ message EncryptedProtocolMessage {
|
||||
|}
|
||||
|
||||
==Payment Protocol Process with InvoiceRequests==
|
||||
The full process overview for using '''InvoiceRequests''' in the Payment Protocol is defined below.
|
||||
The full process overview for using '''InvoiceRequests''' in the Payment Protocol is defined below.
|
||||
<br/><br/>
|
||||
All Payment Protocol messages MUST be encapsulated in either a [[#ProtocolMessage|ProtocolMessage]] or [[#EncryptedProcotolMessage|EncryptedProtocolMessage]]. Once the process begins using [[#EncryptedProtocolMessage|EncryptedProtocolMessage]] messages, all subsequent communications MUST use [[#EncryptedProtocolMessage|EncryptedProtocolMessages]].
|
||||
All Payment Protocol messages MUST be encapsulated in either a [[#ProtocolMessage|ProtocolMessage]] or [[#EncryptedProtocolMessage|EncryptedProtocolMessage]]. Once the process begins using [[#EncryptedProtocolMessage|EncryptedProtocolMessage]] messages, all subsequent communications MUST use [[#EncryptedProtocolMessage|EncryptedProtocolMessages]].
|
||||
<br/><br/>
|
||||
All Payment Protocol messages SHOULD be communicated using [[#EncryptedProtocolMessage|EncryptedProtocolMessage]] encapsulating messages with the exception that an [[#InvoiceRequest|InvoiceRequest]] MAY be communicated using the [[#ProtocolMessage|ProtocolMessage]] if the receiver's public key is unknown.
|
||||
<br/><br/>
|
||||
@ -257,14 +257,14 @@ When communicated via '''HTTP''', the listed messages MUST be transmitted via TL
|
||||
|
||||
===Payment Protocol Status Communication===
|
||||
|
||||
Every [[#ProtocolMessage|ProtocolMessage]] or [[#EncryptedProtocolMessage|EncryptedProtocolMessage]] MUST include a status code which conveys information about the last message received, if any (for the first message sent, use a status of 1 "OK" even though there was no previous message). In the case of an error that causes the Payment Protocol process to be stopped or requires that message be retried, a ProtocolMessage or EncryptedProtocolMessage SHOULD be returned by the party generating the error. The content of the message MUST contain the same '''serialized_message''' or '''encrypted_message''' and identifier (if present) and MUST have the status_code set appropriately.
|
||||
Every [[#ProtocolMessage|ProtocolMessage]] or [[#EncryptedProtocolMessage|EncryptedProtocolMessage]] MUST include a status code which conveys information about the last message received, if any (for the first message sent, use a status of 1 "OK" even though there was no previous message). In the case of an error that causes the Payment Protocol process to be stopped or requires that message be retried, a ProtocolMessage or EncryptedProtocolMessage SHOULD be returned by the party generating the error. The content of the message MUST contain the same '''serialized_message''' or '''encrypted_message''' and identifier (if present) and MUST have the status_code set appropriately.
|
||||
<br/><br/>
|
||||
The status_message value SHOULD be set with a human readable explanation of the status code.
|
||||
|
||||
====Payment Protocol Status Codes====
|
||||
{| class="wikitable"
|
||||
! Status Code !! Description
|
||||
|-
|
||||
|-
|
||||
| 1 || OK
|
||||
|-
|
||||
| 2 || Cancel
|
||||
@ -324,7 +324,7 @@ For the following we assume the Sender already knows the Receiver's public key,
|
||||
** Set '''signature''' value to the computed signature
|
||||
|
||||
===InvoiceRequest Validation===
|
||||
* Validate '''sender_public_key''' is a valid EC public key
|
||||
* Validate '''sender_public_key''' is a valid EC public key
|
||||
* Validate '''notification_url''', if set, contains characters deemed valid for a URL (avoiding XSS related characters, etc).
|
||||
* If '''pki_type''' is None, [[#InvoiceRequest|InvoiceRequest]] is VALID
|
||||
* If '''pki_type''' is x509+sha256 and '''signature''' is valid for the serialized [[#InvoiceRequest|InvoiceRequest]] where signature is set to "", [[#InvoiceRequest|InvoiceRequest]] is VALID
|
||||
@ -366,7 +366,7 @@ For the following we assume the Sender already knows the Receiver's public key,
|
||||
The 16 byte authentication tag resulting from the AES-GCM encrypt operation MUST be prefixed to the returned ciphertext. The decrypt operation will use the first 16 bytes of the ciphertext as the GCM authentication tag and the remainder of the ciphertext as the ciphertext in the decrypt operation.
|
||||
|
||||
====AES-256 GCM Additional Authenticated Data====
|
||||
When either '''status_code''' OR '''status_message''' are present, the AES-256 GCM authenticated data used in both the encrypt and decrypt operations MUST be: STRING(status_code) || status_message. Otherwise, there is no additional authenticated data. This provides that, while not encrypted, the status_code and status_message are authenticated.
|
||||
When either '''status_code''' OR '''status_message''' are present, the AES-256 GCM authenticated data used in both the encrypt and decrypt operations MUST be: STRING(status_code) || status_message. Otherwise, there is no additional authenticated data. This provides that, while not encrypted, the status_code and status_message are authenticated.
|
||||
|
||||
===Initial Public Key Retrieval for InvoiceRequest Encryption===
|
||||
Initial public key retrieval for [[#InvoiceRequest|InvoiceRequest]] encryption via [[#EncryptedProtocolMessage|EncryptedProtocolMessage]] encapsulation can be done in a number of ways including, but not limited to, the following:
|
||||
@ -387,7 +387,7 @@ Clients SHOULD keep in mind Receivers can broadcast a transaction without return
|
||||
|
||||
==Public Key & Signature Encoding==
|
||||
* All x.509 certificates included in any message defined in this BIP MUST be DER [ITU.X690.1994] encoded.
|
||||
* All EC public keys ('''sender_public_key''', '''receiver_public_key''') in any message defined in this BIP MUST be [[SECP256k1|http://www.secg.org/sec2-v2.pdf]] ECDSA Public Key ECPoints encoded using [[SEC 2.3.3 Encoding|http://www.secg.org/sec1-v2.pdf]]. Encoding MAY be compressed.
|
||||
* All EC public keys ('''sender_public_key''', '''receiver_public_key''') in any message defined in this BIP MUST be [[SECP256k1|http://www.secg.org/sec2-v2.pdf]] ECDSA Public Key ECPoints encoded using [[SEC 2.3.3 Encoding|http://www.secg.org/sec1-v2.pdf]]. Encoding MAY be compressed.
|
||||
* All ECC signatures included in any message defined in this BIP MUST use the SHA-256 hashing algorithm and MUST be DER [ITU.X690.1994] encoded.
|
||||
* All OpenPGP certificates must follow [[https://tools.ietf.org/html/rfc4880|RFC4880]], sections 5.5 and 12.1.
|
||||
|
||||
|
@ -95,7 +95,7 @@ The payjoin proposal PSBT is sent in the HTTP response body, base64 serialized w
|
||||
|
||||
To ensure compatibility with web-wallets and browser-based-tools, all responses (including errors) must contain the HTTP header <code>Access-Control-Allow-Origin: *</code>.
|
||||
|
||||
The sender must ensure that the url refers to a scheme or protocol using authenticated encryption, for example TLS with certificate validation, or a .onion link to a hidden service whose public key identifier has already been communicated via a TLS connection. Senders SHOULD NOT accept a url representing an unencrypted or unauthenticated connection.
|
||||
The sender must ensure that the URL refers to a scheme or protocol using authenticated encryption, for example TLS with certificate validation, or a .onion link to a hidden service whose public key identifier has already been communicated via a TLS connection. Senders SHOULD NOT accept a URL representing an unencrypted or unauthenticated connection.
|
||||
|
||||
The original PSBT MUST:
|
||||
* Have all the <code>witnessUTXO</code> or <code>nonWitnessUTXO</code> information filled in.
|
||||
@ -108,7 +108,7 @@ The original PSBT MAY:
|
||||
|
||||
The payjoin proposal MUST:
|
||||
* Use all the inputs from the original PSBT.
|
||||
* Use all the outputs which do not belongs to the receiver from the original PSBT.
|
||||
* Use all the outputs which do not belong to the receiver from the original PSBT.
|
||||
* Only finalize the inputs added by the receiver. (Referred later as <code>additional inputs</code>)
|
||||
* Only fill the <code>witnessUTXO</code> or <code>nonWitnessUTXO</code> for the additional inputs.
|
||||
|
||||
@ -143,7 +143,7 @@ If the receiver does not support the version of the sender, they should send an
|
||||
}
|
||||
</pre>
|
||||
|
||||
* <code>additionalfeeoutputindex=</code>, if the sender is willing to pay for increased fee, this indicate output can have its value substracted to pay for it.
|
||||
* <code>additionalfeeoutputindex=</code>, if the sender is willing to pay for increased fee, this indicate output can have its value subtracted to pay for it.
|
||||
|
||||
If the <code>additionalfeeoutputindex</code> is out of bounds or pointing to the payment output meant for the receiver, the receiver should ignore the parameter. See [[#fee-output|fee output]] for more information.
|
||||
|
||||
@ -187,10 +187,10 @@ The well-known error codes are:
|
||||
|The receiver rejected the original PSBT.
|
||||
|}
|
||||
|
||||
The receiver is allowed to return implementation specific errors which may assist the sender to diagnose any issue.
|
||||
The receiver is allowed to return implementation-specific errors which may assist the sender to diagnose any issue.
|
||||
|
||||
However, it is important that error codes that are not well-known and that the message do not appear on the sender's software user interface.
|
||||
Such error codes or messages could be used maliciously to phish a non technical user.
|
||||
Such error codes or messages could be used maliciously to phish a non-technical user.
|
||||
Instead those errors or messages can only appear in debug logs.
|
||||
|
||||
It is advised to hard code the description of the well known error codes into the sender's software.
|
||||
@ -198,7 +198,7 @@ It is advised to hard code the description of the well known error codes into th
|
||||
===<span id="fee-output"></span>Fee output===
|
||||
|
||||
In some situation, the sender might want to pay some additional fee in the payjoin proposal.
|
||||
If such is the case, the sender must use both [[#optional-params|optional parameters]] <code>additionalfeeoutputindex=</code> and <code>maxadditionalfeecontribution=</code> to indicate which output and how much the receiver can substract fee.
|
||||
If such is the case, the sender must use both [[#optional-params|optional parameters]] <code>additionalfeeoutputindex=</code> and <code>maxadditionalfeecontribution=</code> to indicate which output and how much the receiver can subtract fee.
|
||||
|
||||
There is several cases where a fee output is useful:
|
||||
|
||||
@ -213,7 +213,7 @@ To prevent this, the sender can agree to pay more fee so the receiver make sure
|
||||
|
||||
* The sender's transaction is time sensitive.
|
||||
|
||||
When a sender pick a specific fee rate, the sender expects the transaction to be confirmed after a specific amount of time. But if the receiver adds an input without bumping the fee of the transaction, the payjoin transaction fee rate will be lower, and thus, longer to confirm.
|
||||
When a sender picks a specific fee rate, the sender expects the transaction to be confirmed after a specific amount of time. But if the receiver adds an input without bumping the fee of the transaction, the payjoin transaction fee rate will be lower, and thus, longer to confirm.
|
||||
|
||||
Our recommendation for <code>maxadditionalfeecontribution=</code> is <code>originalPSBTFeeRate * vsize(sender_input_type)</code>.
|
||||
|
||||
@ -244,8 +244,8 @@ The receiver needs to do some check on the original PSBT before proceeding:
|
||||
* If the sender included inputs in the original PSBT owned by the receiver, the receiver must either return error <code>original-psbt-rejected</code> or make sure they do not sign those inputs in the payjoin proposal.
|
||||
* If the sender's inputs are all from the same scriptPubKey type, the receiver must match the same type. If the receiver can't match the type, they must return error <code>unavailable</code>.
|
||||
* Make sure that the inputs included in the original transaction have never been seen before.
|
||||
** This prevent [[#probing-attack|probing attacks]].
|
||||
** This prevent reentrant payjoin, where a sender attempts to use payjoin transaction as a new original transaction for a new payjoin.
|
||||
** This prevents [[#probing-attack|probing attacks]].
|
||||
** This prevents reentrant payjoin, where a sender attempts to use payjoin transaction as a new original transaction for a new payjoin.
|
||||
|
||||
<code>*</code>: Interactive receivers are not required to validate the original PSBT because they are not exposed to [[#probing-attack|probing attacks]].
|
||||
|
||||
@ -257,25 +257,25 @@ The sender should check the payjoin proposal before signing it to prevent a mali
|
||||
* If the receiver's BIP21 signalled <code>pjos=0</code>, disable payment output substitution.
|
||||
* Verify that the transaction version, and the nLockTime are unchanged.
|
||||
* Check that the sender's inputs' sequence numbers are unchanged.
|
||||
* For each inputs in the proposal:
|
||||
** Verify that no keypaths is in the PSBT input
|
||||
* For each input in the proposal:
|
||||
** Verify that no keypaths are in the PSBT input
|
||||
** Verify that no partial signature has been filled
|
||||
** If it is one of the sender's input
|
||||
** If it is one of the sender's inputs:
|
||||
*** Verify that input's sequence is unchanged.
|
||||
*** Verify the PSBT input is not finalized
|
||||
** If it is one of the receiver's input
|
||||
** If it is one of the receiver's inputs:
|
||||
*** Verify the PSBT input is finalized
|
||||
*** Verify that <code>non_witness_utxo</code> or <code>witness_utxo</code> are filled in.
|
||||
** Verify that the payjoin proposal did not introduced mixed input's sequence.
|
||||
** Verify that the payjoin proposal did not introduced mixed input's type.
|
||||
** Verify that the payjoin proposal inputs all specify the same sequence value.
|
||||
** Verify that the payjoin proposal did not introduce mixed input's type.
|
||||
** Verify that all of sender's inputs from the original PSBT are in the proposal.
|
||||
* For each outputs in the proposal:
|
||||
** Verify that no keypaths is in the PSBT output
|
||||
* For each output in the proposal:
|
||||
** Verify that no keypaths are in the PSBT output
|
||||
** If the output is the [[#fee-output|fee output]]:
|
||||
*** The amount that was substracted from the output's value is less than or equal to <code>maxadditionalfeecontribution</code>. Let's call this amount <code>actual contribution</code>.
|
||||
*** Make sure the actual contribution is only paying fee: The <code>actual contribution</code> is less than or equals to the difference of absolute fee between the payjoin proposal and the original PSBT.
|
||||
*** Make sure the actual contribution is only paying for fee incurred by additional inputs: <code>actual contribution</code> is less than or equals to <code>originalPSBTFeeRate * vsize(sender_input_type) * (count(payjoin_proposal_inputs) - count(original_psbt_inputs))</code>. (see [[#fee-output|Fee output]] section)
|
||||
** If the output is the payment output and payment output substitution is allowed.
|
||||
*** The amount that was subtracted from the output's value is less than or equal to <code>maxadditionalfeecontribution</code>. Let's call this amount <code>actual contribution</code>.
|
||||
*** Make sure the actual contribution is only going towards fees: The <code>actual contribution</code> is less than or equals to the difference of absolute fee between the payjoin proposal and the original PSBT.
|
||||
*** Make sure the actual contribution is only paying for fees incurred by additional inputs: <code>actual contribution</code> is less than or equal to <code>originalPSBTFeeRate * vsize(sender_input_type) * (count(payjoin_proposal_inputs) - count(original_psbt_inputs))</code>. (see [[#fee-output|Fee output]] section)
|
||||
** If the output is the payment output and payment output substitution is allowed,
|
||||
*** Do not make any check
|
||||
** Else
|
||||
*** Make sure the output's value did not decrease.
|
||||
@ -286,8 +286,8 @@ The sender must be careful to only sign the inputs that were present in the orig
|
||||
|
||||
Note:
|
||||
* The sender must allow the receiver to add/remove or modify the receiver's own outputs. (if payment output substitution is disabled, the receiver's outputs must not be removed or decreased in value)
|
||||
* The sender should allow the receiver to not add any inputs. This is useful for the receiver to change the paymout output scriptPubKey type.
|
||||
* If no input have been added, the sender's wallet implementation should accept the payjoin proposal, but not mark the transaction as an actual payjoin in the user interface.
|
||||
* The sender should allow the receiver to not add any inputs. This is useful for the receiver to change the payment output scriptPubKey type.
|
||||
* If the receiver added no inputs, the sender's wallet implementation should accept the payjoin proposal, but not mark the transaction as an actual payjoin in the user interface.
|
||||
|
||||
Our method of checking the fee allows the receiver and the sender to batch payments in the payjoin transaction.
|
||||
It also allows the receiver to pay the fee for batching adding his own outputs.
|
||||
@ -343,7 +343,7 @@ On top of this the receiver can poison analysis by randomly faking a round amoun
|
||||
|
||||
===<span id="output-substitution"></span>Payment output substitution===
|
||||
|
||||
Unless disallowed by sender explicitely via `disableoutputsubstitution=true` or by the BIP21 url via query parameter the `pjos=0`, the receiver is free to decrease the amount, remove, or change the scriptPubKey output paying to himself.
|
||||
Unless disallowed by the sender explicitly via <code>disableoutputsubstitution=true</code> or by the BIP21 URL via the query parameter <code>pjos=0</code>, the receiver is free to decrease the amount, remove, or change the scriptPubKey output paying to himself.
|
||||
Note that if payment output substitution is disallowed, the reveiver can still increase the amount of the output. (See [[#reference-impl|the reference implementation]])
|
||||
|
||||
For example, if the sender's scriptPubKey type is P2WPKH while the receiver's payment output in the original PSBT is P2SH, then the receiver can substitute the payment output to be P2WPKH to match the sender's scriptPubKey type.
|
||||
@ -357,7 +357,7 @@ A compromised payjoin server could steal the hot wallet outputs of the receiver,
|
||||
|
||||
===Impacted heuristics===
|
||||
|
||||
Our proposal of payjoin is breaking the following blockchain heuristics:
|
||||
Our proposal of payjoin breaks the following blockchain heuristics:
|
||||
|
||||
* Common inputs heuristics.
|
||||
|
||||
@ -407,12 +407,12 @@ With payjoin, the maximum amount of money that can be lost is equal to two payme
|
||||
==<span id="reference-impl"></span>Reference sender's implementation==
|
||||
|
||||
Here is pseudo code of a sender implementation.
|
||||
<code>RequestPayjoin</code> takes the bip21 URI of the payment, the wallet and the <code>signedPSBT</code>.
|
||||
<code>RequestPayjoin</code> takes the BIP21 URI of the payment, the wallet and the <code>signedPSBT</code>.
|
||||
|
||||
The <code>signedPSBT</code> represents a PSBT which has been fully signed, but not yet finalized.
|
||||
We then prepare <code>originalPSBT</code> from the <code>signedPSBT</code> via the <code>CreateOriginalPSBT</code> function and get back the <code>proposal</code>.
|
||||
|
||||
While we verify the <code>proposal</code>, we also import into it informations about our own inputs and outputs from the <code>signedPSBT</code>.
|
||||
While we verify the <code>proposal</code>, we also import into it information about our own inputs and outputs from the <code>signedPSBT</code>.
|
||||
At the end of this <code>RequestPayjoin</code>, the proposal is verified and ready to be signed.
|
||||
|
||||
We logged the different PSBT involved, and show the result in our [[#test-vectors|test vectors]].
|
||||
@ -553,7 +553,7 @@ public async Task<PSBT> RequestPayjoin(
|
||||
if (output.OriginalTxOut == feeOutput)
|
||||
{
|
||||
var actualContribution = feeOutput.Value - proposedPSBTOutput.Value;
|
||||
// The amount that was substracted from the output's value is less than or equal to maxadditionalfeecontribution
|
||||
// The amount that was subtracted from the output's value is less than or equal to maxadditionalfeecontribution
|
||||
if (actualContribution > optionalParameters.MaxAdditionalFeeContribution)
|
||||
throw new PayjoinSenderException("The actual contribution is more than maxadditionalfeecontribution");
|
||||
// Make sure the actual contribution is only paying fee
|
||||
@ -638,7 +638,7 @@ A successful exchange with:
|
||||
|
||||
{| class="wikitable"
|
||||
!InputScriptType
|
||||
!Orginal PSBT Fee rate
|
||||
!Original PSBT Fee rate
|
||||
!maxadditionalfeecontribution
|
||||
!additionalfeeoutputindex
|
||||
|-
|
||||
@ -670,7 +670,7 @@ A successful exchange with:
|
||||
|
||||
==Backward compatibility==
|
||||
|
||||
The receivers are advertising payjoin capabilities through [[bip-0021.mediawiki|BIP21's URI Scheme]].
|
||||
The receivers advertise payjoin capabilities through [[bip-0021.mediawiki|BIP21's URI Scheme]].
|
||||
|
||||
Senders not supporting payjoin will just ignore the <code>pj</code> variable and thus, will proceed to normal payment.
|
||||
|
||||
|
@ -84,7 +84,7 @@ After adding inputs to the transaction, the receiver generally will want to adju
|
||||
|
||||
=== Returning the partial transaction ===
|
||||
|
||||
The receiver must sign all contributed inputs in the partial transaction. The partial transaction should also remove all witnesses from the the original template transaction as they are no longer valid, and need to be recalculated by the sender. The receiver returns the partial transaction as a binary-encoded HTTP response with a status code of 200. To ensure compatibility with web-wallets and browser-based-tools, all responses (including errors) must contain the HTTP header "Access-Control-Allow-Origin: *"
|
||||
The receiver must sign all contributed inputs in the partial transaction. The partial transaction should also remove all witnesses from the original template transaction as they are no longer valid, and need to be recalculated by the sender. The receiver returns the partial transaction as a binary-encoded HTTP response with a status code of 200. To ensure compatibility with web-wallets and browser-based-tools, all responses (including errors) must contain the HTTP header "Access-Control-Allow-Origin: *"
|
||||
|
||||
|
||||
=== Sender Validation ===
|
||||
|
@ -35,7 +35,7 @@ Each level has a special meaning, described in the chapters below.
|
||||
|
||||
===Purpose===
|
||||
|
||||
Purpose is a constant set following the BIP43 recommendation to: the ASCII value of "80" with the most signifigant bit set to indicate hardened derivation (0x80000050). It indicates that the subtree of this node is used according to this specification.
|
||||
Purpose is a constant set following the BIP43 recommendation to: the ASCII value of "80" with the most significant bit set to indicate hardened derivation (0x80000050). It indicates that the subtree of this node is used according to this specification.
|
||||
|
||||
Hardened derivation is used at this level.
|
||||
|
||||
|
@ -35,7 +35,7 @@ Each level has a special meaning, described in the chapters below.
|
||||
|
||||
===Purpose===
|
||||
|
||||
Purpose is a constant set following the BIP43 recommendation to: the ASCII value of "81" with the most signifigant bit set to indicate hardened derivation (0x80000051). It indicates that the subtree of this node is used according to this specification.
|
||||
Purpose is a constant set following the BIP43 recommendation to: the ASCII value of "81" with the most significant bit set to indicate hardened derivation (0x80000051). It indicates that the subtree of this node is used according to this specification.
|
||||
|
||||
Hardened derivation is used at this level.
|
||||
|
||||
|
@ -53,7 +53,7 @@ p //' n instead of p / 0' / n
|
||||
|
||||
Rather than specifying upfront which path is to be used for a specific purpose (i.e. external invoicing vs. internal change), different applications can specify arbitrary parent nodes and derivation paths. This allows for nesting of sublevels to arbitrary depth with application-specified semantics. Rather than trying to specify use cases upfront, we leave the design completely open-ended. Different applications can exchange these mappings for interoperability. Eventually, if certain mappings become popular, application user interfaces can provide convenient shortcuts or use them as defaults.
|
||||
|
||||
Note that BIP32 suggests reserving child 0 for the derivation of signing keys rather than sublevels. It is not really necessary to reserve signing key parents, however, as each key's parent's path can be explicitly stated. But unless we reserve a child for sublevel derivation, we lose the ability to nest deeper levels into the hierarchy. While we could reserve any arbitrary index for nesting sublevels, reserving child 0 seems simplest to implement, leaving all indices > 0 for contiguously indexed signing keys. We could also use MAX_INDEX (2<sup>31</sup> - 1) for this purpose. However, we believe doing so introduces more ideosyncracies into the semantics and will present a problem if we ever decide to extend the scheme to use indices larger than 31 bits.
|
||||
Note that BIP32 suggests reserving child 0 for the derivation of signing keys rather than sublevels. It is not really necessary to reserve signing key parents, however, as each key's parent's path can be explicitly stated. But unless we reserve a child for sublevel derivation, we lose the ability to nest deeper levels into the hierarchy. While we could reserve any arbitrary index for nesting sublevels, reserving child 0 seems simplest to implement, leaving all indices > 0 for contiguously indexed signing keys. We could also use MAX_INDEX (2<sup>31</sup> - 1) for this purpose. However, we believe doing so introduces more idiosyncrasies into the semantics and will present a problem if we ever decide to extend the scheme to use indices larger than 31 bits.
|
||||
|
||||
==Use Cases==
|
||||
|
||||
@ -83,7 +83,7 @@ We can continue creating subaccounts indefinitely using this scheme.
|
||||
|
||||
In order to create a bidirectional payment channel, it is necessary that previous commitments be revokable. In order to revoke previous commitments, each party reveals a secret to the other that would allow them to steal the funds in the channel if a transaction for a previous commitment is inserted into the blockchain.
|
||||
|
||||
By allowing for arbitrary nesting of sublevels, we can construct decision trees of arbitrary depth and revoke an entire branch by revealing a parent node used to derive all the children.
|
||||
By allowing for arbitrary nesting of sublevels, we can construct decision trees of arbitrary depth and revoke an entire branch by revealing a parent node used to derive all the children.
|
||||
|
||||
==References==
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
Author: Pavol Rusnak <stick@satoshilabs.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0084
|
||||
Status: Draft
|
||||
Type: Informational
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2017-12-28
|
||||
License: CC0-1.0
|
||||
</pre>
|
||||
@ -61,7 +61,7 @@ Additional registered version bytes are listed in [[https://github.com/satoshila
|
||||
|
||||
==Backwards Compatibility==
|
||||
|
||||
This BIP is not backwards compatible by design as described under [#considerations]. An incompatible wallet will not discover accounts at all and the user will notice that something is wrong.
|
||||
This BIP is not backwards compatible by design as described under [[#considerations|considerations]]. An incompatible wallet will not discover accounts at all and the user will notice that something is wrong.
|
||||
|
||||
==Test vectors==
|
||||
|
||||
|
@ -3,9 +3,10 @@
|
||||
Layer: Applications
|
||||
Title: Deterministic Entropy From BIP32 Keychains
|
||||
Author: Ethan Kosakovsky <ethankosakovsky@protonmail.com>
|
||||
Aneesh Karve <dowsing.seaport0d@icloud.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0085
|
||||
Status: Draft
|
||||
Status: Final
|
||||
Type: Informational
|
||||
Created: 2020-03-20
|
||||
License: BSD-2-Clause
|
||||
@ -14,15 +15,19 @@
|
||||
|
||||
==Abstract==
|
||||
|
||||
''"One Seed to rule them all,''
|
||||
''One Key to find them,''
|
||||
''One Path to bring them all,''
|
||||
''"One Seed to rule them all,''<br>
|
||||
''One Key to find them,''<br>
|
||||
''One Path to bring them all,''<br>
|
||||
''And in cryptography bind them."''
|
||||
|
||||
It is not possible to maintain one single (mnemonic) seed backup for all keychains used across various wallets because there are a variety of incompatible standards. Sharing of seeds across multiple wallets is not desirable for security reasons. Physical storage of multiple seeds is difficult depending on the security and redundancy required.
|
||||
|
||||
As HD keychains are essentially derived from initial entropy, this proposal provides a way to derive entropy from the keychain which can be fed into whatever method a wallet uses to derive the initial mnemonic seed or root key.
|
||||
|
||||
==Copyright==
|
||||
|
||||
This BIP is dual-licensed under the Open Publication License and BSD 2-clause license.
|
||||
|
||||
==Definitions==
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
|
||||
@ -33,13 +38,16 @@ The terminology related to keychains used in the wild varies widely, for example
|
||||
# '''BIP39 mnemonic''' is the mnemonic phrase that is calculated from the entropy used before hashing of the mnemonic in BIP39.
|
||||
# '''BIP39 seed''' is the result of hashing the BIP39 mnemonic seed.
|
||||
|
||||
When in doubt, assume big endian byte serialization, such that the leftmost
|
||||
byte is the most significant.
|
||||
|
||||
==Motivation==
|
||||
|
||||
Most wallets implement BIP32 which defines how a BIP32 root key can be used to derive keychains. As a consequence, a backup of just the BIP32 root key is sufficient to include all keys derived from it. BIP32 does not have a human friendly serialization of the BIP32 root key (or BIP32 extended keys in general) which makes paper backups or manually restoring the key more error-prone. BIP39 was designed to solve this problem but rather than serialize the BIP32 root key, it takes some entropy, encoded to a "seed mnemonic", which is then hashed to derive the BIP39 seed which can be turned into the BIP32 root key. Saving the BIP39 mnemonic is enough to reconstruct the entire BIP32 keychain, but a BIP32 root key cannot be reversed back to the BIP39 mnemonic.
|
||||
Most wallets implement BIP32 which defines how a BIP32 root key can be used to derive keychains. As a consequence, a backup of just the BIP32 root key is sufficient to include all keys derived from it. BIP32 does not have a human-friendly serialization of the BIP32 root key (or BIP32 extended keys in general), which makes paper backups or manually restoring the key more error-prone. BIP39 was designed to solve this problem, but rather than serialize the BIP32 root key, it takes some entropy, encoded to a "seed mnemonic", which is then hashed to derive the BIP39 seed, which can be turned into the BIP32 root key. Saving the BIP39 mnemonic is enough to reconstruct the entire BIP32 keychain, but a BIP32 root key cannot be reversed back to the BIP39 mnemonic.
|
||||
|
||||
Most wallets implement BIP39, so on initialization or restoration, the user must interact with a BIP39 mnemonic. Most wallets do not support BIP32 extended private keys, so each wallet must either share the same BIP39 mnemonic, or have a separate BIP39 mnemonic entirely. Neither scenarios are particularly satisfactory for security reasons. For example, some wallets may be inherently less secure like hot wallets on smartphones, Join Market servers, or Lightning Network nodes. Having multiple seeds is far from desirable, especially for those who rely on split key or redundancy backups in different geological locations. Adding is necessarily difficult and may result in users being more lazy with subsequent keys, resulting in compromised security or loss of keys.
|
||||
Most wallets implement BIP39, so on initialization or restoration, the user must interact with a BIP39 mnemonic. Most wallets do not support BIP32 extended private keys, so each wallet must either share the same BIP39 mnemonic, or have a separate BIP39 mnemonic entirely. Neither scenario is particularly satisfactory for security reasons. For example, some wallets may be inherently less secure, like hot wallets on smartphones, JoinMarket servers, or Lightning Network nodes. Having multiple seeds is far from desirable, especially for those who rely on split key or redundancy backups in different geological locations. Adding keys is necessarily difficult and may result in users being more lazy with subsequent keys, resulting in compromised security or loss of keys.
|
||||
|
||||
There is added complication with wallets that implement other standards, or no standards at all. Bitcoin Core wallet uses a WIF as the ''hdseed'', and yet other wallets like Electrum use different mnemonic schemes to derive the BIP32 root key. Other cryptocurrencies like Monero also use an entirely different mnemonic scheme.
|
||||
There is an added complication with wallets that implement other standards, or no standards at all. The Bitcoin Core wallet uses a WIF as the ''hdseed'', and yet other wallets, like Electrum, use different mnemonic schemes to derive the BIP32 root key. Other cryptocurrencies, like Monero, use an entirely different mnemonic scheme.
|
||||
|
||||
Ultimately, all of the mnemonic/seed schemes start with some "initial entropy" to derive a mnemonic/seed, and then process the mnemonic into a BIP32 key, or private key. We can use BIP32 itself to derive the "initial entropy" to then recreate the same mnemonic or seed according to the specific application standard of the target wallet. We can use a BIP44-like categorization to ensure uniform derivation according to the target application type.
|
||||
|
||||
@ -47,9 +55,13 @@ Ultimately, all of the mnemonic/seed schemes start with some "initial entropy" t
|
||||
|
||||
We assume a single BIP32 master root key. This specification is not concerned with how this was derived (e.g. directly or via a mnemonic scheme such as BIP39).
|
||||
|
||||
For each application that requires its own wallet, a unique private key is derived from the BIP32 master root key using a fully hardened derivation path. The resulting private key (k) is then processed with HMAC-SHA512, where the key is "bip-entropy-from-k", and the message payload is the private key k: <code>HMAC-SHA512(key="bip-entropy-from-k", msg=k)</code>. The result produces 512 bits of entropy. Each application SHOULD use up to the required number of bits necessary for their operation truncating the rest.
|
||||
For each application that requires its own wallet, a unique private key is derived from the BIP32 master root key using a fully hardened derivation path. The resulting private key (k) is then processed with HMAC-SHA512, where the key is "bip-entropy-from-k", and the message payload is the private key k: <code>HMAC-SHA512(key="bip-entropy-from-k", msg=k)</code>
|
||||
<ref name="hmac-sha512">
|
||||
The reason for running the derived key through HMAC-SHA512 and truncating the result as necessary is to prevent leakage of the parent tree should the derived key (''k'') be compromised. While the specification requires the use of hardended key derivation which would prevent this, we cannot enforce hardened derivation, so this method ensures the derived entropy is hardened. Also, from a semantic point of view, since the purpose is to derive entropy and not a private key, we are required to transform the child key. This is done out of an abundance of caution, in order to ward off unwanted side effects should ''k'' be used for a dual purpose, including as a nonce ''hash(k)'', where undesirable and unforeseen interactions could occur.
|
||||
</ref>.
|
||||
The result produces 512 bits of entropy. Each application SHOULD use up to the required number of bits necessary for their operation, and truncate the rest.
|
||||
|
||||
The HMAC-SHA512 function is specified in [http://tools.ietf.org/html/rfc4231 RFC 4231].
|
||||
The HMAC-SHA512 function is specified in [https://tools.ietf.org/html/rfc4231 RFC 4231].
|
||||
|
||||
===Test vectors===
|
||||
|
||||
@ -78,7 +90,7 @@ BIP85-DRNG-SHAKE256 is a deterministic random number generator for cryptographic
|
||||
RSA key generation is an example of a function that requires orders of magnitude more than 64 bytes of random input. Further, it is not possible to precalculate the amount of random input required until the function has completed.
|
||||
|
||||
drng_reader = BIP85DRNG.new(bip85_entropy)
|
||||
rsa_key = RSA.generate_key(4096, drng_reader.read())
|
||||
rsa_key = RSA.generate_key(4096, drng_reader.read)
|
||||
|
||||
===Test Vectors===
|
||||
INPUT:
|
||||
@ -91,28 +103,13 @@ OUTPUT
|
||||
|
||||
* DRNG(80 bytes)=b78b1ee6b345eae6836c2d53d33c64cdaf9a696487be81b03e822dc84b3f1cd883d7559e53d175f243e4c349e822a957bbff9224bc5dde9492ef54e8a439f6bc8c7355b87a925a37ee405a7502991111
|
||||
|
||||
==Reference Implementation==
|
||||
|
||||
* Python library implementation: [https://github.com/ethankosakovsky/bip85]
|
||||
* JavaScript library implementation: [https://github.com/hoganri/bip85-js]
|
||||
|
||||
===Other Implementations===
|
||||
|
||||
* JavaScript library implementation: [https://github.com/hoganri/bip85-js]
|
||||
|
||||
* Coldcard Firmware: [https://github.com/Coldcard/firmware/pull/39]
|
||||
|
||||
* Ian Coleman's Mnemonic Code Converter: [https://github.com/iancoleman/bip39] and [https://iancoleman.io/bip39/]
|
||||
|
||||
* AirGap Vault: [https://github.com/airgap-it/airgap-vault/commit/d64332fc2f332be622a1229acb27f621e23774d6]
|
||||
|
||||
btc_hd_wallet: [https://github.com/scgbckbone/btc-hd-wallet]
|
||||
|
||||
==Applications==
|
||||
|
||||
The Application number defines how entropy will be used post processing. Some basic examples follow:
|
||||
|
||||
Derivation path uses the format <code>m/83696968'/{app_no}'/{index}'</code> where ''{app_no}'' is the path for the application, and ''{index}'' is the index.
|
||||
Derivation paths follow the format <code>m/83696968'/{app_no}'/{index}'</code>, where ''{app_no}'' is the path for the application, and ''{index}'' is the index.
|
||||
|
||||
Application numbers should be semantic in some way, such as a BIP number or ASCII character code sequence.
|
||||
|
||||
===BIP39===
|
||||
Application number: 39'
|
||||
@ -155,6 +152,10 @@ Language Table
|
||||
|-
|
||||
| Czech
|
||||
| 8'
|
||||
|-
|
||||
| Portuguese
|
||||
| 9'
|
||||
|-
|
||||
|}
|
||||
|
||||
Words Table
|
||||
@ -168,10 +169,18 @@ Words Table
|
||||
| 128 bits
|
||||
| 12'
|
||||
|-
|
||||
| 15 words
|
||||
| 160 bits
|
||||
| 15'
|
||||
|-
|
||||
| 18 words
|
||||
| 192 bits
|
||||
| 18'
|
||||
|-
|
||||
| 21 words
|
||||
| 224 bits
|
||||
| 21'
|
||||
|-
|
||||
| 24 words
|
||||
| 256 bits
|
||||
| 24'
|
||||
@ -219,7 +228,16 @@ OUTPUT:
|
||||
===HD-Seed WIF===
|
||||
Application number: 2'
|
||||
|
||||
Uses 256 bits[1] of entropy as the secret exponent to derive a private key and encode as a compressed WIF which will be used as the hdseed for Bitcoin Core wallets.
|
||||
Uses the most significant 256 bits<ref name="curve-order">
|
||||
There is a very small chance that you'll make an invalid
|
||||
key that is zero or larger than the order of the curve. If this occurs, software
|
||||
should hard fail (forcing users to iterate to the next index). From BIP32:
|
||||
<blockquote>
|
||||
In case parse<sub>256</sub>(I<sub>L</sub>) ≥ n or k<sub>i</sub> = 0, the resulting key is invalid, and one should proceed with the next value for i. (Note: this has probability lower than 1 in 2<sup>127</sup>.)
|
||||
</blockquote>
|
||||
</ref>
|
||||
of entropy as the secret exponent to derive a private key and encode as a compressed
|
||||
WIF that will be used as the hdseed for Bitcoin Core wallets.
|
||||
|
||||
Path format is <code>m/83696968'/2'/{index}'</code>
|
||||
|
||||
@ -234,7 +252,11 @@ OUTPUT
|
||||
===XPRV===
|
||||
Application number: 32'
|
||||
|
||||
Taking 64 bytes of the HMAC digest, the first 32 bytes are the chain code, and second 32 bytes[1] are the private key for BIP32 XPRV value. Child number, depth, and parent fingerprint are forced to zero.
|
||||
Taking 64 bytes of the HMAC digest, the first 32 bytes are the chain code, and the second 32 bytes<ref name="curve-order" /> are the private key for the BIP32 XPRV value. Child number, depth, and parent fingerprint are forced to zero.
|
||||
|
||||
''Warning'': The above order reverses the order of BIP32, which takes the first 32 bytes as the private key, and the second 32 bytes as the chain code.
|
||||
|
||||
Applications may support Testnet by emitting TPRV keys if and only if the input root key is a Testnet key.
|
||||
|
||||
Path format is <code>m/83696968'/32'/{index}'</code>
|
||||
|
||||
@ -244,7 +266,7 @@ INPUT:
|
||||
|
||||
OUTPUT
|
||||
* DERIVED ENTROPY=ead0b33988a616cf6a497f1c169d9e92562604e38305ccd3fc96f2252c177682
|
||||
* DERIVED WIF=xprv9s21ZrQH143K2srSbCSg4m4kLvPMzcWydgmKEnMmoZUurYuBuYG46c6P71UGXMzmriLzCCBvKQWBUv3vPB3m1SATMhp3uEjXHJ42jFg7myX
|
||||
* DERIVED XPRV=xprv9s21ZrQH143K2srSbCSg4m4kLvPMzcWydgmKEnMmoZUurYuBuYG46c6P71UGXMzmriLzCCBvKQWBUv3vPB3m1SATMhp3uEjXHJ42jFg7myX
|
||||
|
||||
===HEX===
|
||||
Application number: 128169'
|
||||
@ -262,6 +284,82 @@ INPUT:
|
||||
OUTPUT
|
||||
* DERIVED ENTROPY=492db4698cf3b73a5a24998aa3e9d7fa96275d85724a91e71aa2d645442f878555d078fd1f1f67e368976f04137b1f7a0d19232136ca50c44614af72b5582a5c
|
||||
|
||||
===PWD BASE64===
|
||||
Application number: 707764'
|
||||
|
||||
The derivation path format is: <code>m/83696968'/707764'/{pwd_len}'/{index}'</code>
|
||||
|
||||
`20 <= pwd_len <= 86`
|
||||
|
||||
[https://datatracker.ietf.org/doc/html/rfc4648 Base64] encode all 64 bytes of entropy.
|
||||
Remove any spaces or new lines inserted by Base64 encoding process. Slice base64 result string
|
||||
on index 0 to `pwd_len`. This slice is the password. As `pwd_len` is limited to 86, passwords will not contain padding.
|
||||
|
||||
Entropy calculation:<br>
|
||||
R = 64 (base64 - do not count padding)<br>
|
||||
L = pwd_len<br>
|
||||
Entropy = log2(R ** L)<br>
|
||||
|
||||
{| class="wikitable" style="margin:auto"
|
||||
! pwd_length !! (cca) entropy
|
||||
|-
|
||||
| 20 || 120.0
|
||||
|-
|
||||
| 24 || 144.0
|
||||
|-
|
||||
| 32 || 192.0
|
||||
|-
|
||||
| 64 || 384.0
|
||||
|-
|
||||
| 86 || 516.0
|
||||
|}
|
||||
|
||||
INPUT:
|
||||
* MASTER BIP32 ROOT KEY: xprv9s21ZrQH143K2LBWUUQRFXhucrQqBpKdRRxNVq2zBqsx8HVqFk2uYo8kmbaLLHRdqtQpUm98uKfu3vca1LqdGhUtyoFnCNkfmXRyPXLjbKb
|
||||
* PATH: m/83696968'/707764'/21'/0'
|
||||
|
||||
OUTPUT
|
||||
* DERIVED ENTROPY=74a2e87a9ba0cdd549bdd2f9ea880d554c6c355b08ed25088cfa88f3f1c4f74632b652fd4a8f5fda43074c6f6964a3753b08bb5210c8f5e75c07a4c2a20bf6e9
|
||||
* DERIVED PWD=dKLoepugzdVJvdL56ogNV
|
||||
|
||||
===PWD BASE85===
|
||||
Application number: 707785'
|
||||
|
||||
The derivation path format is: <code>m/83696968'/707785'/{pwd_len}'/{index}'</code>
|
||||
|
||||
`10 <= pwd_len <= 80`
|
||||
|
||||
Base85 encode all 64 bytes of entropy.
|
||||
Remove any spaces or new lines inserted by Base64 encoding process. Slice base85 result string
|
||||
on index 0 to `pwd_len`. This slice is the password. `pwd_len` is limited to 80 characters.
|
||||
|
||||
Entropy calculation:<br>
|
||||
R = 85<br>
|
||||
L = pwd_len<br>
|
||||
Entropy = log2(R ** L)<br>
|
||||
|
||||
{| class="wikitable" style="margin:auto"
|
||||
! pwd_length !! (cca) entropy
|
||||
|-
|
||||
| 10 || 64.0
|
||||
|-
|
||||
| 15 || 96.0
|
||||
|-
|
||||
| 20 || 128.0
|
||||
|-
|
||||
| 30 || 192.0
|
||||
|-
|
||||
| 80 || 512.0
|
||||
|}
|
||||
|
||||
INPUT:
|
||||
* MASTER BIP32 ROOT KEY: xprv9s21ZrQH143K2LBWUUQRFXhucrQqBpKdRRxNVq2zBqsx8HVqFk2uYo8kmbaLLHRdqtQpUm98uKfu3vca1LqdGhUtyoFnCNkfmXRyPXLjbKb
|
||||
* PATH: m/83696968'/707785'/12'/0'
|
||||
|
||||
OUTPUT
|
||||
* DERIVED ENTROPY=f7cfe56f63dca2490f65fcbf9ee63dcd85d18f751b6b5e1c1b8733af6459c904a75e82b4a22efff9b9e69de2144b293aa8714319a054b6cb55826a8e51425209
|
||||
* DERIVED PWD=_s`{TW89)i4`
|
||||
|
||||
===RSA===
|
||||
|
||||
Application number: 828365'
|
||||
@ -288,35 +386,94 @@ The resulting RSA key can be used to create a GPG key where the creation date MU
|
||||
|
||||
Note on GPG key capabilities on smartcard/hardware devices:
|
||||
|
||||
GPG capable smart-cards SHOULD be be loaded as follows: The encryption slot SHOULD be loaded with the ENCRYPTION capable key; the authentication slot SHOULD be loaded with the AUTHENTICATION capable key. The signature capable slot SHOULD be loaded with the SIGNATURE capable key.
|
||||
GPG capable smart-cards SHOULD be loaded as follows: The encryption slot SHOULD be loaded with the ENCRYPTION capable key; the authentication slot SHOULD be loaded with the AUTHENTICATION capable key. The signature capable slot SHOULD be loaded with the SIGNATURE capable key.
|
||||
|
||||
However, depending on available slots on the smart-card, and preferred policy, the CERTIFY capable key MAY be flagged with CERTIFY and SIGNATURE capabilities and loaded into the SIGNATURE capable slot (for example where the smart-card has only three slots and the CERTIFY capability is required on the same card). In this case, the SIGNATURE capable sub-key would be disregarded because the CERTIFY capable key serves a dual purpose.
|
||||
|
||||
===DICE===
|
||||
|
||||
Application number: 89101'
|
||||
|
||||
The derivation path format is: <code>m/83696968'/89101'/{sides}'/{rolls}'/{index}'</code>
|
||||
|
||||
2 <= sides <= 2^32 - 1
|
||||
1 <= rolls <= 2^32 - 1
|
||||
|
||||
Use this application to generate PIN numbers, numeric secrets, and secrets over custom alphabets.
|
||||
For example, applications could generate alphanumeric passwords from a 62-sided die (26 + 26 + 10).
|
||||
|
||||
Roll values are zero-indexed, such that an N-sided die produces values in the range
|
||||
<code>[0, N-1]</code>, inclusive. Applications should separate printed rolls by a comma or similar.
|
||||
|
||||
Create a BIP85 DRNG whose seed is the derived entropy.
|
||||
|
||||
Calculate the following integers:
|
||||
|
||||
bits_per_roll = ceil(log_2(sides))
|
||||
bytes_per_roll = ceil(bits_per_roll / 8)
|
||||
|
||||
Read <code>bytes_per_roll</code> bytes from the DRNG.
|
||||
Trim any bits in excess of <code>bits_per_roll</code> (retain the most
|
||||
significant bits). The resulting integer represents a single roll or trial.
|
||||
If the trial is greater than or equal to the number of sides, skip it and
|
||||
move on to the next one. Repeat as needed until all rolls are complete.
|
||||
|
||||
INPUT:
|
||||
* MASTER BIP32 ROOT KEY: xprv9s21ZrQH143K2LBWUUQRFXhucrQqBpKdRRxNVq2zBqsx8HVqFk2uYo8kmbaLLHRdqtQpUm98uKfu3vca1LqdGhUtyoFnCNkfmXRyPXLjbKb
|
||||
* PATH: m/83696968'/89101'/6'/10'/0'
|
||||
OUTPUT
|
||||
* DERIVED ENTROPY=5e41f8f5d5d9ac09a20b8a5797a3172b28c806aead00d27e36609e2dd116a59176a738804236586f668da8a51b90c708a4226d7f92259c69f64c51124b6f6cd2
|
||||
* DERIVED ROLLS=1,0,0,2,0,1,5,5,2,4
|
||||
|
||||
==Backwards Compatibility==
|
||||
|
||||
This specification is not backwards compatible with any other existing specification.
|
||||
|
||||
This specification relies on BIP32 but is agnostic to how the BIP32 root key is derived. As such, this standard is able to derive wallets with initialization schemes like BIP39 or Electrum wallet style mnemonics.
|
||||
|
||||
==Discussion==
|
||||
|
||||
The reason for running the derived key through HMAC-SHA512 and truncating the result as necessary is to prevent leakage of the parent tree should the derived key (''k'') be compromized. While the specification requires the use of hardended key derivation which would prevent this, we cannot enforce hardened derivation, so this method ensures the derived entropy is hardened. Also, from a semantic point of view, since the purpose is to derive entropy and not a private key, we are required to transform the child key. This is done out of an abundance of caution, in order to ward off unwanted side effects should ''k'' be used for a dual purpose, including as a nonce ''hash(k)'', where undesirable and unforeseen interactions could occur.
|
||||
|
||||
==Acknowledgements==
|
||||
|
||||
Many thanks to Peter Gray and Christopher Allen for their input, and to Peter for suggesting extra application use cases.
|
||||
|
||||
==References==
|
||||
|
||||
BIP32, BIP39
|
||||
|
||||
==Reference Implementations==
|
||||
|
||||
* 1.3.0 Python 3.x library implementation: [https://github.com/akarve/bipsea]
|
||||
* 1.1.0 Python 2.x library implementation: [https://github.com/ethankosakovsky/bip85]
|
||||
* 1.0.0 JavaScript library implementation: [https://github.com/hoganri/bip85-js]
|
||||
|
||||
==Changelog==
|
||||
|
||||
===1.3.0 (2024-10-22)===
|
||||
|
||||
====Added====
|
||||
|
||||
* Dice application 89101'
|
||||
* Czech language code to application 39'
|
||||
* TPRV guidance for application 32'
|
||||
* Warning on application 32' key and chain code ordering
|
||||
|
||||
===1.2.0 (2022-12-04)===
|
||||
|
||||
====Added====
|
||||
|
||||
* Base64 application 707764'
|
||||
* Base85 application 707785'
|
||||
|
||||
===1.1.0 (2020-11-19)===
|
||||
|
||||
====Added====
|
||||
|
||||
* BIP85-DRNG-SHAKE256
|
||||
* RSA application 828365'
|
||||
|
||||
===1.0.0 (2020-06-11)===
|
||||
|
||||
* Initial version
|
||||
|
||||
==Footnotes==
|
||||
|
||||
[1] There is a very small chance that you'll make an invalid key that is zero or bigger than the order of the curve. If this occurs, software should hard fail (forcing users to iterate to the next index).
|
||||
<references />
|
||||
|
||||
From BIP32:
|
||||
In case parse<sub>256</sub>(I<sub>L</sub>) is 0 or ≥ n, the resulting key is invalid, and one should proceed with the next value for i. (Note: this has probability lower than 1 in 2<sup>127</sup>.)
|
||||
==Acknowledgements==
|
||||
|
||||
==Copyright==
|
||||
|
||||
This BIP is dual-licensed under the Open Publication License and BSD 2-clause license.
|
||||
Many thanks to Peter Gray and Christopher Allen for their input, and to Peter for suggesting extra application use cases.
|
||||
|
@ -2,10 +2,10 @@
|
||||
BIP: 86
|
||||
Layer: Applications
|
||||
Title: Key Derivation for Single Key P2TR Outputs
|
||||
Author: Andrew Chow <andrew@achow101.com>
|
||||
Author: Ava Chow <me@achow101.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0086
|
||||
Status: Draft
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2021-06-22
|
||||
License: BSD-2-Clause
|
||||
|
@ -40,7 +40,7 @@ A modern standardization is needed for multisig derivation paths. There are som
|
||||
m / purpose' / cosigner_index / change / address_index
|
||||
</pre>
|
||||
|
||||
BIP45 unecessarily demands a single script type (here, P2SH). In addition, BIP45 sets <code>cosigner_index</code> in order to sort the <code>purpose'</code> public keys of each cosigner. This too is redundant, as descriptors can set the order of the public keys with <code>multi</code> or have them sorted lexicographically (as described in [https://github.com/bitcoin/bips/blob/master/bip-0067.mediawiki BIP67]) with <code>sortedmulti</code>. Sorting public keys between cosigners in order to create the full derivation path, prior to sending the key record to the coordinator to create the descriptor, merely adds additional unnecessary communication rounds.
|
||||
BIP45 unnecessarily demands a single script type (here, P2SH). In addition, BIP45 sets <code>cosigner_index</code> in order to sort the <code>purpose'</code> public keys of each cosigner. This too is redundant, as descriptors can set the order of the public keys with <code>multi</code> or have them sorted lexicographically (as described in [https://github.com/bitcoin/bips/blob/master/bip-0067.mediawiki BIP67]) with <code>sortedmulti</code>. Sorting public keys between cosigners in order to create the full derivation path, prior to sending the key record to the coordinator to create the descriptor, merely adds additional unnecessary communication rounds.
|
||||
|
||||
The second multisignature "standard" in use is m/48', which specifies:
|
||||
|
||||
@ -48,7 +48,7 @@ The second multisignature "standard" in use is m/48', which specifies:
|
||||
m / purpose' / coin_type' / account' / script_type' / change / address_index
|
||||
</pre>
|
||||
|
||||
Rather than following in BIP 44/49/84's path and having a separate BIP per script after P2SH (BIP45), vendors decided to insert <code>script_type'</code> into the derivation path (where P2SH-P2WSH=1, P2WSH=2, Future_Script=3, etc). As described previously, this is unnecessary, as the descriptor sets the script. While it attempts to reduce maintainence work by getting rid of new BIPs-per-script, it still requires maintaining an updated, redundant, <code>script_type</code> list.
|
||||
Rather than following in BIP 44/49/84's path and having a separate BIP per script after P2SH (BIP45), vendors decided to insert <code>script_type'</code> into the derivation path (where P2SH-P2WSH=1, P2WSH=2, Future_Script=3, etc). As described previously, this is unnecessary, as the descriptor sets the script. While it attempts to reduce maintenance work by getting rid of new BIPs-per-script, it still requires maintaining an updated, redundant, <code>script_type</code> list.
|
||||
|
||||
The structure proposed later in this paper solves these issues and is quite comprehensive. It allows for the handling of multiple accounts, external and internal chains per account, and millions of addresses per chain, in a multi-party, multisignature, hierarchical deterministic wallet regardless of the script type <ref>'''Why propose this structure only for multisignature wallets?''' Currently, single-sig wallets are able to restore funds using just the master private key data (in the format of BIP39 usually). Even if the user doesn't recall the derivation used, the wallet implementation can iterate through common schemes (BIP44/49/84). With this proposed hierarchy, the user would either have to now backup additional data (the descriptor), or the wallet would have to attempt all script types for every account level when restoring. Because of this, even though the descriptor language handles the signature type just like it does the script type, it is best to restrict this script-agnostic hierarchy to multisignature wallets only.</ref>.
|
||||
|
||||
@ -105,7 +105,7 @@ Hardened derivation is used at this level.
|
||||
|
||||
It is crucial that this level is increased for each new wallet joined or private/public keys created; for both privacy and cryptographic purposes.
|
||||
For example, before sending a new key record to a coordinator, the wallet must increment the <code>account'</code> level.
|
||||
This prevents key reuse - across ECDSA and Schnorr signatures, across different script types, and inbetween the same wallet types.
|
||||
This prevents key reuse - across ECDSA and Schnorr signatures, across different script types, and in between the same wallet types.
|
||||
|
||||
===Change===
|
||||
|
||||
|
@ -27,7 +27,7 @@ This BIP is licensed under the 2-clause BSD license.
|
||||
|
||||
BIP32 derivation path format is universal, and a number of schemes for derivation were proposed
|
||||
in BIP43 and other documents, such as BIPs 44,45,49,84. The flexibility of the format also allowed
|
||||
industry participants to implement custom derivation shemes that fit particular purposes,
|
||||
industry participants to implement custom derivation schemes that fit particular purposes,
|
||||
but not necessarily useful in general.
|
||||
|
||||
Even when existing BIPs for derivation schemes are used, their usage is not uniform across
|
||||
@ -41,18 +41,18 @@ addresses differently than the one they used before.
|
||||
The problem is common enough to warrant the creation of a dedicated website
|
||||
([https://walletsrecovery.org/ walletsrecovery.org]) that tracks paths used by different wallets.
|
||||
|
||||
At the time of writing, this website has used their own format to succintly describe multiple
|
||||
derivation paths. As far as author knows, it was the only publicitly used format to describe
|
||||
At the time of writing, this website has used their own format to succinctly describe multiple
|
||||
derivation paths. As far as author knows, it was the only publicly used format to describe
|
||||
path templates before introduction of this BIP. The format was not specified anywhere beside
|
||||
the main page of the website. It used <code>|</code> to denote alternative derivation indexes
|
||||
(example: <code>m/|44'|49'|84'/0'/0'</code>) or whole alternative paths (<code>m/44'/0'/0'|m/44'/1'/0'</code>).
|
||||
|
||||
It was not declared as a template format to use for processing by software, and seems to be
|
||||
an ad-hoc format only intended for illustration. In contrast to this ad-hoc format, the format
|
||||
described in this BIP is intended for unambigouos parsing by software, and to be easily read by humans
|
||||
described in this BIP is intended for unambiguous parsing by software, and to be easily read by humans
|
||||
at the same time. Humans can visually detect the 'templated' parts of the path more easily than the use
|
||||
of <code>|</code> in the template could allow. Wider range of paths can be defined in a single template more
|
||||
succintly and unambiguously.
|
||||
succinctly and unambiguously.
|
||||
|
||||
===Intended use and advantages===
|
||||
|
||||
@ -71,7 +71,7 @@ into using well-known paths, or convince other vendors to support their custom p
|
||||
scales poorly.
|
||||
|
||||
A flexible approach proposed in this document is to define a standard notation for "BIP32 path templates"
|
||||
that succintly describes the constraints to impose on the derivation path.
|
||||
that succinctly describes the constraints to impose on the derivation path.
|
||||
|
||||
Wide support for these path templates will increase interoperability and flexibility of solutions,
|
||||
and will allow vendors and individual developers to easily define their own custom restrictions.
|
||||
@ -89,7 +89,7 @@ installation of malicious or incorrect profiles, though.
|
||||
|
||||
==Specification==
|
||||
|
||||
The format for the template was choosen to make it easy to read, convenient and visually unambigous.
|
||||
The format for the template was chosen to make it easy to read, convenient and visually unambiguous.
|
||||
|
||||
Template starts with optional prefix <code>m/</code>, and then one or more sections delimited by the slash character (<code>/</code>).
|
||||
|
||||
@ -127,13 +127,13 @@ Constraints:
|
||||
# To avoid ambiguity, an index range that matches a single value MUST be specified as Unit range.
|
||||
# To avoid ambiguity, an index range <code>0-2147483647</code> is not allowed, and MUST be specified as Wildcard index template instead
|
||||
# For Non-unit range, range_end MUST be larger than range_start.
|
||||
# If there is more than one index range within the Ranged index template, range_start of the second and any subsequent range MUST be larger than the range_end of the preceeding range.
|
||||
# If there is more than one index range within the Ranged index template, range_start of the second and any subsequent range MUST be larger than the range_end of the preceding range.
|
||||
# To avoid ambiguity, all representations of integer values larger than 0 MUST NOT start with character <code>0</code> (no leading zeroes allowed).
|
||||
# If hardened marker appears within any section in the path template, all preceding sections MUST also specify hardened matching.
|
||||
# To avoid ambiguity, if a hardened marker appears within any section in the path template, all preceding sections MUST also use the same hardened marker (either <code>h</code> or <code>'</code>).
|
||||
# To avoid ambiguity, trailing slashes (for example, <code>1/2/</code>) and duplicate slashes (for example, <code>0//1</code>) MUST NOT appear in the template.
|
||||
|
||||
It may be desireable to have fully unambiguous encoding, where for each valid path template string, there is no other valid template string that matches the exact same set of paths. This would enable someone to compare templates for equality through a simple string equality check, without any parsing.
|
||||
It may be desirable to have fully unambiguous encoding, where for each valid path template string, there is no other valid template string that matches the exact same set of paths. This would enable someone to compare templates for equality through a simple string equality check, without any parsing.
|
||||
|
||||
To achieve this, two extra rules are needed:
|
||||
|
||||
|
@ -82,7 +82,7 @@ https://github.com/bitcoin/bitcoin/pull/8391.
|
||||
|
||||
==References==
|
||||
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki BIP34 Block v2, Height in Coinbase]
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki BIP34 Block v2, Height in Coinbase]
|
||||
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki BIP66 Strict DER signatures]
|
||||
|
||||
|
599
bip-0093.mediawiki
Normal file
599
bip-0093.mediawiki
Normal file
@ -0,0 +1,599 @@
|
||||
<pre>
|
||||
BIP: 93
|
||||
Layer: Applications
|
||||
Title: codex32: Checksummed SSSS-aware BIP32 seeds
|
||||
Author: Leon Olsson Curr and Pearlwort Sneed <pearlwort@wpsoftware.net>
|
||||
Andrew Poelstra <andrew.poelstra@gmail.com>
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0093
|
||||
Status: Draft
|
||||
Type: Informational
|
||||
Created: 2023-02-13
|
||||
License: BSD-3-Clause
|
||||
Post-History: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-February/021469.html
|
||||
</pre>
|
||||
|
||||
==Introduction==
|
||||
|
||||
===Abstract===
|
||||
|
||||
This document describes a standard for backing up and restoring the master seed of a
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki BIP-0032] hierarchical deterministic wallet, using Shamir's secret sharing.
|
||||
It includes an encoding format, a BCH error-correcting checksum, and algorithms for share generation and secret recovery.
|
||||
Secret data can be split into up to 31 shares.
|
||||
A minimum threshold of shares, which can be between 1 and 9, is needed to recover the secret, whereas without sufficient shares, no information about the secret is recoverable.
|
||||
|
||||
===Copyright===
|
||||
|
||||
This document is licensed under the 3-clause BSD license.
|
||||
|
||||
===Motivation===
|
||||
|
||||
BIP-0032 master seed data is the source entropy used to derive all private keys in an HD wallet.
|
||||
Safely storing this secret data is the hardest and most important part of self-custody.
|
||||
However, there is a tension between security, which demands limiting the number of backups, and resilience, which demands widely replicated backups.
|
||||
Encrypting the seed does not change this fundamental tradeoff, since it leaves essentially the same problem of how to back up the encryption key(s).
|
||||
|
||||
To allow users freedom to make this tradeoff, we use Shamir's secret sharing, which guarantees that any number of shares less than the threshold leaks no information about the secret.
|
||||
This approach allows increasing safety by widely distributing the generated shares, while also providing security against the compromise of one or more shares (as long as fewer than the threshold have been compromised).
|
||||
|
||||
[https://github.com/satoshilabs/slips/blob/master/slip-0039.md SLIP-0039] has essentially the same motivations as this standard.
|
||||
However, unlike SLIP-0039,
|
||||
|
||||
* this standard aims to be simple enough for hand computation
|
||||
* we use the bech32 alphabet rather than a word list, resulting in fixed-length compact encodings
|
||||
* we do not support multi-level secret sharing (splitting of shares), although it is technically possible and may be added in a future BIP
|
||||
* because of the need to support hand computation, we '''do not''' support passphrases or key hardening
|
||||
|
||||
Users who demand a higher level of security for particular secrets, or have a general distrust in digital electronic devices, have the option of using hand computation to backup and restore secret data in an interoperable manner.
|
||||
In particular, all computations can be done with simple lookup tables.
|
||||
'''It is therefore possible to compute and verify checksums, and to split and recover seeds, entirely using pen and paper.'''
|
||||
For long-lived rarely-used seeds, the ability to hand-verify checksums has a significant benefit even for users who do not care to do any other part of this process by hand.
|
||||
It means that they can verify the integrity (against non-malicious tampering) of their shares regularly, say, on an annual basis, without needing to continually expose secret data to new hardware.
|
||||
|
||||
The ability to compute properties by hand comes from our choice of a small field and our use of linear error correcting codes.
|
||||
It does not come with any reduction in security, as long as users use high-quality randomness.
|
||||
Note that hand computation is optional, the particular details of hand computation are outside the scope of this standard, and implementers do not need to be concerned with this possibility.
|
||||
|
||||
[https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki BIP-0039] serves the same purpose as this standard: encoding master seeds for storage by users.
|
||||
However, BIP-0039 has no error-correcting ability, cannot sensibly be extended to support secret sharing, has no support for versioning or other metadata, and has many technical design decisions that make implementation and interoperability difficult (for example, the use of SHA-512 to derive seeds, or the use of 11-bit words).
|
||||
|
||||
==Specification==
|
||||
|
||||
===codex32===
|
||||
|
||||
A codex32 string is similar to a bech32 string defined in [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki BIP-0173].
|
||||
It reuses the base-32 character set from BIP-0173, and consists of:
|
||||
|
||||
* A human-readable part, which is the string "ms" (or "MS").
|
||||
* A separator, which is always "1".
|
||||
* A data part which is in turn subdivided into:
|
||||
** A threshold parameter, which MUST be a single digit between "2" and "9", or the digit "0".
|
||||
*** If the threshold parameter is "0" then the share index, defined below, MUST have a value of "s" (or "S").
|
||||
** An identifier consisting of 4 bech32 characters.
|
||||
** A share index, which is any bech32 character. Note that a share index value of "s" (or "S") is special and denotes the unshared secret (see section "Unshared Secret").
|
||||
** A payload which is a sequence of up to 74 bech32 characters. (However, see '''Long codex32 Strings''' below for an exception to this limit.)
|
||||
** A checksum which consists of 13 bech32 characters as described below.
|
||||
|
||||
As with bech32 strings, a codex32 string MUST be entirely uppercase or entirely lowercase.
|
||||
For presentation, lowercase is usually preferable, but uppercase SHOULD be used for handwritten codex32 strings.
|
||||
If a codex32 string is encoded in a QR code, it SHOULD use the uppercase form, as this is encoded more compactly.
|
||||
|
||||
===Checksum===
|
||||
|
||||
The last thirteen characters of the data part form a checksum and contain no information.
|
||||
Valid strings MUST pass the criteria for validity specified by the Python 3 code snippet below.
|
||||
The function <code>ms32_verify_checksum</code> must return true when its argument is the data part as a list of integers representing the characters converted using the bech32 character table from BIP-0173.
|
||||
|
||||
To construct a valid checksum given the data-part characters (excluding the checksum), the <code>ms32_create_checksum</code> function can be used.
|
||||
|
||||
<source lang="python">
|
||||
MS32_CONST = 0x10ce0795c2fd1e62a
|
||||
|
||||
def ms32_polymod(values):
|
||||
GEN = [
|
||||
0x19dc500ce73fde210,
|
||||
0x1bfae00def77fe529,
|
||||
0x1fbd920fffe7bee52,
|
||||
0x1739640bdeee3fdad,
|
||||
0x07729a039cfc75f5a,
|
||||
]
|
||||
residue = 0x23181b3
|
||||
for v in values:
|
||||
b = (residue >> 60)
|
||||
residue = (residue & 0x0fffffffffffffff) << 5 ^ v
|
||||
for i in range(5):
|
||||
residue ^= GEN[i] if ((b >> i) & 1) else 0
|
||||
return residue
|
||||
|
||||
def ms32_verify_checksum(data):
|
||||
if len(data) >= 96: # See Long codex32 Strings
|
||||
return ms32_verify_long_checksum(data)
|
||||
if len(data) <= 93:
|
||||
return ms32_polymod(data) == MS32_CONST
|
||||
return False
|
||||
|
||||
def ms32_create_checksum(data):
|
||||
if len(data) > 80: # See Long codex32 Strings
|
||||
return ms32_create_long_checksum(data)
|
||||
values = data
|
||||
polymod = ms32_polymod(values + [0] * 13) ^ MS32_CONST
|
||||
return [(polymod >> 5 * (12 - i)) & 31 for i in range(13)]
|
||||
</source>
|
||||
|
||||
===Error Correction===
|
||||
|
||||
A codex32 string without a valid checksum MUST NOT be used.
|
||||
The checksum is designed to be an error correcting code that can correct up to 4 character substitutions, up to 8 unreadable characters (called erasures), or up to 13 consecutive erasures.
|
||||
Implementations SHOULD provide the user with a corrected valid codex32 string if possible.
|
||||
However, implementations SHOULD NOT automatically proceed with a corrected codex32 string without user confirmation of the corrected string, either by prompting the user, or returning a corrected string in an error message and allowing the user to repeat their action.
|
||||
We do not specify how an implementation should implement error correction. However, we recommend that:
|
||||
|
||||
* Implementations make suggestions to substitute non-bech32 characters with bech32 characters in some situations, such as replacing "B" with "8", "O" with "0", "I" with "l", etc.
|
||||
* Implementations interpret "?" as an erasure.
|
||||
* Implementations optionally interpret other non-bech32 characters, or characters with incorrect case, as erasures.
|
||||
* If a string with 8 or fewer erasures can have those erasures filled in to make a valid codex32 string, then the implementation suggests such a string as a correction.
|
||||
* If a string consisting of valid bech32 characters in the proper case can be made valid by substituting 4 or fewer characters, then the implementation suggests such a string as a correction.
|
||||
|
||||
===Unshared Secret===
|
||||
|
||||
When the share index of a valid codex32 string (converted to lowercase) is the letter "s", we call the string a codex32 secret.
|
||||
The payload in a codex32 secret is a direct encoding of a BIP-0032 HD master seed.
|
||||
|
||||
The master seed is decoded by converting the payload to bytes:
|
||||
|
||||
* Translate the characters to 5 bits values using the bech32 character table from BIP-0173, most significant bit first.
|
||||
* Re-arrange those bits into groups of 8 bits. Any incomplete group at the end MUST be 4 bits or less, and is discarded.
|
||||
|
||||
Note that unlike the decoding process in BIP-0173, we do NOT require that the incomplete group be all zeros.
|
||||
|
||||
For an unshared secret, the threshold parameter (the first character of the data part) is ignored (beyond the fact it must be a digit for the codex32 string to be valid).
|
||||
We recommend using the digit "0" for the threshold parameter in this case.
|
||||
The 4 character identifier also has no effect beyond aiding users in distinguishing between multiple different master seeds in cases where they have more than one.
|
||||
|
||||
===Recovering Master Seed===
|
||||
|
||||
When the share index of a valid codex32 string (converted to lowercase) is not the letter "s", we call the string an codex32 share.
|
||||
The first character of the data part indicates the threshold of the share, and it is required to be a non-"0" digit.
|
||||
|
||||
In order to recover a master seed, one needs a set of valid codex32 shares such that:
|
||||
|
||||
* All shares have the same threshold value, the same identifier, and the same length.
|
||||
* All of the share index values are distinct.
|
||||
* The number of codex32 shares is exactly equal to the (common) threshold value.
|
||||
|
||||
If all the above conditions are satisfied, the <code>ms32_recover</code> function will return a codex32 secret when its argument is the list of codex32 shares with each share represented as a list of integers representing the characters converted using the bech32 character table from BIP-0173.
|
||||
|
||||
<source lang="python">
|
||||
bech32_inv = [
|
||||
0, 1, 20, 24, 10, 8, 12, 29, 5, 11, 4, 9, 6, 28, 26, 31,
|
||||
22, 18, 17, 23, 2, 25, 16, 19, 3, 21, 14, 30, 13, 7, 27, 15,
|
||||
]
|
||||
|
||||
def bech32_mul(a, b):
|
||||
res = 0
|
||||
for i in range(5):
|
||||
res ^= a if ((b >> i) & 1) else 0
|
||||
a *= 2
|
||||
a ^= 41 if (32 <= a) else 0
|
||||
return res
|
||||
|
||||
def bech32_lagrange(l, x):
|
||||
n = 1
|
||||
c = []
|
||||
for i in l:
|
||||
n = bech32_mul(n, i ^ x)
|
||||
m = 1
|
||||
for j in l:
|
||||
m = bech32_mul(m, (x if i == j else i) ^ j)
|
||||
c.append(m)
|
||||
return [bech32_mul(n, bech32_inv[i]) for i in c]
|
||||
|
||||
def ms32_interpolate(l, x):
|
||||
w = bech32_lagrange([s[5] for s in l], x)
|
||||
res = []
|
||||
for i in range(len(l[0])):
|
||||
n = 0
|
||||
for j in range(len(l)):
|
||||
n ^= bech32_mul(w[j], l[j][i])
|
||||
res.append(n)
|
||||
return res
|
||||
|
||||
def ms32_recover(l):
|
||||
return ms32_interpolate(l, 16)
|
||||
</source>
|
||||
|
||||
===Generating Shares===
|
||||
|
||||
If we already have ''t'' valid codex32 strings such that:
|
||||
|
||||
* All strings have the same threshold value ''t'', the same identifier, and the same length
|
||||
* All of the share index values are distinct
|
||||
|
||||
Then we can derive additional shares with the <code>ms32_interpolate</code> function by passing it a list of exactly ''t'' of these codex32 strings, together with a fresh share index distinct from all of the existing share indexes.
|
||||
The newly derived share will have the provided share index.
|
||||
|
||||
Once a user has generated ''n'' codex32 shares, they may discard the codex32 secret (if it exists).
|
||||
The ''n'' shares form a ''t'' of ''n'' Shamir's secret sharing scheme of a codex32 secret.
|
||||
|
||||
There are two ways to create an initial set of ''t'' valid codex32 strings, depending on whether the user already has an existing master seed to split.
|
||||
|
||||
====For a fresh master seed====
|
||||
|
||||
In the case that the user wishes to generate a fresh master seed, the user generates random initial shares, as follows:
|
||||
|
||||
# Choose a bitsize, between 128 and 512, which must be a multiple of 8.
|
||||
# Choose a threshold value ''t'' between 2 and 9, inclusive
|
||||
# Choose a 4 bech32 character identifier
|
||||
#* We do not define how to choose the identifier, beyond noting that it SHOULD be distinct for every master seed the user may need to disambiguate.
|
||||
# ''t'' many times, generate a random share by:
|
||||
## Take the next available letter from the bech32 alphabet, in alphabetical order, as <code>a</code>, <code>c</code>, <code>d</code>, ..., to be the share index
|
||||
## Set the first nine characters to be the prefix <code>ms1</code>, the threshold value ''t'', the 4-character identifier, and then the share index
|
||||
## Choose the next ceil(''bitlength / 5'') characters uniformly at random
|
||||
## Generate a valid checksum in accordance with the Checksum section, and append this to the resulting shares
|
||||
|
||||
The result will be ''t'' distinct shares, all with the same initial 8 characters, and a distinct share index as the 9th character.
|
||||
|
||||
With this set of ''t'' codex32 shares, new shares can be derived as discussed above. This process generates a fresh master seed, whose value can be retrieved by running the recovery process on any ''t'' of these shares.
|
||||
|
||||
====For an existing master seed====
|
||||
|
||||
Before generating shares for an existing master seed, it first must be converted into a codex32 secret, as described above.
|
||||
The conversion process consists of:
|
||||
|
||||
# Choose a threshold value ''t'' between 2 and 9, inclusive
|
||||
# Choose a 4 bech32 character identifier
|
||||
#* We do not define how to choose the identifier, beyond noting that it SHOULD be distinct for every master seed the user may need to disambiguate.
|
||||
# Set the share index to <code>s</code>
|
||||
# Set the payload to a bech32 encoding of the master seed, padded with arbitrary bits
|
||||
# Generating a valid checksum in accordance with the Checksum section
|
||||
|
||||
Along with the codex32 secret, the user must generate ''t''-1 other codex32 shares, each with the same threshold value, the same identifier, and a distinct share index.
|
||||
These shares should be generated as described in the "fresh master seed" section.
|
||||
|
||||
The codex32 secret and the ''t''-1 codex32 shares form a set of ''t'' valid codex32 strings from which additional shares can be derived as described above.
|
||||
|
||||
===Long codex32 Strings===
|
||||
|
||||
The 13 character checksum design only supports up to 80 data characters.
|
||||
Excluding the threshold, identifier and index characters, this limits the payload to 74 characters or 46 bytes.
|
||||
While this is enough to support the 32-byte advised size of BIP-0032 master seeds, BIP-0032 allows seeds to be up to 64 bytes in size.
|
||||
We define a long codex32 string format to support these longer seeds by defining an alternative checksum.
|
||||
|
||||
<source lang="python">
|
||||
MS32_LONG_CONST = 0x43381e570bf4798ab26
|
||||
|
||||
def ms32_long_polymod(values):
|
||||
GEN = [
|
||||
0x3d59d273535ea62d897,
|
||||
0x7a9becb6361c6c51507,
|
||||
0x543f9b7e6c38d8a2a0e,
|
||||
0x0c577eaeccf1990d13c,
|
||||
0x1887f74f8dc71b10651,
|
||||
]
|
||||
residue = 0x23181b3
|
||||
for v in values:
|
||||
b = (residue >> 70)
|
||||
residue = (residue & 0x3fffffffffffffffff) << 5 ^ v
|
||||
for i in range(5):
|
||||
residue ^= GEN[i] if ((b >> i) & 1) else 0
|
||||
return residue
|
||||
|
||||
def ms32_verify_long_checksum(data):
|
||||
return ms32_long_polymod(data) == MS32_LONG_CONST
|
||||
|
||||
def ms32_create_long_checksum(data):
|
||||
values = data
|
||||
polymod = ms32_long_polymod(values + [0] * 15) ^ MS32_LONG_CONST
|
||||
return [(polymod >> 5 * (14 - i)) & 31 for i in range(15)]
|
||||
</source>
|
||||
|
||||
A long codex32 string follows the same specification as a regular codex32 string with the following changes.
|
||||
|
||||
* The payload is a sequence of between 75 and 103 bech32 characters.
|
||||
* The checksum consists of 15 bech32 characters as defined above.
|
||||
|
||||
A codex32 string with a data part of 94 or 95 characters is never legal as a regular codex32 string is limited to 93 data characters and a long codex32 string is at least 96 characters.
|
||||
|
||||
Generation of long shares and recovery of the master seed from long shares proceeds in exactly the same way as for regular shares with the <code>ms32_interpolate</code> function.
|
||||
|
||||
The long checksum is designed to be an error correcting code that can correct up to 4 character substitutions, up to 8 unreadable characters (called erasures), or up to 15 consecutive erasures.
|
||||
As with regular checksums we do not specify how an implementation should implement error correction, and all our recommendations for error correction of regular codex32 strings also apply to long codex32 strings.
|
||||
|
||||
==Rationale==
|
||||
|
||||
This scheme is based on the observation that the Lagrange interpolation of valid codewords in a BCH code will always be a valid codeword.
|
||||
This means that derived shares will always have valid checksum, and a sufficient threshold of shares with valid checksums will derive a secret with a valid checksum.
|
||||
|
||||
The header system is also compatible with Lagrange interpolation, meaning all derived shares will have the same identifier and will have the appropriate share index.
|
||||
This fact allows the header data to be covered by the checksum.
|
||||
|
||||
The checksum size and identifier size have been chosen so that the encoding of 128-bit seeds and shares fit within 48 characters.
|
||||
This is a standard size for many common seed storage formats, which has been popularized by the 12 four-letter word format of the BIP-0039 mnemonic.
|
||||
|
||||
The 13 character checksum is adequate to correct 4 errors in up to 93 characters (80 characters of data and 13 characters of the checksum).
|
||||
We can correct up to 8 erasures (errors with known locations), and up to 13 consecutive errors (burst errors).
|
||||
Beyond that, our code is guaranteed to detect up to 8 errors.
|
||||
More generally, any number of random errors will be detected with overwhelming (1 - 2^65) probability. However, the checksum does not protect against maliciously constructed errors.
|
||||
These parameters are slightly better than those of the checksum used in SLIP-0039.
|
||||
|
||||
For 256-bit seeds and shares our strings are 74 characters, which fits into the 96 character format of the 24 four-letter word format of the BIP-0039 mnemonic, with plenty of room to spare.
|
||||
|
||||
A longer checksum is needed to support up to 512-bit seeds, the longest seed length specified in BIP-0032, as the 13 character checksum isn't adequate for more than 80 data characters.
|
||||
While we could use the 15 character checksum for both cases, we prefer to keep the strings as short as possible for the more common cases of 128-bit and 256-bit master seeds.
|
||||
We only guarantee to correct 4 characters no matter how long the string is.
|
||||
Longer strings mean more chances for transcription errors, so shorter strings are better.
|
||||
|
||||
The longest data part using the regular 13 character checksum is 93 characters and corresponds to a 400-bit secret.
|
||||
At this length, the prefix <code>MS1</code> is not covered by the checksum.
|
||||
This is acceptable because the checksum scheme itself requires you to know that the <code>MS1</code> prefix is being used in the first place.
|
||||
If the prefix is damaged and a user is guessing that the data might be using this scheme, then the user can enter the available data explicitly using the suspected <code>MS1</code> prefix.
|
||||
|
||||
===Not BIP-0039 Entropy===
|
||||
|
||||
Instead of encoding a BIP-0032 master seed, an alternative would be to encode BIP-0039 entropy.
|
||||
However this alternative approach is fraught with difficulties.
|
||||
|
||||
On approach would be to encode the BIP-0039 entropy along with the BIP-0039 checksum data.
|
||||
This data can directly be recovered from the BIP-0039 mnemonic, and the process can be reversed if one knows the target language.
|
||||
However, for a 128-bit seed, there is a 4 bit checksum yielding 132 bits of data that needs to be encoded.
|
||||
This exceeds the 130-bits of room that we have for storing 128 bit seeds.
|
||||
We would have to compromise on the 48 character size, or the size of the headers, or the size of the checksum in order to add room for an additional character of data.
|
||||
|
||||
This approach would also eliminate our short cut generation of a fresh master secret from generating random shares.
|
||||
One would be required to first generate BIP-0039 entropy, and then add a BIP-0039 checksum, before adding a Codex32 checksum and then generate other shares.
|
||||
In particular, this process could no longer be performed by hand since it is effectively impossible to hand compute a BIP-0039 checksum.
|
||||
|
||||
An alternative approach is to discard the BIP-0039 checksum, since it is inadequate for error correction anyways, and rely on the Codex32 checksum.
|
||||
However, this approach ends up eliminating the benefits of BIP-0039 compatibility.
|
||||
While it is now possible to hand generate fresh shares, it is impossible to recover compatible BIP-0039 words by hand because, again, the BIP-0039 checksum is not hand computable.
|
||||
The only way of generating the compatible BIP-0039 mnemonic is to use wallet software.
|
||||
But if the wallet software is need to support this approach to decoding entropy, we may as well bypass all of the overhead of BIP-0039 and directly encode the entropy of a BIP-0032 master seed, which is what we do in our Codex32 proposal.
|
||||
|
||||
Beyond the problems above, BIP-0039 does not define a single transformation from entropy to BIP-0032 master seed.
|
||||
Instead every different language has it own word list (or word lists) and each choice of word list yields a different transformation from entropy to master seed.
|
||||
We would need to encode the choice of word list in our share's meta-data, which takes up even more room, and is difficult to specify due to the ever-evolving choice of word lists.
|
||||
|
||||
Alternatively we could standardize on the choice of the English word list, something that is nearly a de facto standard, and simply be incompatible with BIP-0039 wallets of other languages.
|
||||
Such a choice also risks users of BIP-0039 recovering their entropy from their language, encoding it in Codex32 and then failing to recover their wallet because the English word lists has replaced their language's word list.
|
||||
|
||||
The main advantage of this alternative approach would be that wallets could give users an option switch between backing up their entropy as a BIP-0039 mnemonic and in Codex32 format, but again, only if their language choice happens to be the English word list.
|
||||
In practice, we do not expect users in switch back and forth between backup formats, and instead just generate a fresh master seed using Codex32.
|
||||
|
||||
Seeing little value with BIP-0039 compatibility (English-only), all the difficulties with BIP-0039 language choice, not to mention the PBKDF2 overhead of using BIP-0039, we think it is best to abandon BIP-0039 and encode BIP-0032 master seeds directly.
|
||||
Our approach is semi-convertible with BIP-0039's 512-bit master seeds (in all languages, see Backwards Compatibility) and fully interconvertible with SLIP-39 encoded master seeds or any other encoding of BIP-0032 master seeds.
|
||||
|
||||
==Backwards Compatibility==
|
||||
|
||||
codex32 is an alternative to BIP-0039 and SLIP-0039.
|
||||
It is technically possible to derive the BIP32 master seed from seed words encoded in one of these schemes, and then to encode this seed in codex32.
|
||||
For BIP-0039 this process is irreversible, since it involves hashing the original words.
|
||||
Furthermore, the resulting seed will be 512 bits long, which may be too large to be safely and conveniently handled.
|
||||
|
||||
SLIP-0039 seed words can be reversibly converted to master seeds, so it is possible to interconvert between SLIP-0039 and codex32.
|
||||
However, SLIP-0039 '''shares''' cannot be converted to codex32 shares because the two schemes use a different underlying field.
|
||||
|
||||
The authors of this BIP do not recommend interconversion.
|
||||
Instead, users who wish to switch to codex32 should generate a fresh seed and sweep their coins.
|
||||
|
||||
==Reference Implementation==
|
||||
|
||||
Our [https://github.com/BlockstreamResearch/codex32 reference implementation repository] contains implementations in Rust and PostScript.
|
||||
The inline code in this BIP text can be used as a Python reference.
|
||||
|
||||
==Test Vectors==
|
||||
|
||||
===Test vector 1===
|
||||
|
||||
This example shows the codex32 format, when used without splitting the secret into any shares.
|
||||
The payload contains 26 bech32 characters, which corresponds to 130 bits. We truncate the last two bits in order to obtain a 128-bit master seed.
|
||||
|
||||
codex32 secret (bech32): <code>ms10testsxxxxxxxxxxxxxxxxxxxxxxxxxx4nzvca9cmczlw</code>
|
||||
|
||||
Master secret (hex): <code>318c6318c6318c6318c6318c6318c631</code>
|
||||
|
||||
* human-readable part: <code>ms</code>
|
||||
* separator: <code>1</code>
|
||||
* k value: <code>0</code> (no secret splitting)
|
||||
* identifier: <code>test</code>
|
||||
* share index: <code>s</code> (the secret)
|
||||
* payload: <code>xxxxxxxxxxxxxxxxxxxxxxxxxx</code>
|
||||
* checksum: <code>4nzvca9cmczlw</code>
|
||||
* master node xprv: <code>xprv9s21ZrQH143K3taPNekMd9oV5K6szJ8ND7vVh6fxicRUMDcChr3bFFzuxY8qP3xFFBL6DWc2uEYCfBFZ2nFWbAqKPhtCLRjgv78EZJDEfpL</code>
|
||||
|
||||
===Test vector 2===
|
||||
|
||||
This example shows generating a new master seed using "random" codex32 shares, as well as deriving an additional codex32 share, using ''k''=2 and an identifier of <code>NAME</code>.
|
||||
Although codex32 strings are canonically all lowercase, it's also valid to use all uppercase.
|
||||
|
||||
Share with index <code>A</code>: <code>MS12NAMEA320ZYXWVUTSRQPNMLKJHGFEDCAXRPP870HKKQRM</code>
|
||||
|
||||
Share with index <code>C</code>: <code>MS12NAMECACDEFGHJKLMNPQRSTUVWXYZ023FTR2GDZMPY6PN</code>
|
||||
|
||||
* Derived share with index <code>D</code>: <code>MS12NAMEDLL4F8JLH4E5VDVULDLFXU2JHDNLSM97XVENRXEG</code>
|
||||
* Secret share with index <code>S</code>: <code>MS12NAMES6XQGUZTTXKEQNJSJZV4JV3NZ5K3KWGSPHUH6EVW</code>
|
||||
* Master secret (hex): <code>d1808e096b35b209ca12132b264662a5</code>
|
||||
* master node xprv: <code>xprv9s21ZrQH143K2NkobdHxXeyFDqE44nJYvzLFtsriatJNWMNKznGoGgW5UMTL4fyWtajnMYb5gEc2CgaKhmsKeskoi9eTimpRv2N11THhPTU</code>
|
||||
|
||||
Note that per BIP-0173, the lowercase form is used when determining a character's value for checksum purposes.
|
||||
In particular, given an all uppercase codex32 string, we still use lowercase <code>ms</code> as the human-readable part during checksum construction.
|
||||
|
||||
===Test vector 3===
|
||||
|
||||
This example shows splitting an existing 128-bit master seed into "random" codex32 shares, using ''k''=3 and an identifier of <code>cash</code>.
|
||||
We appended two zero bits in order to obtain 26 bech32 characters (130 bits of data) from the 128-bit master seed.
|
||||
|
||||
Master secret (hex): <code>ffeeddccbbaa99887766554433221100</code>
|
||||
|
||||
Secret share with index <code>s</code>: <code>ms13cashsllhdmn9m42vcsamx24zrxgs3qqjzqud4m0d6nln</code>
|
||||
|
||||
Share with index <code>a</code>: <code>ms13casha320zyxwvutsrqpnmlkjhgfedca2a8d0zehn8a0t</code>
|
||||
|
||||
Share with index <code>c</code>: <code>ms13cashcacdefghjklmnpqrstuvwxyz023949xq35my48dr</code>
|
||||
|
||||
* Derived share with index <code>d</code>: <code>ms13cashd0wsedstcdcts64cd7wvy4m90lm28w4ffupqs7rm</code>
|
||||
* Derived share with index <code>e</code>: <code>ms13casheekgpemxzshcrmqhaydlp6yhms3ws7320xyxsar9</code>
|
||||
* Derived share with index <code>f</code>: <code>ms13cashf8jh6sdrkpyrsp5ut94pj8ktehhw2hfvyrj48704</code>
|
||||
* master node xprv: <code>xprv9s21ZrQH143K266qUcrDyYJrSG7KA3A7sE5UHndYRkFzsPQ6xwUhEGK1rNuyyA57Vkc1Ma6a8boVqcKqGNximmAe9L65WsYNcNitKRPnABd</code>
|
||||
|
||||
Any three of the five shares among <code>acdef</code> can be used to recover the secret.
|
||||
|
||||
Note that the choice to append two zero bits was arbitrary, and any of the following four secret shares would have been valid choices.
|
||||
However, each choice would have resulted in a different set of derived shares.
|
||||
|
||||
* <code>ms13cashsllhdmn9m42vcsamx24zrxgs3qqjzqud4m0d6nln</code>
|
||||
* <code>ms13cashsllhdmn9m42vcsamx24zrxgs3qpte35dvzkjpt0r</code>
|
||||
* <code>ms13cashsllhdmn9m42vcsamx24zrxgs3qzfatvdwq5692k6</code>
|
||||
* <code>ms13cashsllhdmn9m42vcsamx24zrxgs3qrsx6ydhed97jx2</code>
|
||||
|
||||
===Test vector 4===
|
||||
|
||||
This example shows converting a 256-bit secret into a codex32 secret, without splitting the secret into any shares.
|
||||
We appended four zero bits in order to obtain 52 bech32 characters (260 bits of data) from the 256-bit secret.
|
||||
|
||||
256-bit secret (hex): <code>ffeeddccbbaa99887766554433221100ffeeddccbbaa99887766554433221100</code>
|
||||
|
||||
* codex32 secret: <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqqtum9pgv99ycma</code>
|
||||
* master node xprv: <code>xprv9s21ZrQH143K3s41UCWxXTsU4TRrhkpD1t21QJETan3hjo8DP5LFdFcB5eaFtV8x6Y9aZotQyP8KByUjgLTbXCUjfu2iosTbMv98g8EQoqr</code>
|
||||
|
||||
Note that the choice to append four zero bits was arbitrary, and any of the following sixteen codex32 secrets would have been valid:
|
||||
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqqtum9pgv99ycma</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqpj82dp34u6lqtd</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqzsrs4pnh7jmpj5</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqrfcpap2w8dqezy</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqy5tdvphn6znrf0</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyq9dsuypw2ragmel</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqx05xupvgp4v6qx</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyq8k0h5p43c2hzsk</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqgum7hplmjtr8ks</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqf9q0lpxzt5clxq</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyq28y48pyqfuu7le</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqt7ly0paesr8x0f</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqvrvg7pqydv5uyz</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqd6hekpea5n0y5j</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyqwcnrwpmlkmt9dt</code>
|
||||
* <code>ms10leetsllhdmn9m42vcsamx24zrxgs3qrl7ahwvhw4fnzrhve25gvezzyq0pgjxpzx0ysaam</code>
|
||||
|
||||
===Test vector 5===
|
||||
|
||||
This example shows generating a new 512-bit master seed using "random" codex32 characters and appending a checksum.
|
||||
The payload contains 103 bech32 characters, which corresponds to 515 bits. The last three bits are discarded when converting to a 512-bit master seed.
|
||||
|
||||
This is an example of a '''Long codex32 String'''.
|
||||
|
||||
* Secret share with index <code>S</code>: <code>MS100C8VSM32ZXFGUHPCHTLUPZRY9X8GF2TVDW0S3JN54KHCE6MUA7LQPZYGSFJD6AN074RXVCEMLH8WU3TK925ACDEFGHJKLMNPQRSTUVWXY06FHPV80UNDVARHRAK</code>
|
||||
* Master secret (hex): <code>dc5423251cb87175ff8110c8531d0952d8d73e1194e95b5f19d6f9df7c01111104c9baecdfea8cccc677fb9ddc8aec5553b86e528bcadfdcc201c17c638c47e9</code>
|
||||
* master node xprv: <code>xprv9s21ZrQH143K4UYT4rP3TZVKKbmRVmfRqTx9mG2xCy2JYipZbkLV8rwvBXsUbEv9KQiUD7oED1Wyi9evZzUn2rqK9skRgPkNaAzyw3YrpJN</code>
|
||||
|
||||
===Invalid test vectors===
|
||||
|
||||
These examples have incorrect checksums.
|
||||
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxve740yyge2ghq</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxve740yyge2ghp</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxlk3yepcstwr</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxx6pgnv7jnpcsp</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxx0cpvr7n4geq</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxm5252y7d3lr</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxrd9sukzl05ej</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxc55srw5jrm0</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxgc7rwhtudwc</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxx4gy22afwghvs</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxe8yfm0</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxvm597d</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxme084q0vpht7pe0</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxme084q0vpht7pew</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxqyadsp3nywm8a</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxzvg7ar4hgaejk</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcznau0advgxqe</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxch3jrc6j5040j</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx52gxl6ppv40mcv</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx7g4g2nhhle8fk</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx63m45uj8ss4x8</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy4r708q7kg65x</code>
|
||||
|
||||
These examples use the wrong checksum for their given data sizes.
|
||||
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxurfvwmdcmymdufv</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxcsyppjkd8lz4hx3</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxu6hwvl5p0l9xf3c</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwqey9rfs6smenxa</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxv70wkzrjr4ntqet</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3hmlrmpa4zl0v</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrfggf88znkaup</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpt7l4aycv9qzj</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxus27z9xtyxyw3</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxcwm4re8fs78vn</code>
|
||||
|
||||
These examples have improper lengths.
|
||||
They are either too short, too long, or would decode to byte sequence with an incomplete group greater than 4 bits.
|
||||
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxw0a4c70rfefn4</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxk4pavy5n46nea</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxx9lrwar5zwng4w</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxr335l5tv88js3</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxvu7q9nz8p7dj68v</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpq6k542scdxndq3</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxkmfw6jm270mz6ej</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxzhddxw99w7xws</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxxx42cux6um92rz</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxxxxarja5kqukdhy9</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxky0ua3ha84qk8</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9eheesxadh2n2n9</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9llwmgesfulcj2z</code>
|
||||
* <code>ms12fauxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx02ev7caq6n9fgkf</code>
|
||||
|
||||
This example uses a "0" threshold with a non-"s" index
|
||||
|
||||
* <code>ms10fauxxxxxxxxxxxxxxxxxxxxxxxxxxxx0z26tfn0ulw3p</code>
|
||||
|
||||
This example has a threshold that is not a digit.
|
||||
|
||||
* <code>ms1fauxxxxxxxxxxxxxxxxxxxxxxxxxxxxxda3kr3s0s2swg</code>
|
||||
|
||||
These examples do not begin with the required "ms" or "MS" prefix and/or are missing the "1" separator.
|
||||
|
||||
* <code>0fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>ms0fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>m10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>s10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>0fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxhkd4f70m8lgws</code>
|
||||
* <code>10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxhkd4f70m8lgws</code>
|
||||
* <code>m10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxx8t28z74x8hs4l</code>
|
||||
* <code>s10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxh9d0fhnvfyx3x</code>
|
||||
|
||||
These examples all incorrectly mix upper and lower case characters.
|
||||
|
||||
* <code>Ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>mS10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>MS10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>ms10FAUXsxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>ms10fauxSxxxxxxxxxxxxxxxxxxxxxxxxxxuqxkk05lyf3x2</code>
|
||||
* <code>ms10fauxsXXXXXXXXXXXXXXXXXXXXXXXXXXuqxkk05lyf3x2</code>
|
||||
* <code>ms10fauxsxxxxxxxxxxxxxxxxxxxxxxxxxxUQXKK05LYF3X2</code>
|
||||
|
||||
==Appendix==
|
||||
|
||||
===Mathematical Companion===
|
||||
|
||||
Below we use the bech32 character set to denote values in GF[32].
|
||||
In bech32, the letter <code>Q</code> denotes zero and the letter <code>P</code> denotes one.
|
||||
The digits <code>0</code> and <code>2</code> through <code>9</code> do ''not'' denote their numeric values.
|
||||
They are simply elements of GF[32].
|
||||
|
||||
The generating polynomial for our BCH code is as follows.
|
||||
|
||||
We extend GF[32] to GF[1024] by adjoining a primitive cube root of unity, <code>ζ</code>, satisfying <code>ζ^2 = ζ + P</code>.
|
||||
|
||||
We select <code>β := G ζ</code> which has order 93, and construct the product <code>(x - β^i)</code> for <code>i</code> in <code>{17, 20, 46, 49, 52, 77, 78, 79, 80, 81, 82, 83, 84}</code>.
|
||||
The resulting polynomial is our generating polynomial for our 13 character checksum:
|
||||
|
||||
x^13 + E x^12 + M x^11 + 3 x^10 + G x^9 + Q x^8 + E x^7 + E x^6 + E x^5 + L x^4 + M x^3 + C x^2 + S x + S
|
||||
|
||||
For our long checksum, we select <code>γ := E + X ζ</code>, which has order 1023, and construct the product <code>(x - γ^i)</code> for <code>i</code> in <code>{32, 64, 96, 895, 927, 959, 991, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026}</code>.
|
||||
The resulting polynomial is our generating polynomial for our 15 character checksum for long strings:
|
||||
|
||||
x^15 + 0 x^14 + 2 x^13 + E x^12 + 6 x^11 + F x^10 + E x^9 + 4 x^8 + X x^7 + H x^6 + 4 x^5 + X x^4 + 9 x^3 + K x^2 + Y x^1 + H
|
||||
|
||||
(Reminder: the character <code>0</code> does ''not'' denote the zero of the field.)
|
120
bip-0094.mediawiki
Normal file
120
bip-0094.mediawiki
Normal file
@ -0,0 +1,120 @@
|
||||
<pre>
|
||||
BIP: 94
|
||||
Layer: Applications
|
||||
Title: Testnet 4
|
||||
Author: Fabian Jahr <fjahr@protonmail.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0094
|
||||
Status: Draft
|
||||
Type: Standards Track
|
||||
Created: 2024-05-27
|
||||
License: CC0-1.0
|
||||
Post-History: https://gnusha.org/pi/bitcoindev/CADL_X_eXjbRFROuJU0b336vPVy5Q2RJvhcx64NSNPH-3fDCUfw@mail.gmail.com/
|
||||
https://gnusha.org/pi/bitcoindev/a6e3VPsXJf9p3gt_FmNF_Up-wrFuNMKTN30-xCSDHBKXzXnSpVflIZIj2NQ8Wos4PhQCzI2mWEMvIms_FAEs7rQdL15MpC_Phmu_fnR9iTg=@protonmail.com/
|
||||
https://github.com/bitcoin/bitcoin/pull/29775
|
||||
</pre>
|
||||
|
||||
== Abstract ==
|
||||
|
||||
A new test network with the goal to replace Testnet 3. This network comes with small but important improvements of the consensus rules, that should make it impractical to attack the network using only CPU mining.
|
||||
|
||||
== Motivation ==
|
||||
|
||||
Quoting the original mailing list post from Jameson Lopp<ref>https://gnusha.org/pi/bitcoindev/CADL_X_eXjbRFROuJU0b336vPVy5Q2RJvhcx64NSNPH-3fDCUfw@mail.gmail.com/</ref>:
|
||||
|
||||
<blockquote><poem>
|
||||
Testnet3 has been running for 13 years. It's on block 2.5 million something and the block reward is down to ~0.014 TBTC, so mining is not doing a great job at distributing testnet coins anymore.
|
||||
|
||||
The reason the block height is insanely high is due to a rather amusing edge case bug that causes the difficulty to regularly get reset to 1, which causes a bit of havoc. If you want a deep dive into the quirk: https://blog.lopp.net/the-block-storms-of-bitcoins-testnet/
|
||||
|
||||
Testnet3 is being actively used for scammy airdrops; those of us who tend to be generous with our testnet coins are getting hounded by non-developers chasing cheap gains.
|
||||
|
||||
As a result, TBTC is being actively bought and sold; one could argue that the fundamental principle of testnet coins having no value has been broken.
|
||||
</poem></blockquote>
|
||||
|
||||
Since then the issue with block storms has been further demonstrated on Testnet 3 when three years' worth of blocks were mined in a few weeks while rendering the network practically unusable at the same time.
|
||||
|
||||
== Specification ==
|
||||
|
||||
Consensus of Testnet 4 follows the same rules as mainnet with the exception of the three rules detailed below. Additionally all soft forks that are active on mainnet as of May 2024 are enforced from genesis.
|
||||
|
||||
=== 20-minute Exception ===
|
||||
|
||||
This rule was already previously implemented and active in Testnet 3<ref>https://github.com/bitcoin/bitcoin/pull/686</ref>.
|
||||
|
||||
A block with a timestamp that is more than 20 minutes past the timestamp of the previous block must have a minimum difficulty of 1 (the network's minimum difficulty) instead of whatever the actual difficulty level currently is. This applies to all blocks in a difficulty period except for the first block. This means the blocks must change their <code>nBits</code> field from the actual difficulty level to the minimum difficulty value <code>0x1d00ffff</code>.
|
||||
|
||||
This rule also led to the block storms<ref>https://blog.lopp.net/the-block-storms-of-bitcoins-testnet/</ref> which the following rule seeks to fix.
|
||||
|
||||
=== Block Storm Fix ===
|
||||
|
||||
The work required for a new difficulty period is calculated as multiplication factor to the difficulty of the previous period (but no less than 1/4th and no more than 4x), depending on the duration of the previous difficulty period. On Mainnet and Testnet 3, this factor is applied to the difficulty value of the last block.
|
||||
|
||||
Block storms happen organically whenever the 20-minute exception is applied to a difficulty period’s last block, causing the block to be mined at a difficulty of 1. The difficulty adjustment rules then limit the subsequent period’s difficulty to a value between 1 (the minimum) and 4. Blocks will be generated rapidly in the subsequent low-difficulty periods while the difficulty climbs back to an adequate range. An arbitrarily large number of blocks can be generated quickly by repeatedly using the 20-minute exception on every last block of difficulty periods. The block storm is then bounded only by miner hash rate, the need for last blocks to have a timestamp 20 minutes after the second to last block, the Median-Time-Past nTime rule, and the requirement that blocks can't be more than 2 hours in the future. Overall a sustained attack would eventually be limited to a maximum cadence of six blocks per second.
|
||||
|
||||
A block storm does not require a time warp attack, but one can be used to amplify<ref>A perpetual block storm attack with entire difficulty periods being authored in less than 3.5 days that resets the difficulty to the minimum in the last block of every difficulty period would adjust to a new actual difficulty of 4 every period. An attacker that additionally leverages a time warp attack would start their attack by holding back timestamps until the latest block’s timestamp is at least two weeks in the past, and then limiting their block rate to six blocks per second, incrementing the timestamp on every sixth block. Only on the last block they would use the current time, which both resets the difficulty to one per the 20-minute exception and would result in a difficulty adjustment keeping the difficulty at the minimum due to the elapsed time exceeding the target. This would allow lower the difficulty for all blocks to difficulty 1 instead of difficulty 4</ref> it.
|
||||
|
||||
The mitigation consists of no longer applying the adjustment factor to the last block of the previous difficulty period. Instead, the first block of the difficulty period is used as the base.
|
||||
|
||||
The first block must contain the actual difficulty of the network and can therefore be used as the base for the calculation of the new difficulty level. Note that the first block in new difficulty period does not allow usage of the 20-minute exception (this is prior behavior). This means that in each difficulty period the first block should always have the actual difficulty even if all other blocks were mined with the 20-minute exception.
|
||||
|
||||
=== Time Warp Fix ===
|
||||
|
||||
In addition to a time warp attack potentially exacerbating the perpetual block storm attack, a time warp attack provides an alternative way to increase the block production rate even if the unintended reset of the actual difficulty due to the 20-minute exception was mitigated.
|
||||
|
||||
To protect against the time warp attack, the following rule proposed as part of The Great Consensus Cleanup<ref>https://github.com/TheBlueMatt/bips/blob/cleanup-softfork/bip-XXXX.mediawiki</ref> is enforced: "The nTime field of each block whose height, mod 2016, is 0 must be greater than or equal to the nTime field of the immediately prior block minus 600. For the avoidance of doubt, such blocks must still comply with existing Median-Time-Past nTime restrictions."
|
||||
|
||||
== Rationale ==
|
||||
|
||||
The applied changes were the result of discussions on the mailing list and the PR. The selected changes try to strike a balance between minimal changes to the network (keeping it as close to mainnet as possible) while making it more robust against attackers that try to disrupt the network. Several alternative designs were considered:
|
||||
|
||||
* For the block storm fix an alternative fix could have been to prevent the last block in a difficulty period from applying the existing difficulty exception. Both solutions were deemed acceptable and there was no clear preference among reviewers.
|
||||
* Removal of the 20-minute exception was discussed but dismissed since several reviewers insisted that it was a useful feature allowing non-standard transactions to be mined with just a CPU. The 20-minute exception also allows CPU users to move the chain forward (except on the first block that needs to be mined at actual difficulty) in case a large amount of hash power suddenly leaves the network. This would allow the chain to recover to a normal difficulty level faster if left stranded at high difficulty.
|
||||
* Increase of minimum difficulty was discussed but dismissed as it would categorically prevent participation in the network using a CPU miner (utilizing the 20-minute exception).
|
||||
* Increase of the delay in the 20-minute exception was suggested but did not receive significant support.
|
||||
* Re-enabling <code>acceptnonstdtxn</code> in bitcoin core by default was dismissed as it had led to confusion among layer-2s that had used testnet for transaction propagation tests and expected it to behave similar to mainnet.
|
||||
* Motivating miners to re-org min difficulty blocks was suggested, but was considered out of scope for this BIP, since adoption of such a mining policy remains available after Testnet 4 is deployed. As 20-minute exception blocks only contribute work corresponding to difficulty one to the chaintip, and actual difficulty blocks should have a difficulty magnitudes higher, a block mined at actual difficulty could easily replace even multiple 20-minute exception blocks.
|
||||
* Persisting the real difficulty in the version field was suggested to robustly prevent exploits of the 20-minute exception while allowing it to be used on any block, but did not receive a sufficient level of support to justify the more invasive change.
|
||||
|
||||
One known downside of the chosen approach is that if the difficulty is gradually raised by a miner with significant hash rate, and this miner disappears, then each difficulty adjustment period requires one block at the actual difficulty.
|
||||
|
||||
This would cause the network to stall once per difficulty adjustment period until the real difficulty is adjusted downwards enough for the remaining hash rate to find this block in reasonable time.
|
||||
|
||||
== Network Parameters ==
|
||||
|
||||
=== Consensus Rules ===
|
||||
|
||||
All consensus rules active on mainnet at the time of this proposal are enforced from block 1, the newest of these rules being the Taproot softfork.
|
||||
|
||||
=== Genesis Block ===
|
||||
|
||||
* Message: <code>03/May/2024 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e</code>
|
||||
* Pubkey: <code>000000000000000000000000000000000000000000000000000000000000000000</code>
|
||||
* Time stamp: 1714777860
|
||||
* Nonce: 393743547
|
||||
* Difficulty: <code>0x1d00ffff</code>
|
||||
* Version: 1
|
||||
|
||||
The resulting genesis block hash is <code>00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043</code>, and the block hex is <code>0100000000000000000000000000000000000000000000000000000000000000000000004e7b2b9128fe0291db0693af2ae418b767e657cd407e80cb1434221eaea7a07a046f3566ffff001dbb0c78170101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff5504ffff001d01044c4c30332f4d61792f323032342030303030303030303030303030303030303030303165626435386332343439373062336161396437383362623030313031316662653865613865393865303065ffffffff0100f2052a010000002321000000000000000000000000000000000000000000000000000000000000000000ac00000000</code>.
|
||||
|
||||
=== Message Start ===
|
||||
|
||||
The message start is defined as <code>0x1c163f28</code>. These four bytes were randomly generated and have no special meaning.
|
||||
|
||||
== Backwards Compatibility ==
|
||||
|
||||
The rules used by Testnet 4 are backwards compatible to the rules of Testnet 3. Existing software that implements support for Testnet 3 would only require addition of the network parameters (magic number, genesis block, etc.) to be able to follow Testnet 4.
|
||||
|
||||
However, implementations that only implement Testnet 3’s rules would accept a chain that violates Testnet 4’s rules and are therefore susceptible to being forked off. It is recommended that any implementations check blocks in regard to all the new rules of Testnet 4 and reject blocks that fail to comply.
|
||||
|
||||
== Reference implementation ==
|
||||
|
||||
Pull request at https://github.com/bitcoin/bitcoin/pull/29775
|
||||
|
||||
== References ==
|
||||
|
||||
<references/>
|
||||
|
||||
== Copyright ==
|
||||
|
||||
This document is licensed under the Creative Commons CC0 1.0 Universal license.
|
@ -63,7 +63,7 @@ Nodes with single children are not allowed.
|
||||
|
||||
The ''double-SHA256'' cryptographic hash function takes an arbitrary-length data as input and produces a 32-byte hash by running the data through the SHA-256 hash function as specified in FIPS 180-4[3], and then running the same hash function again on the 32-byte result, as a protection against length-extension attacks.
|
||||
|
||||
The ''fast-SHA256'' cryptographic hash function takes two 32-byte hash values, concatenates these to produce a 64-byte buffer, and applies a single run of the SHA-256 hash function with a custom 'initialization vector' (IV) and without message paddding.
|
||||
The ''fast-SHA256'' cryptographic hash function takes two 32-byte hash values, concatenates these to produce a 64-byte buffer, and applies a single run of the SHA-256 hash function with a custom 'initialization vector' (IV) and without message padding.
|
||||
The result is a 32-byte 'midstate' which is the combined hash value and the label of the inner node.
|
||||
The changed IV protects against path-length extension attacks (grinding to interpret a hash as both an inner node and a leaf).
|
||||
fast-SHA256 is only defined for two 32-byte inputs.
|
||||
@ -241,16 +241,16 @@ Disallowing a node with two SKIP branches eliminates what would otherwise be a s
|
||||
|
||||
The number of hashing operations required to verify a proof is one less than the number of hashes (SKIP and VERIFY combined),
|
||||
and is exactly equal to the number of inner nodes serialized as the beginning of the proof as N.
|
||||
The variable-length integer encoding has the property that serialized integers, sorted lexigraphically, will also be sorted numerically.
|
||||
Since the first serialized item is the number of inner nodes, sorting proofs lexigraphically has the effect of sorting the proofs by the amount of work required to verify.
|
||||
The variable-length integer encoding has the property that serialized integers, sorted lexicographically, will also be sorted numerically.
|
||||
Since the first serialized item is the number of inner nodes, sorting proofs lexicographically has the effect of sorting the proofs by the amount of work required to verify.
|
||||
|
||||
The number of hashes required as input for verification of a proof is N+1 minus the number of SKIP hashes,
|
||||
and can be quickly calculated without parsing the tree structure.
|
||||
|
||||
The coding and packing rules for the serialized tree structure were also chosen to make lexigraphical comparison useful (or at least not meaningless).
|
||||
The coding and packing rules for the serialized tree structure were also chosen to make lexicographical comparison useful (or at least not meaningless).
|
||||
If we consider a fully-expanded tree (no SKIP hashes, all VERIFY) to be encoding a list of elements in the order traversed depth-first from left-to-right,
|
||||
then we can extract proofs for subsets of the list by SKIP'ing the hashes of missing values and recursively pruning any resulting SKIP,SKIP nodes.
|
||||
Lexigraphically comparing the resulting serialized tree structures is the same as lexigraphically comparing lists of indices from the original list verified by the derived proof.
|
||||
Lexicographically comparing the resulting serialized tree structures is the same as lexicographically comparing lists of indices from the original list verified by the derived proof.
|
||||
|
||||
Because the number of inner nodes and the number of SKIP hashes is extractible from the tree structure,
|
||||
both variable-length integers in the proof are redundant and could have been omitted.
|
||||
|
@ -23,7 +23,7 @@ not always well-understood, and the best upgrade mechanisms to the
|
||||
consensus validation rules may vary depending on the type of change being deployed.
|
||||
Discussing such changes without a uniform view on the deployment
|
||||
paths often leads to misunderstandings and unnecessarily delays the
|
||||
deployment of changes.
|
||||
deployment of changes.
|
||||
|
||||
==Definitions==
|
||||
|
||||
@ -43,7 +43,7 @@ deployment of changes.
|
||||
: a theoretical piece of software that contains the specifications that define the validity of a block for a given state and chain parameters (ie it may act differently on, for example, regtest).
|
||||
|
||||
;Libbitcoinconsensus
|
||||
: the existing implementation is a library that is compiled by default with Bitcoin Core master and exposes a single C function named bitcoinconsensus_verify_script(). Although it has a deterministic build and implements the most complex rules (most of the cryptography, which is itself heavily based on libsecp256k1 after #REPLACE_libsecp256k1_PR), it is still not a complete specification of the consensus rules. Since libconsensus doesn't manage the current state but only the validation of the next block given that state, it is known that this long effort of encapsulation and decoupling will eventually finish, and that the person who moves the last line
|
||||
: the existing implementation is a library that is compiled by default with Bitcoin Core master and exposes a single C function named bitcoinconsensus_verify_script(). Although it has a deterministic build and implements the most complex rules (most of the cryptography, which is itself heavily based on libsecp256k1 after #REPLACE_libsecp256k1_PR), it is still not a complete specification of the consensus rules. Since libconsensus doesn't manage the current state but only the validation of the next block given that state, it is known that this long effort of encapsulation and decoupling will eventually finish, and that the person who moves the last line
|
||||
|
||||
==Taxonomy of consensus forks==
|
||||
|
||||
@ -56,7 +56,7 @@ development, diversity, etc) to fork the Bitcoin Core software and it's good
|
||||
that there's many alternative implementations of the protocol (forks
|
||||
of Bitcoin Core or written from scratch).
|
||||
|
||||
But sometimes a bug in the reimplementaion of the consensus
|
||||
But sometimes a bug in the reimplementation of the consensus
|
||||
validation rules can prevent users of alternative implementation from
|
||||
following the longest (most work) valid chain. This can result in
|
||||
those users losing coins or being defrauded, making reimplementations
|
||||
@ -76,14 +76,14 @@ without burdening them with specific design choices made by Bitcoin
|
||||
Core. It is to be noted that sharing the same code for consensus
|
||||
validation doesn't prevent alternative implementations from
|
||||
independently changing their consensus rules: they can always fork
|
||||
the libbitcoinconsensus project (once it is in a separate repository).
|
||||
the libbitcoinconsensus project (once it is in a separate repository).
|
||||
|
||||
Hopefully libbitcoinconsensus will remove this type of consensus fork
|
||||
which - being accidental - obviously doesn't need a deployment plan.
|
||||
|
||||
====11/12 March 2013 Chain Fork====
|
||||
|
||||
There is a precedent of an accidental consensus fork at height 225430.
|
||||
There is a precedent of an accidental consensus fork at height 225430.
|
||||
Without entering into much detail (see [2]), the situation was different from
|
||||
what's being described from the alternative implementation risks (today alternative implementation
|
||||
still usually rely in different degrees on Bitcoin Core trusted proxies, which
|
||||
@ -104,7 +104,7 @@ rapidly by the whole worldwide community and nobody is unhappy about
|
||||
the solution.
|
||||
|
||||
But there's some philosophical disagreements on the terms of what the
|
||||
solution was: we can add a pedantic note on that.
|
||||
solution was: we can add a pedantic note on that.
|
||||
If "the implementation is the specification", then those
|
||||
levelDB-specific limitations were part of the consensus rules.
|
||||
Then additional rules were necessary and any alternative
|
||||
@ -113,7 +113,7 @@ planned consensus fork to migrate all Bitcoin-qt 0.7- users could
|
||||
remove those additional consensus restrictions.
|
||||
Had libconsensus being implemented without depending on levelDB,
|
||||
those additional restrictions wouldn't have been part of "the specification"
|
||||
and this would just have been a bug in the
|
||||
and this would just have been a bug in the
|
||||
consensus rules, just a consensus-critical bug in a set of
|
||||
implementations, concretely all satoshi-bitcoin-0.7-or-less (which
|
||||
happened to be a huge super majority of the users), but other
|
||||
@ -126,7 +126,7 @@ another consensus fork to remove them. Two theoretical consensus forks
|
||||
instead of one but the first one deployed practically for free. The
|
||||
practical result would have been identical and only the definitions
|
||||
change. This means discussing something that went uncontroversially
|
||||
well further is "philosophical bike-shed" (TM).
|
||||
well further is "philosophical bike-shed" (TM).
|
||||
|
||||
===Unilateral softforks===
|
||||
|
||||
@ -157,17 +157,17 @@ that this must always be the case.
|
||||
While 2 chains cohexist, they can be considered two different
|
||||
currencies.
|
||||
We could say that bitcoin becomes bitcoinA and bitcoinB. The implications for market
|
||||
capitalization are completely unpredictable,
|
||||
capitalization are completely unpredictable,
|
||||
|
||||
maybe mc(bitcoinA) = mc(bitcoinB) = mc(old_bitcoin),
|
||||
maybe mc(bitcoinA) = mc(bitcoinB) = mc(old_bitcoin),
|
||||
|
||||
maybe mc(bitcoinA) + mc(bitcoinB) = mc(old_bitcoin),
|
||||
maybe mc(bitcoinA) + mc(bitcoinB) = mc(old_bitcoin),
|
||||
|
||||
maybe mc(bitcoinA) + mc(bitcoinB) = 1000 * mc(old_bitcoin),
|
||||
|
||||
maybe mc(bitcoinA) + mc(bitcoinB) = 0,
|
||||
|
||||
...
|
||||
...
|
||||
|
||||
Schism hardforks have been compared to one type of altcoins called
|
||||
"spinoffs"[spinoffs] that distribute all or part of its initial seigniorage to
|
||||
@ -224,7 +224,7 @@ Let's imagine BIP66 had a crypto backdoor
|
||||
that nobody noticed and allows an evil developer cabal to steal
|
||||
everyone's coins. The users and non-evil developers could join, fork
|
||||
libconsensus and use the forked version in their respective bitcoin
|
||||
implementations.
|
||||
implementations.
|
||||
Should miner's "vote" be required to express their consent? What if some miners
|
||||
are part of the cabal? In the unlikely event that most miners are
|
||||
part of such an evil cabal, changing the pow function may be
|
||||
@ -268,7 +268,7 @@ that's why the voting mechanism and first used for BIP30 and BIP66.
|
||||
The current voting threshold for softfork enforcement is 95%. There's
|
||||
also a 75% threshold for miners to activate it as a policy rule, but
|
||||
it should be safe for miners to activate such a policy from the start
|
||||
or later than 75%, as long as they enforce it as consensus rule after 95%.
|
||||
or later than 75%, as long as they enforce it as consensus rule after 95%.
|
||||
|
||||
The current miners' voting mechanism can be modified to allow for
|
||||
changes to be deployed in parallel, the rejection of a concrete
|
||||
@ -355,12 +355,12 @@ worth of blocks).
|
||||
[5] Original references:
|
||||
https://bitcointalk.org/index.php?topic=114751.0
|
||||
https://bitcointalk.org/index.php?topic=43692.msg521772#msg521772
|
||||
Rebased patch:
|
||||
Rebased patch:
|
||||
https://github.com/freicoin/freicoin/commit/beb2fa54745180d755949470466cbffd1cd6ff14
|
||||
|
||||
==Attribution==
|
||||
|
||||
Incorporated corrections and suggestions from: Andy Chase, Bryan Bishop,
|
||||
Incorporated corrections and suggestions from: Andy Chase, Bryan Bishop,
|
||||
Btcdrak, Gavin Andresen, Gregory Sanders, Luke Dashjr, Marco Falke.
|
||||
|
||||
==Copyright==
|
||||
|
@ -65,7 +65,7 @@ A hardcoded increase to max block size (2MB, 8MB, etc.), rejected because:
|
||||
Allow miners to vote for max block size, rejected because:
|
||||
* overly complex and political
|
||||
* human involvement makes this slow to respond to changing transaction volumes
|
||||
* focuses power over max block size to a relatively small group of people
|
||||
* focuses power over max block size to a relatively small group of people
|
||||
* unpredictable transaction fees caused by this would create uncertainty in the ecosystem
|
||||
|
||||
==Backward Compatibility==
|
||||
|
@ -13,21 +13,21 @@
|
||||
|
||||
==Abstract==
|
||||
|
||||
A method of altering the maximum allowed block size of the Bitcoin protocol
|
||||
A method of altering the maximum allowed block size of the Bitcoin protocol
|
||||
using a consensus based approach.
|
||||
|
||||
==Motivation==
|
||||
|
||||
There is a belief that Bitcoin cannot easily respond to raising the
|
||||
blocksize limit if popularity was to suddenly increase due to a mass adoption
|
||||
curve, because co-ordinating a hard fork takes considerable time, and being
|
||||
unable to respond in a timely manner would irreparably harm the credibility of
|
||||
There is a belief that Bitcoin cannot easily respond to raising the
|
||||
blocksize limit if popularity was to suddenly increase due to a mass adoption
|
||||
curve, because co-ordinating a hard fork takes considerable time, and being
|
||||
unable to respond in a timely manner would irreparably harm the credibility of
|
||||
bitcoin.
|
||||
|
||||
Additionally, predetermined block size increases are problematic because they
|
||||
attempt to predict the future, and if too large could have unintended
|
||||
consequences like damaging the possibility for a fee market to develop
|
||||
as block subsidy decreases substantially over the next 9 years; introducing
|
||||
attempt to predict the future, and if too large could have unintended
|
||||
consequences like damaging the possibility for a fee market to develop
|
||||
as block subsidy decreases substantially over the next 9 years; introducing
|
||||
or exacerbating mining attack vectors; or somehow affect the network in unknown
|
||||
or unpredicted ways. Since fixed changes are hard to deploy, the damage could be
|
||||
extensive.
|
||||
@ -36,14 +36,14 @@ Dynamic block size adjustments also suffer from the potential to be gamed by the
|
||||
larger hash power.
|
||||
|
||||
Free voting as suggested by BIP100 allows miners to sell their votes out of band
|
||||
at no risk, and enable the sponsor the ability to manipulate the blocksize.
|
||||
at no risk, and enable the sponsor the ability to manipulate the blocksize.
|
||||
It also provides a cost free method or the larger pools to vote in ways to
|
||||
manipulate the blocksize such to disadvantage or attack smaller pools.
|
||||
|
||||
|
||||
==Rationale==
|
||||
|
||||
By introducing a cost to increase the block size ensures the mining community
|
||||
By introducing a cost to increase the block size ensures the mining community
|
||||
will collude to increase it only when there is a clear necessity, and reduce it
|
||||
when it is unnecessary. Larger miners cannot force their wishes so easily
|
||||
because not only will they have to pay extra a difficulty target, then can be
|
||||
@ -63,7 +63,7 @@ honest.
|
||||
The initial block size limit shall be 1MB.
|
||||
|
||||
Each time a miner creates a block, they may vote to increase or decrease the
|
||||
blocksize by a maximum of 10% of the current block size limit. These votes will
|
||||
blocksize by a maximum of 10% of the current block size limit. These votes will
|
||||
be used to recalculate the new block size limit every 2016 blocks.
|
||||
|
||||
Votes are cast using the block's coinbase transaction scriptSig.
|
||||
@ -77,7 +77,7 @@ If a miner votes for an increase, the block hash must meet a difficulty target
|
||||
which is proportionally larger than the standard difficulty target based on the
|
||||
percentage increase they voted for.
|
||||
|
||||
Votes proposing decreasing the block size limit do not need to meet a higher
|
||||
Votes proposing decreasing the block size limit do not need to meet a higher
|
||||
difficulty target.
|
||||
|
||||
Miners can vote for no change by voting for the current block size.
|
||||
|
@ -36,13 +36,13 @@ https://blockchain.info/charts/avg-block-size?timespan=all&showDataPoints=false&
|
||||
Keep the same MaxBlockSize
|
||||
|
||||
===Proposal 2 : Depending on previous block size calculation and previous Tx fee collected by miners===
|
||||
|
||||
|
||||
TotalBlockSizeInLastButOneDifficulty = Sum of all Block size of first 2008 blocks in last 2 difficulty period
|
||||
TotalBlockSizeInLastDifficulty = Sum of all Block size of second 2008 blocks in last 2 difficulty period (This actually includes 8 blocks from last but one difficulty)
|
||||
|
||||
|
||||
TotalTxFeeInLastButOneDifficulty = Sum of all Tx fees of first 2008 blocks in last 2 difficulty period
|
||||
TotalTxFeeInLastDifficulty = Sum of all Tx fees of second 2008 blocks in last 2 difficulty period (This actually includes 8 blocks from last but one difficulty)
|
||||
|
||||
|
||||
If ( ( (Sum of first 4016 block size in last 2 difficulty period)/4016 > 50% MaxBlockSize) AND (TotalTxFeeInLastDifficulty > TotalTxFeeInLastButOneDifficulty) AND (TotalBlockSizeInLastDifficulty > TotalBlockSizeInLastButOneDifficulty) )
|
||||
MaxBlockSize = TotalBlockSizeInLastDifficulty * MaxBlockSize / TotalBlockSizeInLastButOneDifficulty
|
||||
Else If ( ( (Sum of first 4016 block size in last 2 difficulty period)/4016 < 50% MaxBlockSize) AND (TotalTxFeeInLastDifficulty < TotalTxFeeInLastButOneDifficulty) AND (TotalBlockSizeInLastDifficulty < TotalBlockSizeInLastButOneDifficulty) )
|
||||
|
@ -24,7 +24,7 @@ Over the next few years, large infrastructure investments will be made into:
|
||||
# Layer 2 services and networks for off-chain transactions
|
||||
# General efficiency improvements to transactions and the blockchain
|
||||
|
||||
* While there is a consensus between Bitcoin developers, miners, businesses and users that the block size needs to be increased, there is a lingering concern over the potential unintended consequences that may augment the trend towards network and mining centralization (largely driven by mining hardware such as ASICs) and thereby threaten the security of the network.
|
||||
* While there is a consensus between Bitcoin developers, miners, businesses and users that the block size needs to be increased, there is a lingering concern over the potential unintended consequences that may augment the trend towards network and mining centralization (largely driven by mining hardware such as ASICs) and thereby threaten the security of the network.
|
||||
* In contrast, failing to respond to elevated on-chain transaction volume may lead to a consumer-failure of Bitcoin, where ordinary users - having enjoyed over 6 years of submitting transactions on-chain at relatively low cost - will be priced out of blockchain with the emergence of a prohibitive 'fee market'.
|
||||
* These two concerns must be delicately balanced so that all users can benefit from a robust, scalable, and neutral network.
|
||||
|
||||
@ -40,7 +40,7 @@ Over the next few years, large infrastructure investments will be made into:
|
||||
* '''Phase 2'''
|
||||
** In 2020, the maximum block size will be increased dynamically according to sustained increases in transaction volume
|
||||
** Every 4032 blocks (~4 weeks), a CHECK will be performed to determine if a raise in the maximum block size should occur
|
||||
*** This calculates to a theoretical maximum of 13 increases per year
|
||||
*** This calculates to a theoretical maximum of 13 increases per year
|
||||
** IF of the last >= 3025 blocks were >=60% full, the maximum block size will be increased by 10%
|
||||
** The maximum block size can only ever be increased, not decreased
|
||||
* The default <code>limitfreerelay</code> will also be raised in proportion to maximum block size increases
|
||||
@ -49,8 +49,8 @@ Over the next few years, large infrastructure investments will be made into:
|
||||
|
||||
For example:
|
||||
* When the dynamic rules for increasing the block size go live on January 1st 2020, the starting maximum block size will be 6 MB
|
||||
* IF >=3025 blocks are >= 3.6 MB, the new maximum block size become 6.6 MB.
|
||||
* The theoretical maximum block size at the end of 2020 would be ~20.7 MB, assuming all 13 increases are triggered every 4 weeks by the end of the year.
|
||||
* IF >=3025 blocks are >= 3.6 MB, the new maximum block size become 6.6 MB.
|
||||
* The theoretical maximum block size at the end of 2020 would be ~20.7 MB, assuming all 13 increases are triggered every 4 weeks by the end of the year.
|
||||
|
||||
==Rationale==
|
||||
|
||||
@ -63,19 +63,19 @@ For example:
|
||||
*** Setting the parameter too high may set the trigger sensitivity too low, causing transaction delays that are trying to be avoided in the first place
|
||||
*** Between September 2013-2015, the standard deviation measured from average block size (n=730 data points from blockchain.info) was ~ 0.13 MB or 13% of the maximum block size
|
||||
**** If blocks needed to be 90% full before an increase were triggered, normal variance in the average block size would mean some blocks would be full before an increase could be triggered
|
||||
*** Therefore, we need a ''safe distance'' away from the maximum block size to avoid normal block size variance hitting the limit. The 60% level represents a 3 standard deviation distance from the limit.
|
||||
*** Therefore, we need a ''safe distance'' away from the maximum block size to avoid normal block size variance hitting the limit. The 60% level represents a 3 standard deviation distance from the limit.
|
||||
** Why 3025 blocks?
|
||||
*** The assessment period is 4032 blocks or ~ 4 weeks, with the threshold set as 4032 blocks/0.75 + 1
|
||||
*** Increases in the maximum block size should only occur after a sustained trend can be observed in order to:
|
||||
***# Demonstrate a market-driven secular elevation in the transaction volume
|
||||
***# Increase the cost to trigger an increase by spam attacks or miner collusion with zero fee transactions
|
||||
***# Increase the cost to trigger an increase by spam attacks or miner collusion with zero fee transactions
|
||||
*** In other words, increases to the maximum block size must be conservative but meaningful to relieve transaction volume pressure in response to true market demand
|
||||
** Why 10% increase in the block size?
|
||||
*** Increases in the block size are designed to be conservative and in balance with the number of theoretical opportunities to increase the block size per year
|
||||
*** Makes any resources spent for spam attacks or miner collusion relatively expensive to achieve a minor increase in the block size. A sustained attack would need to be launched that may be too costly, and ideally detectable by the community
|
||||
*** Makes any resources spent for spam attacks or miner collusion relatively expensive to achieve a minor increase in the block size. A sustained attack would need to be launched that may be too costly, and ideally detectable by the community
|
||||
|
||||
==Deployment==
|
||||
Similar deployment model to BIP101:
|
||||
Similar deployment model to BIP101:
|
||||
<blockquote>Activation is achieved when 750 of 1,000 consecutive blocks in the best chain have a version number with the first, second, third, and thirtieth bits set (0x20000007 in hex). The activation time will be the timestamp of the 750'th block plus a two week (1,209,600 second) grace period to give any remaining miners or services time to upgrade to support larger blocks.</blockquote>
|
||||
|
||||
==Acknowledgements==
|
||||
|
@ -37,7 +37,7 @@ In particular:
|
||||
|
||||
* The coinbase scriptSig is not counted
|
||||
* Signature operations in un-executed branches of a Script are not counted
|
||||
* OP_CHECKMULTISIG evaluations are counted accurately; if the signature for a 1-of-20 OP_CHECKMULTISIG is satisified by the public key nearest the top of the execution stack, it is counted as one signature operation. If it is satisfied by the public key nearest the bottom of the execution stack, it is counted as twenty signature operations.
|
||||
* OP_CHECKMULTISIG evaluations are counted accurately; if the signature for a 1-of-20 OP_CHECKMULTISIG is satisfied by the public key nearest the top of the execution stack, it is counted as one signature operation. If it is satisfied by the public key nearest the bottom of the execution stack, it is counted as twenty signature operations.
|
||||
* Signature operations involving invalidly encoded signatures or public keys are not counted towards the limit
|
||||
|
||||
=== Add a new limit of 1,300,000,000 bytes hashed to compute transaction signatures per block ===
|
||||
@ -65,7 +65,7 @@ SPV (simple payment validation) wallets are compatible with this change.
|
||||
|
||||
==Rationale==
|
||||
|
||||
In the short term, an increase is needed to handle increasing transaction volume.
|
||||
In the short term, an increase is needed to handle increasing transaction volume.
|
||||
|
||||
The limits on signature operations and amount of signature hashing done prevent possible CPU exhaustion attacks by "rogue miners" producing very expensive-to-validate two megabyte blocks. The signature hashing limit is chosen to be impossible to reach with any non-attack transaction or block, to minimize the impact on existing mining or wallet software.
|
||||
|
||||
|
@ -36,7 +36,7 @@ When executed, if any of the following conditions are true, the script interpret
|
||||
|
||||
Otherwise, script execution will continue as if a NOP had been executed.
|
||||
|
||||
BIP 68 prevents a non-final transaction from being selected for inclusion in a block until the corresponding input has reached the specified age, as measured in block-height or block-time. By comparing the argument to CHECKSEQUENCEVERIFY against the nSequence field, we indirectly verify a desired minimum age of the
|
||||
BIP 68 prevents a non-final transaction from being selected for inclusion in a block until the corresponding input has reached the specified age, as measured in block-height or block-time. By comparing the argument to CHECKSEQUENCEVERIFY against the nSequence field, we indirectly verify a desired minimum age of
|
||||
the output being spent; until that relative age has been reached any script execution pathway including the CHECKSEQUENCEVERIFY will fail to validate, causing the transaction not to be selected for inclusion in a block.
|
||||
|
||||
|
||||
@ -69,13 +69,13 @@ address with the following redeemscript.
|
||||
<Alice's pubkey> CHECKSIG
|
||||
ENDIF
|
||||
|
||||
At any time funds can be spent using signatures from any two of Alice,
|
||||
At any time funds can be spent using signatures from any two of Alice,
|
||||
Bob or the Escrow.
|
||||
|
||||
After 30 days Alice can sign alone.
|
||||
|
||||
The clock does not start ticking until the payment to the escrow address
|
||||
confirms.
|
||||
confirms.
|
||||
|
||||
|
||||
===Retroactive Invalidation===
|
||||
@ -230,7 +230,7 @@ The 2-way pegged sidechain requires a new REORGPROOFVERIFY opcode, the semantics
|
||||
|
||||
==Specification==
|
||||
|
||||
Refer to the reference implementation, reproduced below, for the precise
|
||||
Refer to the reference implementation, reproduced below, for the precise
|
||||
semantics and detailed rationale for those semantics.
|
||||
|
||||
<pre>
|
||||
@ -247,7 +247,7 @@ static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22);
|
||||
/* If CTxIn::nSequence encodes a relative lock-time, this mask is
|
||||
* applied to extract that lock-time from the sequence field. */
|
||||
static const uint32_t SEQUENCE_LOCKTIME_MASK = 0x0000ffff;
|
||||
|
||||
|
||||
case OP_NOP3:
|
||||
{
|
||||
if (!(flags & SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)) {
|
||||
@ -290,7 +290,7 @@ case OP_NOP3:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bool TransactionSignatureChecker::CheckSequence(const CScriptNum& nSequence) const
|
||||
{
|
||||
// Relative lock times are supported by comparing the passed
|
||||
|
@ -45,13 +45,13 @@ BIP68 (sequence numbers) and BIP112 (CHECKSEQUENCEVERIFY).
|
||||
|
||||
==Specification==
|
||||
|
||||
The values for transaction locktime remain unchanged. The difference is only in
|
||||
the calculation determining whether a transaction can be included. Instead of
|
||||
an unreliable timestamp, the following function is used to determine the current
|
||||
The values for transaction locktime remain unchanged. The difference is only in
|
||||
the calculation determining whether a transaction can be included. Instead of
|
||||
an unreliable timestamp, the following function is used to determine the current
|
||||
block time for the purpose of checking lock-time constraints:
|
||||
|
||||
enum { nMedianTimeSpan=11 };
|
||||
|
||||
|
||||
int64_t GetMedianTimePast(const CBlockIndex* pindex)
|
||||
{
|
||||
int64_t pmedian[nMedianTimeSpan];
|
||||
|
@ -111,7 +111,7 @@ The advantages of the current proposal are:
|
||||
* If different parties in a contract do not want to expose their scripts to each other, they may provide only <code>H(Subscript)</code> and keep the <code>Subscript</code> private until redemption.
|
||||
* If they are willing to share the actual scripts, they may combine them into one <code>Subscript</code> for each branch, saving some <code>nOpCount</code> and a few bytes of witness space.
|
||||
|
||||
The are some disadvantages, but only when the redemption condition is very complicated:
|
||||
There are some disadvantages, but only when the redemption condition is very complicated:
|
||||
* It may require more branches than a general MAST design (as shown in the previous example) and take more witness space in redemption
|
||||
* Creation and storage of the MAST structure may take more time and space. However, such additional costs affect only the related parties in the contract but not any other Bitcoin users.
|
||||
|
||||
|
@ -98,7 +98,7 @@ What if ParamBlockHash has leading zeros? Should this be prevented?
|
||||
|
||||
* If leading zeros are included, they should be compared to the actual block hash. (If they were truncated, fewer bytes would be compared.)
|
||||
* It is unlikely that the leading zeros will ever be necessary for sufficient precision, so the additional space is not a concern.
|
||||
* Since all block hashes are in principle shorter than than 29 bytes, ParamBlockHash may not be larger than 28 bytes.
|
||||
* Since all block hashes are in principle shorter than 29 bytes, ParamBlockHash may not be larger than 28 bytes.
|
||||
|
||||
Why is it safe to allow checking blocks as recently as the immediate previous block?
|
||||
|
||||
|
@ -59,7 +59,7 @@ This includes execution pathways or policy conditions which end up not being nee
|
||||
Not only is it inefficient to require this unnecessary information to be present on the blockchain, albeit in the witness, it also impacts privacy and fungibility as some unused script policies may be identifying.
|
||||
Using a Merkle hash tree to commit to the policy options, and then only forcing revelation of the policy used at redemption minimizes this information leakage.
|
||||
|
||||
Using Merkle hash trees to commit to policy allows for considerably more complex contracts than would would otherwise be possible, due to various built-in script size and runtime limitations.
|
||||
Using Merkle hash trees to commit to policy allows for considerably more complex contracts than would otherwise be possible, due to various built-in script size and runtime limitations.
|
||||
With Merkle commitments to policy these size and runtime limitations constrain the complexity of any one policy that can be used rather than the sum of all possible policies.
|
||||
|
||||
==Rationale==
|
||||
|
@ -61,7 +61,7 @@ references.
|
||||
==Detailed Specification==
|
||||
|
||||
The below code is the main logic for verifying CHECKTEMPLATEVERIFY, described
|
||||
in pythonic pseduocode. The canonical specification for the semantics of
|
||||
in pythonic pseudocode. The canonical specification for the semantics of
|
||||
OP_CHECKTEMPLATEVERIFY as implemented in C++ in the context of Bitcoin Core can
|
||||
be seen in the reference implementation.
|
||||
|
||||
@ -88,7 +88,7 @@ def execute_bip_119(self):
|
||||
self.context.precomputed_ctv_data = self.context.tx.get_default_check_template_precomputed_data()
|
||||
|
||||
# If the hashes do not match, return error
|
||||
if stack[-1] != self.context.tx.get_default_check_template_hash(self.context.nIn, self.context.precomputed_ctv_data)
|
||||
if stack[-1] != self.context.tx.get_default_check_template_hash(self.context.nIn, self.context.precomputed_ctv_data):
|
||||
return self.errors_with(errors.script_err_template_mismatch)
|
||||
|
||||
return self.return_as_nop()
|
||||
@ -192,7 +192,7 @@ Deployment could be done via BIP 9 VersionBits deployed through Speedy Trial.
|
||||
The Bitcoin Core reference implementation includes the below parameters,
|
||||
configured to match Speedy Trial, as that is the current activation mechanism
|
||||
implemented in Bitcoin Core. Should another method become favored by the wider
|
||||
Bitcoin comminity, that might be used instead.
|
||||
Bitcoin community, that might be used instead.
|
||||
|
||||
The start time and bit in the implementation are currently set to bit 5 and
|
||||
NEVER_ACTIVE/NO_TIMEOUT, but this is subject to change while the BIP is a draft.
|
||||
@ -225,12 +225,12 @@ A recent commit hash in that PR including tests and vectors can be found here ht
|
||||
Once the PR is merged, this BIP should be updated to point to the specific code released.
|
||||
|
||||
Test vectors are available in [/bip-0119/vectors the bip-0119/vectors
|
||||
directory] for checking compatibility with the refrence implementation and BIP.
|
||||
directory] for checking compatibility with the reference implementation and BIP.
|
||||
|
||||
==Rationale==
|
||||
|
||||
The goal of CHECKTEMPLATEVERIFY is to be minimal impact on the existing codebase -- in the
|
||||
future, as we become aware of more complex but shown to be safe use cases new template types can be added.
|
||||
future, as we become aware of more complex but shown to be safe use cases, new template types can be added.
|
||||
|
||||
Below we'll discuss the rules one-by-one:
|
||||
|
||||
@ -250,7 +250,7 @@ Were these values not committed, it would be possible to delay the spending of
|
||||
an output arbitrarily as well as possible to change the TXID.
|
||||
|
||||
Committing these values, rather than restricting them to specific values, is
|
||||
more flexible as it permits users of CHECKTEMPLATEVERIFY the set the version and
|
||||
more flexible as it permits users of CHECKTEMPLATEVERIFY to set the version and
|
||||
locktime as they please.
|
||||
|
||||
=====Committing to the ScriptSigs Hash=====
|
||||
@ -258,7 +258,7 @@ locktime as they please.
|
||||
The scriptsig in a segwit transaction must be exactly empty, unless it is a P2SH
|
||||
segwit transaction in which case it must be only the exact redeemscript. P2SH is incompatible
|
||||
(unless the P2SH hash is broken) with CHECKTEMPLATEVERIFY because the template hash must commit
|
||||
to the ScriptSig, which must contain the redeemscript, which is a hash cycle.
|
||||
to the ScriptSig, which must contain the redeemscript, which is a hash cycle.
|
||||
|
||||
To prevent malleability when not using a segwit input, we also commit to the
|
||||
scriptsig. This makes it possible to use a 2 input CHECKTEMPLATEVERIFY with a legacy pre-signed
|
||||
@ -313,7 +313,7 @@ We treat the number of inputs as a `uint32_t` because Bitcoin's consensus decodi
|
||||
to `MAX_SIZE=33554432` and that is larger than `uint16_t` and smaller than `uint32_t`. 32 bits is also
|
||||
friendly for manipulation using Bitcoin's current math opcodes, should `OP_CAT` be added. Note that
|
||||
the max inputs in a block is further restricted by the block size to around 25,000, which would fit
|
||||
into a `uint16_t`, but that is an uneccessary abstraction leak.
|
||||
into a `uint16_t`, but that is an unnecessary abstraction leak.
|
||||
|
||||
=====Committing to the Sequences Hash=====
|
||||
|
||||
@ -361,7 +361,7 @@ scripts cannot be spent at the same index, which implies that they cannot be spe
|
||||
This makes it safer to design wallet vault contracts without half-spend vulnerabilities.
|
||||
|
||||
Committing to the current index doesn't prevent one from expressing a CHECKTEMPLATEVERIFY which can
|
||||
be spent at multiple indicies. In current script, the CHECKTEMPLATEVERIFY operation can be wrapped
|
||||
be spent at multiple indices. In current script, the CHECKTEMPLATEVERIFY operation can be wrapped
|
||||
in an OP_IF for each index (or Tapscript branches in the future). If OP_CAT or OP_SHA256STREAM are
|
||||
added to Bitcoin, the index may simply be passed in by the witness before hashing.
|
||||
|
||||
@ -391,7 +391,7 @@ transaction preimages.
|
||||
=====Using Non-Tagged Hashes=====
|
||||
|
||||
The Taproot/Schnorr BIPs use Tagged Hashes
|
||||
(`SHA256(SHA256(tag)||SHA256(tag)||msg)`) to prevent taproot leafs, branches,
|
||||
(`SHA256(SHA256(tag)||SHA256(tag)||msg)`) to prevent taproot leaves, branches,
|
||||
tweaks, and signatures from overlapping in a way that might introduce a security
|
||||
[vulnerability https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-June/016091.html].
|
||||
|
||||
@ -475,7 +475,7 @@ An example of a script that could experience an DoS issue without caching is:
|
||||
|
||||
<H> CTV CTV CTV... CTV
|
||||
|
||||
Such a script would cause the intepreter to compute hashes (supposing N CTV's) over O(N*T) data.
|
||||
Such a script would cause the interpreter to compute hashes (supposing N CTV's) over O(N*T) data.
|
||||
If the scriptSigs non-nullity is not cached, then the O(T) transaction could be scanned over O(N)
|
||||
times as well (although cheaper than hashing, still a DoS). As such, CTV caches hashes and computations
|
||||
over all variable length fields in a transaction.
|
||||
@ -493,7 +493,7 @@ The preimage argument passed to CHECKTEMPLATEVERIFY may be unknown or otherwise
|
||||
However, requiring knowledge that an address is spendable from is incompatible with sender's ability
|
||||
to spend to any address (especially, OP_RETURN). If a sender needs to know the template can be spent
|
||||
from before sending, they may request a signature of an provably non-transaction challenge string
|
||||
from the leafs of the CHECKTEMPLATEVERIFY tree.
|
||||
from the leaves of the CHECKTEMPLATEVERIFY tree.
|
||||
|
||||
====Forwarding Addresses====
|
||||
|
||||
@ -503,7 +503,7 @@ For example, a exchange's hot wallet might use an address which can automaticall
|
||||
storage address after a relative timeout.
|
||||
|
||||
The issue is that reusing addresses in this way can lead to loss of funds.
|
||||
Suppose one creates an template address which forwards 1 BTC to cold storage.
|
||||
Suppose one creates a template address which forwards 1 BTC to cold storage.
|
||||
Creating an output to this address with less than 1 BTC will be frozen permanently.
|
||||
Paying more than 1 BTC will lead to the funds in excess of 1BTC to be paid as a large miner fee.
|
||||
CHECKTEMPLATEVERIFY could commit to the exact amount of bitcoin provided by the inputs/amount of fee
|
||||
@ -615,7 +615,7 @@ sponsors might be considered.
|
||||
|
||||
An opcode which verifies the exact amount that is being spent in the
|
||||
transaction, the amount paid as fees, or made available in a given output could
|
||||
be used to make safer OP_CHECKTEMPLATEVERIFY addressses. For instance, if the
|
||||
be used to make safer OP_CHECKTEMPLATEVERIFY addresses. For instance, if the
|
||||
OP_CHECKTEMPLATEVERIFY program P expects exactly S satoshis, sending S-1
|
||||
satoshis would result in a frozen UTXO and sending S+n satoshis would result in
|
||||
n satoshis being paid to fee. A range check could restrict the program to only
|
||||
|
@ -52,7 +52,7 @@ A proof of payment for a transaction T, here called PoP(T), is used to prove tha
|
||||
|
||||
OP_RETURN <version> <txid> <nonce>
|
||||
|
||||
{|
|
||||
{|
|
||||
! Field !! Size [B] !! Description
|
||||
|-
|
||||
| <version> || 2 || Version, little endian, currently 0x01 0x00
|
||||
@ -77,7 +77,7 @@ An illustration of the PoP data structure and its original payment is shown belo
|
||||
|input2 4,ffffffff | 1,pay to B |
|
||||
| | 4,pay to C |
|
||||
+------------------------------------------------+
|
||||
|
||||
|
||||
PoP(T)
|
||||
+-------------------------------------------------------------+
|
||||
| inputs | outputs |
|
||||
|
@ -43,7 +43,7 @@ Where:
|
||||
| rowspan="3" | type
|
||||
| tx
|
||||
| for transactions.
|
||||
| rowspan="3" | required
|
||||
| rowspan="3" | required
|
||||
|-
|
||||
| block
|
||||
| for blocks (supports both hash or height).
|
||||
@ -75,9 +75,9 @@ The '''chain ID''' of a chain is the block hash of the corresponding genesis blo
|
||||
|
||||
So, for example:
|
||||
<pre>
|
||||
Bitcoin main : 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
|
||||
Bitcoin main : 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
|
||||
Bitcoin test : 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
|
||||
Bitcoin regtest: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
|
||||
Bitcoin regtest: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
|
||||
</pre>
|
||||
|
||||
An example of forked chain (Feathercoin, that forked Litecoin):
|
||||
@ -87,7 +87,7 @@ An example of forked chain (Feathercoin, that forked Litecoin):
|
||||
<pre>
|
||||
Litecoin : 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2
|
||||
Feathercoin: fdbe99b90c90bae7505796461471d89ae8388ab953997aa06a355bbda8d915cb
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
|
||||
==Examples==
|
||||
|
@ -72,7 +72,7 @@ There's room at this layer to allow for competing standards without breaking bas
|
||||
|
||||
===4. Applications Layer===
|
||||
|
||||
The applications layer specifies high level structures, abstractions, and conventions that allow different applications to support similar features and share data.
|
||||
The applications layer specifies high level structures, abstractions, and conventions that allow different applications to support similar features and share data.
|
||||
|
||||
==Classification of existing BIPs==
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
Peter Todd <pete@petertodd.org>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0125
|
||||
Status: Proposed
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2015-12-04
|
||||
License: PD
|
||||
@ -151,8 +151,8 @@ of full-RBF.
|
||||
There are no known problematic interactions between opt-in full-RBF and
|
||||
other uses of nSequence. Specifically, opt-in full-RBF is compatible
|
||||
with consensus-enforced locktime as provided in the Bitcoin 0.1
|
||||
implementation, draft BIP68 (Relative lock-time using consensus-enforced
|
||||
sequence numbers), and draft BIP112 (CHECKSEQUENCEVERIFY).
|
||||
implementation, BIP68 (Relative lock-time using consensus-enforced
|
||||
sequence numbers), and BIP112 (CHECKSEQUENCEVERIFY).
|
||||
|
||||
==Deployment==
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
When a Bitcoin transaction contains inputs that reference previous transaction outputs sent to different Bitcoin addresses, personally identifiable information of the user will leak into the blockchain in an uncontrolled manner. While undesirable, these transactions are frequently unavoidable due to the natural fragmentation of wallet balances over time.
|
||||
|
||||
This document proposes a set of best practice guidelines which minimize the uncontrolled disclosure of personally identifiable information by defining standard forms for transactions containing heterogenous input scripts.
|
||||
This document proposes a set of best practice guidelines which minimize the uncontrolled disclosure of personally identifiable information by defining standard forms for transactions containing heterogeneous input scripts.
|
||||
|
||||
==Copyright==
|
||||
|
||||
@ -23,8 +23,8 @@ This BIP is in the public domain.
|
||||
==Definitions==
|
||||
|
||||
* '''Heterogenous input script transaction (HIT)''': A transaction containing multiple inputs where the scripts of the previous transaction outputs being consumed are not identical (e.g. a transaction spending outputs which were sent to more than one Bitcoin address)
|
||||
* '''Unavoidable heterogenous input script transaction''': A HIT created as a result of a user’s desire to create a new output with a value larger than the value of his wallet's largest existing unspent output
|
||||
* '''Intentional heterogenous input script transaction''': A HIT created as part of a user protection protocol for reducing uncontrolled disclosure of personally-identifying information (PII)
|
||||
* '''Unavoidable heterogeneous input script transaction''': A HIT created as a result of a user’s desire to create a new output with a value larger than the value of his wallet's largest existing unspent output
|
||||
* '''Intentional heterogeneous input script transaction''': A HIT created as part of a user protection protocol for reducing uncontrolled disclosure of personally-identifying information (PII)
|
||||
|
||||
Throughout this procedure, when input scripts are evaluated for uniqueness, "input script" should be interpreted to mean, "the script of the previous output referenced by an input to a transaction".
|
||||
|
||||
@ -33,10 +33,10 @@ Throughout this procedure, when input scripts are evaluated for uniqueness, "inp
|
||||
The recommendations in this document are designed to accomplish three goals:
|
||||
|
||||
# Maximise the effectiveness of user-protecting protocols: Users may find that protection protocols are counterproductive if such transactions have a distinctive fingerprint which renders them ineffective.
|
||||
# Minimise the adverse consequences of unavoidable heterogenous input transactions: If unavoidable HITs are indistinguishable from intentional HITs, a user creating an unavoidable HIT benefits from ambiguity with respect to graph analysis.
|
||||
# Minimise the adverse consequences of unavoidable heterogeneous input transactions: If unavoidable HITs are indistinguishable from intentional HITs, a user creating an unavoidable HIT benefits from ambiguity with respect to graph analysis.
|
||||
# Limiting the effect on UTXO set growth: To date, non-standardized intentional HITs tend to increase the network's UTXO set with each transaction; this standard attempts to minimize this effect by standardizing unavoidable and intentional HITs to limit UTXO set growth.
|
||||
|
||||
In order to achieve these goals, this specification proposes a set of best practices for heterogenous input script transaction creation. These practices accommodate all applicable requirements of both intentional and unavoidable HITs while maximising the effectiveness of both in terms of preventing uncontrolled disclosure of PII.
|
||||
In order to achieve these goals, this specification proposes a set of best practices for heterogeneous input script transaction creation. These practices accommodate all applicable requirements of both intentional and unavoidable HITs while maximising the effectiveness of both in terms of preventing uncontrolled disclosure of PII.
|
||||
|
||||
In order to achieve this, two forms of HIT are proposed: Standard form and alternate form.
|
||||
|
||||
@ -44,13 +44,13 @@ In order to achieve this, two forms of HIT are proposed: Standard form and alter
|
||||
|
||||
Applications which wish to comply both with this procedure and BIP69 should apply this procedure prior to applying BIP69.
|
||||
|
||||
==Standard form heterogenous input script transaction==
|
||||
==Standard form heterogeneous input script transaction==
|
||||
|
||||
===Rules===
|
||||
|
||||
A HIT is Standard form if it adheres to all of the following rules:
|
||||
|
||||
# The number of unique output scripts must be equal to the number of unique inputs scripts (irrespective of the number of inputs and outputs).
|
||||
# The number of unique output scripts must be equal to the number of unique input scripts (irrespective of the number of inputs and outputs).
|
||||
# All output scripts must be unique.
|
||||
# At least one pair of outputs must be of equal value.
|
||||
# The largest output in the transaction is a member of a set containing at least two identically-sized outputs.
|
||||
@ -63,7 +63,7 @@ The requirement that all output scripts are unique prevents address reuse. Restr
|
||||
|
||||
The requirement for at least one pair of outputs in an intentional HIT to be of equal value results in optimal behavior, and causes intentional HITs to resemble unavoidable HITs.
|
||||
|
||||
==Alternate form heterogenous input script transactions==
|
||||
==Alternate form heterogeneous input script transactions==
|
||||
|
||||
The formation of a standard form HIT is not possible in the following cases:
|
||||
|
||||
@ -88,7 +88,7 @@ Clients which create intentional HITs must have the capability to form alternate
|
||||
|
||||
An HIT formed via the preceding procedure will adhere to the following conditions:
|
||||
|
||||
# The number of unique inputs scripts must exceed the number of output scripts.
|
||||
# The number of unique input scripts must exceed the number of output scripts.
|
||||
# All output scripts must be unique.
|
||||
# At least one pair of outputs must be of equal value.
|
||||
## "Standard outputs" refers to the set of outputs with equal value
|
||||
@ -100,7 +100,7 @@ An HIT formed via the preceding procedure will adhere to the following condition
|
||||
## The sum of the inputs in the set minus the value of the change output is equal to the standard value with a tolerance equal to the transaction fee.
|
||||
## Change outputs with a value of zero (virtual change outputs) are permitted. The are defined for the purpose of testing whether or not a HIT adheres to this specification but are not present in the version of the transaction which is broadcast to the network.
|
||||
|
||||
==Non-compliant heterogenous input script transactions==
|
||||
==Non-compliant heterogeneous input script transactions==
|
||||
|
||||
If a user wishes to create an output that is larger than half the total size of their spendable outputs, or if their inputs are not distributed in a manner in which the alternate form procedure can be completed, then the user can not create a transaction which is compliant with this procedure.
|
||||
|
||||
|
@ -124,7 +124,7 @@ message FinalProof {
|
||||
// Bitcoin transaction.
|
||||
bytes proof_tx = 1;
|
||||
|
||||
// The metadata of the ouputs used in the proof transaction.
|
||||
// The metadata of the outputs used in the proof transaction.
|
||||
repeated OutputMeta output_metadata = 2;
|
||||
}
|
||||
|
||||
@ -219,6 +219,7 @@ A work-in-progress implementation of a tool that produces and verifies proofs
|
||||
in the described format can be found here:
|
||||
https://github.com/stevenroose/reserves
|
||||
|
||||
An implementation of the custom proof PSBTs is part of the [https://bitcoindevkit.org/ BDK], and can be found here: https://crates.io/crates/bdk-reserves
|
||||
|
||||
== Footnotes ==
|
||||
|
||||
|
@ -47,11 +47,14 @@ Concerns #4 and #5 should be handled by Signers and are out of scope of this pro
|
||||
==Specification==
|
||||
|
||||
===Prerequisites===
|
||||
This proposal assumes the parties in the multisig support [https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki BIP-0032], [https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki BIP-0322], [https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md the descriptor language] and [https://tools.ietf.org/html/rfc3686 AES encryption].
|
||||
This proposal assumes the parties in the multisig support [https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki BIP-0032], [https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki BIP-0322], [https://github.com/bitcoin/bips/blob/master/bip-0380.mediawiki BIP-0380 Output Script Descriptors] ([https://github.com/bitcoin/bips/blob/master/bip-0381.mediawiki BIP-0381],[https://github.com/bitcoin/bips/blob/master/bip-0382.mediawiki BIP-0382],[https://github.com/bitcoin/bips/blob/master/bip-0383.mediawiki BIP-0383]) and [https://tools.ietf.org/html/rfc3686 AES encryption].
|
||||
|
||||
===File Extensions===
|
||||
All descriptor and key records should have a <tt>.bsms</tt> file extension. Encrypted data should have a <tt>.dat</tt> extension.
|
||||
|
||||
===Newline===
|
||||
This specification uses line feed (LF) control character <tt>\n</tt>.
|
||||
|
||||
===Roles===
|
||||
====Coordinator====
|
||||
|
||||
@ -92,7 +95,7 @@ The Signer is any software or hardware that controls the private keys and can si
|
||||
* The Coordinator verifies that the included <tt>SIG</tt> is valid given the <tt>KEY</tt>.
|
||||
* If all key records look good, the Coordinator fills in all necessary information to generate a descriptor record.
|
||||
* The first line in the descriptor record must be the specification version (<tt>BSMS 1.0</tt> as of this writing). The second line must be a descriptor or a descriptor template. The third line must be a comma-separated list of derivation path restrictions. The paths must start with <tt>/</tt> and use non-hardened derivation. If there are no template or restrictions, it must say <tt>No path restrictions</tt>. The fourth line must be the wallet's first address. If there are path restrictions, use the first address from the first path restriction.
|
||||
* The Coordinator calculates the <tt>MAC</tt> for the record. The first 16 bytes of the <tt>MAC</tt> serves as the <tt>IV</tt> for the encryption..
|
||||
* The Coordinator calculates the <tt>MAC</tt> for the record. The first 16 bytes of the <tt>MAC</tt> serves as the <tt>IV</tt> for the encryption..
|
||||
* The Coordinator encrypts the descriptor record with the <tt>ENCRYPTION_KEY</tt> and <tt>IV</tt>.
|
||||
* The Coordinator encodes the <tt>MAC</tt> and the ciphertext into hexadecimal format, then concatenates the results: <tt>(MAC || ciphertext)</tt>.
|
||||
* The Coordinator sends the encrypted descriptor record to all participating Signers.
|
||||
@ -107,7 +110,7 @@ The Signer is any software or hardware that controls the private keys and can si
|
||||
* The Signer checks that its <tt>KEY</tt> is included in the descriptor or descriptor template, using path and fingerprint information provided. The check must perform an exact match on the <tt>KEY</tt>s and not using shortcuts such as matching fingerprints, which is trivial to spoof.
|
||||
* The Signer verifies that it is compatible with the derivation path restrictions.
|
||||
* The Signer verifies that the wallet's first address is valid.
|
||||
* For confirmation, the Signer must display to the user the wallet's first address and policy parameters, including, but not limited to: the derivation path restrictions, <tt>M</tt>, <tt>N</tt>, and the position(s) of the Signer's own <tt>KEY</tt> in the policy script. The total number of Signers, <tt>N</tt>, is important to prevent a <tt>KEY</tt> insertion attack. The position is important for scripts where <tt>KEY</tt> order matters. When applicable, all positions of the <tt>KEY</tt> must be displayed. The full descriptor or descriptor template must also be available for review upon user request.
|
||||
* For confirmation, the Signer must display to the user the wallet's first address and policy parameters, including, but not limited to: the derivation path restrictions, <tt>M</tt>, <tt>N</tt>, and the position(s) of the Signer's own <tt>KEY</tt> in the policy script. The total number of Signers, <tt>N</tt>, is important to prevent a <tt>KEY</tt> insertion attack. The position is important for scripts where <tt>KEY</tt> order matters. When applicable, all positions of the <tt>KEY</tt> must be displayed. The full descriptor or descriptor template must also be available for review upon user request.
|
||||
* Parties must check with each other that all Signers have the same confirmation (except for the <tt>KEY</tt> positions).
|
||||
* If all checks pass, the Signer must persist the descriptor record in its storage.
|
||||
|
||||
@ -123,8 +126,8 @@ We define three modes of encryption.
|
||||
# <tt>EXTENDED</tt> : the <tt>TOKEN</tt> is a 128-bit nonce.
|
||||
|
||||
The <tt>TOKEN</tt> can be converted to one of these formats:
|
||||
* A decimal number (recommended). The number must not exceed the maximum value of the nonce.
|
||||
* A mnemonic phrase using [https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki BIP-0039] word list. This would be 6 words in <tt>STANDARD</tt> mode. This encoding is not recommended in <tt>EXTENDED</tt> mode as it can result in potential confusion between seed mnemonics and <tt>TOKEN</tt> mnemonics.
|
||||
* A decimal number (recommended). The number must not exceed the maximum value of the nonce.
|
||||
* A mnemonic phrase using [https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki BIP-0039] word list. This would be 6 words in <tt>STANDARD</tt> mode. This encoding is not recommended in <tt>EXTENDED</tt> mode as it can result in potential confusion between seed mnemonics and <tt>TOKEN</tt> mnemonics.
|
||||
* A QR code.
|
||||
* Other formats.
|
||||
|
||||
@ -141,7 +144,7 @@ Whereas:
|
||||
* Password = "No SPOF"
|
||||
* Salt = <tt>TOKEN</tt>
|
||||
* c = 2048
|
||||
* dkLen = 256
|
||||
* dkLen = 256 bits (32 bytes)
|
||||
* DKey = Derived <tt>ENCRYPTION_KEY</tt>
|
||||
|
||||
====Encryption Scheme====
|
||||
@ -452,7 +455,7 @@ sh(wsh(multi(2,[793cc70b/48'/0'/0'/1']xpub6ErVmcYYHmavsMgxEcTZyzN5sqth1ZyRpFNJC2
|
||||
|
||||
==Acknowledgement==
|
||||
|
||||
Special thanks to Pavol Rusnak, Dmitry Petukhov, Christopher Allen, Craig Raw, Robert Spigler, Gregory Sanders, Ta Tat Tai, Michael Flaxman, Pieter Wuille, Salvatore Ingala, Andrew Chow and others for their feedback on the specification.
|
||||
Special thanks to Pavol Rusnak, Dmitry Petukhov, Christopher Allen, Craig Raw, Robert Spigler, Gregory Sanders, Ta Tat Tai, Michael Flaxman, Pieter Wuille, Salvatore Ingala, Ava Chow and others for their feedback on the specification.
|
||||
|
||||
==References==
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Suhas Daftuar <sdaftuar@chaincode.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0130
|
||||
Status: Proposed
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2015-05-08
|
||||
License: PD
|
||||
|
@ -48,7 +48,7 @@ The author doesn't believe this is a problem because a BIP cannot be forced on c
|
||||
|
||||
== Process ==
|
||||
|
||||
* '''Submit for Comments.''' The first BIP champion named in the proposal can call a "submit for comments" at any time by posting to the [https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev Dev Mailing List] mailling with the BIP number and a statement that the champion intends to immediately submit the BIP for comments.
|
||||
* '''Submit for Comments.''' The first BIP champion named in the proposal can call a "submit for comments" at any time by posting to the [https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev Dev Mailing List] mailing with the BIP number and a statement that the champion intends to immediately submit the BIP for comments.
|
||||
** The BIP must have been assigned BIP-number (i.e. been approved by the BIP editor) to be submitted for comments.
|
||||
* '''Comments.'''
|
||||
** After a BIP has been submitted for comments, a two-week waiting period begins in which the community should transition from making suggestions about a proposal to publishing their opinions or concerns on the proposal.
|
||||
@ -83,7 +83,7 @@ The author doesn't believe this is a problem because a BIP cannot be forced on c
|
||||
** User communities
|
||||
* A person may be represented by any number of segments, but a committee cannot re-use the same resource as another committee in the same segment.
|
||||
|
||||
'''Committee Declarations.'''
|
||||
'''Committee Declarations.'''
|
||||
* At any point, a Committee Declaration can be posted.
|
||||
* This Declaration must contain details about:
|
||||
** The segment the Committee is representing
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Alex Morcos <morcos@chaincode.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0133
|
||||
Status: Draft
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2016-02-13
|
||||
License: PD
|
||||
|
@ -58,7 +58,7 @@ various decades ago with the XML format. The idea is that we give each
|
||||
field a name and this means that new fields can be added or optional fields
|
||||
can be omitted from individual transactions. Some other ideas are the
|
||||
standardization of data-formats (like integer and string encoding) so
|
||||
we create a more consistent system.
|
||||
we create a more consistent system.
|
||||
One thing we shall not inherit from XML is its text-based format. Instead
|
||||
we use the [https://github.com/bitcoinclassic/documentation/blob/master/spec/compactmessageformat.md Compact Message Format]
|
||||
(CMF) which is optimized to keep the size small and fast to parse.
|
||||
|
@ -170,7 +170,7 @@ A given deployment SHALL remain in the DEFINED state until it either passes the
|
||||
starttime (and becomes STARTED) or the timeout time (and becomes FAILED).
|
||||
|
||||
Once a deployment has STARTED, the signal for that deployment SHALL be tallied
|
||||
over the the past windowsize blocks whenever a new block is received on that
|
||||
over the past windowsize blocks whenever a new block is received on that
|
||||
chain.
|
||||
|
||||
A transition from the STARTED state to the LOCKED_IN state SHALL only occur
|
||||
@ -183,7 +183,7 @@ when all of these are true:
|
||||
A similar height synchronization precondition SHALL exist for the transition from
|
||||
LOCKED_IN to ACTIVE.
|
||||
These synchronization conditions are expressed by the "mod(height, windowsize) = 0"
|
||||
clauses in the diagram, and have been been added so that backward compatibility
|
||||
clauses in the diagram, and have been added so that backward compatibility
|
||||
with BIP9's use of the 2016-block re-targeting periods can be configured for
|
||||
existing deployments (see above 'Optional full backward compatibility' section).
|
||||
|
||||
@ -261,7 +261,7 @@ proposal, although a conventional fallow period of 3 months is RECOMMENDED.
|
||||
Due to the constraints set by BIP 34, BIP 66 and BIP 65, there are only
|
||||
0x7FFFFFFB possible nVersion values available. This limits to at most 30
|
||||
independent deployments.
|
||||
By restricting the top 3 bits to 001 we we are left with 29 out of those for
|
||||
By restricting the top 3 bits to 001 we are left with 29 out of those for
|
||||
the purposes of this proposal, and support two future upgrades for different
|
||||
mechanisms (top bits 010 and 011).
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
This document describes a signature format for signing messages with Bitcoin private keys.
|
||||
|
||||
The specification is intended to describe the standard for signatures of messages that can be signed and verfied between different clients that exist in the field today. Note: that a new signature format has been defined which has a number of advantages over this BIP, but to be backwards compatible with existing implementations this BIP will be useful. See BIP 322 [1] for full details on the new signature scheme.
|
||||
The specification is intended to describe the standard for signatures of messages that can be signed and verified between different clients that exist in the field today. Note: that a new signature format has been defined which has a number of advantages over this BIP, but to be backwards compatible with existing implementations this BIP will be useful. See BIP 322 [1] for full details on the new signature scheme.
|
||||
|
||||
One of the key problems in this area is that there are several different types of Bitcoin addresses and without introducing specific standards it is unclear which type of address format is being used. See [2]. This BIP will attempt to address these issues and define a clear and concise format for Bitcoin signatures.
|
||||
|
||||
@ -25,7 +25,7 @@ This BIP is licensed under the 2-clause BSD license.
|
||||
|
||||
==Motivation==
|
||||
|
||||
Since Bitcoin private keys can not only be used to sign Bitcoin transactions, but also any other message, it has become customary to use them to sign various messages for differing purposes. Some applications of signing messages with a Bitcoin private key are as follows: proof of funds for collateral, credit worthiness, enterence to events, airdrops, audits as well as other applications. While there was no BIP written for how to digitally sign messages with Bitcoin private keys with P2PKH addresses it is a fairly well understood process, however with the introduction of Segwit (both in the form of P2SH and bech32) addresses, it is unclear how to distinguish a P2PKH, P2SH, or bech32 address from one another. This BIP proposes a standard signature format that will allow clients to distinguish between the different address formats.
|
||||
Since Bitcoin private keys can not only be used to sign Bitcoin transactions, but also any other message, it has become customary to use them to sign various messages for differing purposes. Some applications of signing messages with a Bitcoin private key are as follows: proof of funds for collateral, credit worthiness, entrance to events, airdrops, audits as well as other applications. While there was no BIP written for how to digitally sign messages with Bitcoin private keys with P2PKH addresses it is a fairly well understood process, however with the introduction of Segwit (both in the form of P2SH and bech32) addresses, it is unclear how to distinguish a P2PKH, P2SH, or bech32 address from one another. This BIP proposes a standard signature format that will allow clients to distinguish between the different address formats.
|
||||
|
||||
==Specification==
|
||||
|
||||
@ -116,7 +116,7 @@ Since this format includes P2PKH keys, it is backwards compatible, but keep in m
|
||||
|
||||
==Implications==
|
||||
|
||||
Message signing is an important use case and potentially underused due to the fact that, up until now, there has not been a formal specification for how wallets can sign messages using Bitcoin private keys. Bitcoin wallets should be interoperable and use the same conventions for determing a signature's validity. This BIP can also be updated as new signature formats emerge.
|
||||
Message signing is an important use case and potentially underused due to the fact that, up until now, there has not been a formal specification for how wallets can sign messages using Bitcoin private keys. Bitcoin wallets should be interoperable and use the same conventions for determining a signature's validity. This BIP can also be updated as new signature formats emerge.
|
||||
|
||||
==Acknowledgements==
|
||||
|
||||
|
@ -62,7 +62,7 @@ This is the standard ''m-of-n'' script defined in [https://github.com/bitcoin/bi
|
||||
The existing <code>OP_CHECKMULTISIG</code> and <code>OP_CHECKMULTISIGVERIFY</code> have a bug<ref>[[https://bitcoin.org/en/developer-guide#multisig|Developer Documentation - Multisig]]</ref> that pops one argument too many from the stack. This bug is not reproduced in the implementation of OP_CHECKSIGEX, so the canonical solution of pushing a dummy value onto the stack is not necessary.
|
||||
|
||||
The normalization is achieved by normalizing the transaction before computing the signaturehash, i.e., the hash that is signed.
|
||||
The transaction must be normalized by replacing all transaction IDs in the inputs by their normalized variants and stripping the signature scripts. The normalized transction IDs are computed as described in the previous section. This normalization step is performed both when creating the signatures as well as when checking the signatures.
|
||||
The transaction must be normalized by replacing all transaction IDs in the inputs by their normalized variants and stripping the signature scripts. The normalized transaction IDs are computed as described in the previous section. This normalization step is performed both when creating the signatures as well as when checking the signatures.
|
||||
|
||||
=== Tracking Normalized Transaction IDs ===
|
||||
|
||||
|
@ -43,13 +43,13 @@ By removing this data from the transaction structure committed to the transactio
|
||||
A new data structure, <code>witness</code>, is defined. Each transaction will have 2 IDs.
|
||||
|
||||
Definition of <code>txid</code> remains unchanged: the double SHA256 of the traditional serialization format:
|
||||
|
||||
|
||||
[nVersion][txins][txouts][nLockTime]
|
||||
|
||||
|
||||
A new <code>wtxid</code> is defined: the double SHA256 of the new serialization with witness data:
|
||||
|
||||
|
||||
[nVersion][marker][flag][txins][txouts][witness][nLockTime]
|
||||
|
||||
|
||||
Format of <code>nVersion</code>, <code>txins</code>, <code>txouts</code>, and <code>nLockTime</code> are same as traditional serialization.
|
||||
|
||||
The <code>marker</code> MUST be a 1-byte zero value: <code>0x00</code>.
|
||||
@ -67,14 +67,14 @@ A new block rule is added which requires a commitment to the <code>wtxid</code>.
|
||||
A <code>witness root hash</code> is calculated with all those <code>wtxid</code> as leaves, in a way similar to the <code>hashMerkleRoot</code> in the block header.
|
||||
|
||||
The commitment is recorded in a <code>scriptPubKey</code> of the coinbase transaction. It must be at least 38 bytes, with the first 6-byte of <code>0x6a24aa21a9ed</code>, that is:
|
||||
|
||||
|
||||
1-byte - OP_RETURN (0x6a)
|
||||
1-byte - Push the following 36 bytes (0x24)
|
||||
4-byte - Commitment header (0xaa21a9ed)
|
||||
32-byte - Commitment hash: Double-SHA256(witness root hash|witness reserved value)
|
||||
|
||||
|
||||
39th byte onwards: Optional data with no consensus meaning
|
||||
|
||||
|
||||
and the coinbase's input's witness must consist of a single 32-byte array for the <code>witness reserved value</code>.
|
||||
|
||||
If there are more than one <code>scriptPubKey</code> matching the pattern, the one with highest output index is assumed to be the commitment.
|
||||
@ -83,19 +83,23 @@ If all transactions in a block do not have witness data, the commitment is optio
|
||||
|
||||
=== Witness program ===
|
||||
|
||||
A <code>scriptPubKey</code> (or <code>redeemScript</code> as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program".
|
||||
A <code>scriptPubKey</code> (or <code>redeemScript</code> as defined in BIP16/P2SH) that consists of a 1-byte push opcode (one of <code>OP_0,OP_1,OP_2,...,OP_16</code>) followed by a direct data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program".
|
||||
In more detail, this means a <code>scriptPubKey</code> or <code>redeemScript</code> which consists of (in order):
|
||||
* First, byte 0x00 (<code>OP_0</code>) or any byte between 0x51 (<code>OP_1</code>) and 0x60 (<code>OP_16</code>) inclusive (the version byte).
|
||||
* Then, a byte ''L'' between 0x02 (push of 2 bytes) and 0x28 (push of 40 bytes) inclusive.
|
||||
* Finally, ''L'' arbitrary bytes (the witness program).
|
||||
|
||||
There are two cases in which witness validation logic are triggered. Each case determines the location of the witness version byte and program, as well as the form of the scriptSig:
|
||||
# Triggered by a <code>scriptPubKey</code> that is exactly a push of a version byte, plus a push of a witness program. The scriptSig must be exactly empty or validation fails. (''"native witness program"'')
|
||||
# Triggered when a <code>scriptPubKey</code> is a P2SH script, and the BIP16 <code>redeemScript</code> pushed in the <code>scriptSig</code> is exactly a push of a version byte plus a push of a witness program. The <code>scriptSig</code> must be exactly a push of the BIP16 <code>redeemScript</code> or validation fails. (''"P2SH witness program"'')
|
||||
|
||||
If the version byte is 0, and the witness program is 20 bytes:
|
||||
If the version byte is 0, and the witness program is 20 bytes (''L = 20''):
|
||||
* It is interpreted as a pay-to-witness-public-key-hash (P2WPKH) program.
|
||||
* The witness must consist of exactly 2 items (≤ 520 bytes each). The first one a signature, and the second one a public key.
|
||||
* The HASH160 of the public key must match the 20-byte witness program.
|
||||
* After normal script evaluation, the signature is verified against the public key with CHECKSIG operation. The verification must result in a single TRUE on the stack.
|
||||
|
||||
If the version byte is 0, and the witness program is 32 bytes:
|
||||
If the version byte is 0, and the witness program is 32 bytes (''L = 32''):
|
||||
* It is interpreted as a pay-to-witness-script-hash (P2WSH) program.
|
||||
* The witness must consist of an input stack to feed to the script, followed by a serialized script (<code>witnessScript</code>).
|
||||
* The <code>witnessScript</code> (≤ 10,000 bytes) is popped off the initial witness stack. SHA256 of the <code>witnessScript</code> must match the 32-byte witness program.
|
||||
@ -276,7 +280,7 @@ These commitments could be included in the extensible commitment structure throu
|
||||
|
||||
Since a version byte is pushed before a witness program, and programs with unknown versions are always considered as anyone-can-spend script, it is possible to introduce any new script system with a soft fork. The witness as a structure is not restricted by any existing script semantics and constraints, the 520-byte push limit in particular, and therefore allows arbitrarily large scripts and signatures.
|
||||
|
||||
Examples of new script system include Schnorr signatures which reduce the size of multisig transactions dramatically, Lamport signature which is quantum computing resistance, and Merklized abstract syntax trees which allow very compact witness for conditional scripts with extreme complexity.
|
||||
Examples of new script systems include Schnorr signatures, which reduce the size of multisig transactions dramatically; Lamport signatures, which are quantum computing resistant; and Merklized abstract syntax trees, which allow very compact witnesses for conditional scripts with extreme complexity.
|
||||
|
||||
=== Per-input lock-time and relative-lock-time ===
|
||||
|
||||
@ -303,7 +307,7 @@ As a soft fork, older software will continue to operate without modification. N
|
||||
|
||||
This BIP will be deployed by "version bits" BIP9 with the name "segwit" and using bit 1.
|
||||
|
||||
For Bitcoin mainnet, the BIP9 starttime will be midnight 15 november 2016 UTC (Epoch timestamp 1479168000) and BIP9 timeout will be midnight 15 november 2017 UTC (Epoch timestamp 1510704000).
|
||||
For Bitcoin mainnet, the BIP9 starttime will be midnight 15 November 2016 UTC (Epoch timestamp 1479168000) and BIP9 timeout will be midnight 15 November 2017 UTC (Epoch timestamp 1510704000).
|
||||
|
||||
For Bitcoin testnet, the BIP9 starttime will be midnight 1 May 2016 UTC (Epoch timestamp 1462060800) and BIP9 timeout will be midnight 1 May 2017 UTC (Epoch timestamp 1493596800).
|
||||
|
||||
|
@ -24,14 +24,14 @@ To define standard payment address for native segregated witness (segwit) transa
|
||||
The new Bitcoin address format defined is for the Pay-to-Witness-Public-Key-Hash (P2WPKH) and Pay-to-Witness-Script-Hash (P2WSH) transaction described in segregated witness soft fork (BIP141). The scriptPubKey is an OP_0 followed by a push of 20-byte-hash (P2WPKH) or 32-byte hash (P2WSH).
|
||||
|
||||
The new address is encoded in a way similar to existing address formats:
|
||||
|
||||
|
||||
base58-encode:
|
||||
[1-byte address version]
|
||||
[1-byte witness program version]
|
||||
[0x00]
|
||||
[20/32-byte-hash]
|
||||
[4-byte checksum]
|
||||
|
||||
|
||||
For P2WPKH address, the address version is 6 (0x06) for a main-network address or 3 (0x03) for a testnet address.
|
||||
|
||||
For P2WSH address, the address version is 10 (0x0A) for a main-network address or 40 (0x28) for a testnet address.
|
||||
@ -123,25 +123,25 @@ This proposal is forward-compatible with future versions of witness programs of
|
||||
== Example ==
|
||||
|
||||
The following public key,
|
||||
|
||||
|
||||
0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6
|
||||
|
||||
|
||||
when encoded as a P2PKH template, would become:
|
||||
|
||||
|
||||
DUP HASH160 <010966776006953D5567439E5E39F86A0D273BEE> EQUALVERIFY CHECKSIG
|
||||
|
||||
With the corresponding version 1 Bitcoin address being:
|
||||
|
||||
|
||||
16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM
|
||||
|
||||
When the same public key is encoded as P2WPKH, the scriptPubKey becomes:
|
||||
|
||||
|
||||
When the same public key is encoded as P2WPKH, the scriptPubKey becomes:
|
||||
|
||||
OP_0 <010966776006953D5567439E5E39F86A0D273BEE>
|
||||
|
||||
Using 0x06 as address version, followed by 0x00 as witness program version, and a 0x00 padding, the equivalent P2WPKH address is:
|
||||
|
||||
|
||||
p2xtZoXeX5X8BP8JfFhQK2nD3emtjch7UeFm
|
||||
|
||||
|
||||
== Reference implementation ==
|
||||
|
||||
https://github.com/theuni/bitcoin/commit/ede1b57058ac8efdefe61f67395affb48f2c0d80
|
||||
|
@ -31,7 +31,7 @@ A new transaction digest algorithm is defined, but only applicable to sigops in
|
||||
1. nVersion of the transaction (4-byte little endian)
|
||||
2. hashPrevouts (32-byte hash)
|
||||
3. hashSequence (32-byte hash)
|
||||
4. outpoint (32-byte hash + 4-byte little endian)
|
||||
4. outpoint (32-byte hash + 4-byte little endian)
|
||||
5. scriptCode of the input (serialized as scripts inside CTxOuts)
|
||||
6. value of the output spent by this input (8-byte little endian)
|
||||
7. nSequence of the input (4-byte little endian)
|
||||
@ -39,12 +39,12 @@ A new transaction digest algorithm is defined, but only applicable to sigops in
|
||||
9. nLocktime of the transaction (4-byte little endian)
|
||||
10. sighash type of the signature (4-byte little endian)
|
||||
|
||||
Semantics of the original sighash types remain unchanged, except the followings:
|
||||
Semantics of the original sighash types remain unchanged, except the following:
|
||||
# The way of serialization is changed;
|
||||
# All sighash types commit to the amount being spent by the signed input;
|
||||
# <code>FindAndDelete</code> of the signature is not applied to the <code>scriptCode</code>;
|
||||
# <code>OP_CODESEPARATOR</code>(s) after the last executed <code>OP_CODESEPARATOR</code> are not removed from the <code>scriptCode</code> (the last executed <code>OP_CODESEPARATOR</code> and any script before it are always removed);
|
||||
# <code>SINGLE</code> does not commit to the input index. When <code>ANYONECANPAY</code> is not set, the semantics are unchanged since <code>hashPrevouts</code> and <code>outpoint</code> together implictly commit to the input index. When <code>SINGLE</code> is used with <code>ANYONECANPAY</code>, omission of the index commitment allows permutation of the input-output pairs, as long as each pair is located at an equivalent index.
|
||||
# <code>SINGLE</code> does not commit to the input index. When <code>ANYONECANPAY</code> is not set, the semantics are unchanged since <code>hashPrevouts</code> and <code>outpoint</code> together implicitly commit to the input index. When <code>SINGLE</code> is used with <code>ANYONECANPAY</code>, omission of the index commitment allows permutation of the input-output pairs, as long as each pair is located at an equivalent index.
|
||||
|
||||
The items 1, 4, 7, 9, 10 have the same meaning as the original algorithm. <ref name=wiki></ref>
|
||||
|
||||
@ -77,7 +77,7 @@ Refer to the reference implementation, reproduced below, for the precise algorit
|
||||
uint256 hashPrevouts;
|
||||
uint256 hashSequence;
|
||||
uint256 hashOutputs;
|
||||
|
||||
|
||||
if (!(nHashType & SIGHASH_ANYONECANPAY)) {
|
||||
CHashWriter ss(SER_GETHASH, 0);
|
||||
for (unsigned int n = 0; n < txTo.vin.size(); n++) {
|
||||
@ -85,7 +85,7 @@ Refer to the reference implementation, reproduced below, for the precise algorit
|
||||
}
|
||||
hashPrevouts = ss.GetHash();
|
||||
}
|
||||
|
||||
|
||||
if (!(nHashType & SIGHASH_ANYONECANPAY) && (nHashType & 0x1f) != SIGHASH_SINGLE && (nHashType & 0x1f) != SIGHASH_NONE) {
|
||||
CHashWriter ss(SER_GETHASH, 0);
|
||||
for (unsigned int n = 0; n < txTo.vin.size(); n++) {
|
||||
@ -93,7 +93,7 @@ Refer to the reference implementation, reproduced below, for the precise algorit
|
||||
}
|
||||
hashSequence = ss.GetHash();
|
||||
}
|
||||
|
||||
|
||||
if ((nHashType & 0x1f) != SIGHASH_SINGLE && (nHashType & 0x1f) != SIGHASH_NONE) {
|
||||
CHashWriter ss(SER_GETHASH, 0);
|
||||
for (unsigned int n = 0; n < txTo.vout.size(); n++) {
|
||||
@ -105,7 +105,7 @@ Refer to the reference implementation, reproduced below, for the precise algorit
|
||||
ss << txTo.vout[nIn];
|
||||
hashOutputs = ss.GetHash();
|
||||
}
|
||||
|
||||
|
||||
CHashWriter ss(SER_GETHASH, 0);
|
||||
// Version
|
||||
ss << txTo.nVersion;
|
||||
@ -114,7 +114,7 @@ Refer to the reference implementation, reproduced below, for the precise algorit
|
||||
ss << hashSequence;
|
||||
// The input being signed (replacing the scriptSig with scriptCode + amount)
|
||||
// The prevout may already be contained in hashPrevout, and the nSequence
|
||||
// may already be contain in hashSequence.
|
||||
// may already be contained in hashSequence.
|
||||
ss << txTo.vin[nIn].prevout;
|
||||
ss << static_cast<const CScriptBase&>(scriptCode);
|
||||
ss << amount;
|
||||
@ -125,7 +125,7 @@ Refer to the reference implementation, reproduced below, for the precise algorit
|
||||
ss << txTo.nLockTime;
|
||||
// Sighash type
|
||||
ss << nHashType;
|
||||
|
||||
|
||||
return ss.GetHash();
|
||||
</source>
|
||||
|
||||
@ -139,42 +139,42 @@ Since this policy is preparation for a future softfork proposal, to avoid potent
|
||||
To ensure consistency in consensus-critical behaviour, developers should test their implementations against all the tests below. More tests related to this proposal could be found under https://github.com/bitcoin/bitcoin/tree/master/src/test/data .
|
||||
|
||||
=== Native P2WPKH ===
|
||||
|
||||
|
||||
The following is an unsigned transaction:
|
||||
0100000002fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f0000000000eeffffffef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a0100000000ffffffff02202cb206000000001976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac9093510d000000001976a9143bde42dbee7e4dbe6a21b2d50ce2f0167faa815988ac11000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
txin: 02 fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f 00000000 00 eeffffff
|
||||
ef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a 01000000 00 ffffffff
|
||||
txout: 02 202cb20600000000 1976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac
|
||||
9093510d00000000 1976a9143bde42dbee7e4dbe6a21b2d50ce2f0167faa815988ac
|
||||
nLockTime: 11000000
|
||||
|
||||
|
||||
The first input comes from an ordinary P2PK:
|
||||
scriptPubKey : 2103c9f4836b9a4f77fc0d81f7bcb01b7f1b35916864b9476c241ce9fc198bd25432ac value: 6.25
|
||||
private key : bbc27228ddcb9209d7fd6f36b02f7dfa6252af40bb2f1cbc7a557da8027ff866
|
||||
|
||||
|
||||
The second input comes from a P2WPKH witness program:
|
||||
scriptPubKey : 00141d0f172a0ecb48aee1be1f2687d2963ae33f71a1, value: 6
|
||||
private key : 619c335025c7f4012e556c2a58b2506e30b8511b53ade95ea316fd8c3286feb9
|
||||
public key : 025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357
|
||||
|
||||
|
||||
To sign it with a nHashType of 1 (SIGHASH_ALL):
|
||||
|
||||
|
||||
hashPrevouts:
|
||||
dSHA256(fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f00000000ef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a01000000)
|
||||
= 96b827c8483d4e9b96712b6713a7b68d6e8003a781feba36c31143470b4efd37
|
||||
|
||||
|
||||
hashSequence:
|
||||
dSHA256(eeffffffffffffff)
|
||||
= 52b0a642eea2fb7ae638c36f6252b6750293dbe574a806984b8e4d8548339a3b
|
||||
|
||||
|
||||
hashOutputs:
|
||||
dSHA256(202cb206000000001976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac9093510d000000001976a9143bde42dbee7e4dbe6a21b2d50ce2f0167faa815988ac)
|
||||
= 863ef3e1a92afbfdb97f31ad0fc7683ee943e9abcf2501590ff8f6551f47e5e5
|
||||
|
||||
|
||||
hash preimage: 0100000096b827c8483d4e9b96712b6713a7b68d6e8003a781feba36c31143470b4efd3752b0a642eea2fb7ae638c36f6252b6750293dbe574a806984b8e4d8548339a3bef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a010000001976a9141d0f172a0ecb48aee1be1f2687d2963ae33f71a188ac0046c32300000000ffffffff863ef3e1a92afbfdb97f31ad0fc7683ee943e9abcf2501590ff8f6551f47e5e51100000001000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 96b827c8483d4e9b96712b6713a7b68d6e8003a781feba36c31143470b4efd37
|
||||
hashSequence: 52b0a642eea2fb7ae638c36f6252b6750293dbe574a806984b8e4d8548339a3b
|
||||
@ -185,12 +185,12 @@ To ensure consistency in consensus-critical behaviour, developers should test th
|
||||
hashOutputs: 863ef3e1a92afbfdb97f31ad0fc7683ee943e9abcf2501590ff8f6551f47e5e5
|
||||
nLockTime: 11000000
|
||||
nHashType: 01000000
|
||||
|
||||
|
||||
sigHash: c37af31116d1b27caf68aae9e3ac82f1477929014d5b917657d0eb49478cb670
|
||||
signature: 304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee
|
||||
|
||||
signature: 304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee01
|
||||
|
||||
The serialized signed transaction is: 01000000000102fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f00000000494830450221008b9d1dc26ba6a9cb62127b02742fa9d754cd3bebf337f7a55d114c8e5cdd30be022040529b194ba3f9281a99f2b1c0a19c0489bc22ede944ccf4ecbab4cc618ef3ed01eeffffffef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a0100000000ffffffff02202cb206000000001976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac9093510d000000001976a9143bde42dbee7e4dbe6a21b2d50ce2f0167faa815988ac000247304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee0121025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee635711000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
marker: 00
|
||||
flag: 01
|
||||
@ -203,38 +203,38 @@ To ensure consistency in consensus-critical behaviour, developers should test th
|
||||
nLockTime: 11000000
|
||||
|
||||
=== P2SH-P2WPKH ===
|
||||
|
||||
|
||||
|
||||
|
||||
The following is an unsigned transaction: 0100000001db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a54770100000000feffffff02b8b4eb0b000000001976a914a457b684d7f0d539a46a45bbc043f35b59d0d96388ac0008af2f000000001976a914fd270b1ee6abcaea97fea7ad0402e8bd8ad6d77c88ac92040000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
txin: 01 db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a5477 01000000 00 feffffff
|
||||
txout: 02 b8b4eb0b00000000 1976a914a457b684d7f0d539a46a45bbc043f35b59d0d96388ac
|
||||
0008af2f00000000 1976a914fd270b1ee6abcaea97fea7ad0402e8bd8ad6d77c88ac
|
||||
nLockTime: 92040000
|
||||
|
||||
|
||||
The input comes from a P2SH-P2WPKH witness program:
|
||||
scriptPubKey : a9144733f37cf4db86fbc2efed2500b4f4e49f31202387, value: 10
|
||||
redeemScript : 001479091972186c449eb1ded22b78e40d009bdf0089
|
||||
private key : eb696a065ef48a2192da5b28b694f87544b30fae8327c4510137a922f32c6dcf
|
||||
public key : 03ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a26873
|
||||
|
||||
|
||||
To sign it with a nHashType of 1 (SIGHASH_ALL):
|
||||
|
||||
|
||||
hashPrevouts:
|
||||
dSHA256(db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a547701000000)
|
||||
= b0287b4a252ac05af83d2dcef00ba313af78a3e9c329afa216eb3aa2a7b4613a
|
||||
|
||||
|
||||
hashSequence:
|
||||
dSHA256(feffffff)
|
||||
= 18606b350cd8bf565266bc352f0caddcf01e8fa789dd8a15386327cf8cabe198
|
||||
|
||||
|
||||
hashOutputs:
|
||||
dSHA256(b8b4eb0b000000001976a914a457b684d7f0d539a46a45bbc043f35b59d0d96388ac0008af2f000000001976a914fd270b1ee6abcaea97fea7ad0402e8bd8ad6d77c88ac)
|
||||
= de984f44532e2173ca0d64314fcefe6d30da6f8cf27bafa706da61df8a226c83
|
||||
|
||||
|
||||
hash preimage: 01000000b0287b4a252ac05af83d2dcef00ba313af78a3e9c329afa216eb3aa2a7b4613a18606b350cd8bf565266bc352f0caddcf01e8fa789dd8a15386327cf8cabe198db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a5477010000001976a91479091972186c449eb1ded22b78e40d009bdf008988ac00ca9a3b00000000feffffffde984f44532e2173ca0d64314fcefe6d30da6f8cf27bafa706da61df8a226c839204000001000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
hashPrevouts: b0287b4a252ac05af83d2dcef00ba313af78a3e9c329afa216eb3aa2a7b4613a
|
||||
hashSequence: 18606b350cd8bf565266bc352f0caddcf01e8fa789dd8a15386327cf8cabe198
|
||||
@ -245,10 +245,10 @@ To ensure consistency in consensus-critical behaviour, developers should test th
|
||||
hashOutputs: de984f44532e2173ca0d64314fcefe6d30da6f8cf27bafa706da61df8a226c83
|
||||
nLockTime: 92040000
|
||||
nHashType: 01000000
|
||||
|
||||
|
||||
sigHash: 64f3b0f4dd2bb3aa1ce8566d220cc74dda9df97d8490cc81d89d735c92e59fb6
|
||||
signature: 3044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb01
|
||||
|
||||
|
||||
The serialized signed transaction is: 01000000000101db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a5477010000001716001479091972186c449eb1ded22b78e40d009bdf0089feffffff02b8b4eb0b000000001976a914a457b684d7f0d539a46a45bbc043f35b59d0d96388ac0008af2f000000001976a914fd270b1ee6abcaea97fea7ad0402e8bd8ad6d77c88ac02473044022047ac8e878352d3ebbde1c94ce3a10d057c24175747116f8288e5d794d12d482f0220217f36a485cae903c713331d877c1f64677e3622ad4010726870540656fe9dcb012103ad1d8e89212f0b92c74d23bb710c00662ad1470198ac48c43f7d6f93a2a2687392040000
|
||||
nVersion: 01000000
|
||||
marker: 00
|
||||
@ -263,33 +263,33 @@ To ensure consistency in consensus-critical behaviour, developers should test th
|
||||
|
||||
This example shows how <code>OP_CODESEPARATOR</code> and out-of-range <code>SIGHASH_SINGLE</code> are processed:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The following is an unsigned transaction:
|
||||
0100000002fe3dc9208094f3ffd12645477b3dc56f60ec4fa8e6f5d67c565d1c6b9216b36e0000000000ffffffff0815cf020f013ed6cf91d29f4202e8a58726b1ac6c79da47c23d1bee0a6925f80000000000ffffffff0100f2052a010000001976a914a30741f8145e5acadf23f751864167f32e0963f788ac00000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
txin: 02 fe3dc9208094f3ffd12645477b3dc56f60ec4fa8e6f5d67c565d1c6b9216b36e 00000000 00 ffffffff
|
||||
0815cf020f013ed6cf91d29f4202e8a58726b1ac6c79da47c23d1bee0a6925f8 00000000 00 ffffffff
|
||||
txout: 01 00f2052a01000000 1976a914a30741f8145e5acadf23f751864167f32e0963f788ac
|
||||
nLockTime: 00000000
|
||||
|
||||
|
||||
The first input comes from an ordinary P2PK:
|
||||
scriptPubKey: 21036d5c20fa14fb2f635474c1dc4ef5909d4568e5569b79fc94d3448486e14685f8ac value: 1.5625
|
||||
private key: b8f28a772fccbf9b4f58a4f027e07dc2e35e7cd80529975e292ea34f84c4580c
|
||||
signature: 304402200af4e47c9b9629dbecc21f73af989bdaa911f7e6f6c2e9394588a3aa68f81e9902204f3fcf6ade7e5abb1295b6774c8e0abd94ae62217367096bc02ee5e435b67da201 (SIGHASH_ALL)
|
||||
|
||||
|
||||
The second input comes from a native P2WSH witness program:
|
||||
scriptPubKey : 00205d1b56b63d714eebe542309525f484b7e9d6f686b3781b6f61ef925d66d6f6a0, value: 49
|
||||
witnessScript: 21026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880aeadab210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac
|
||||
<026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880ae> CHECKSIGVERIFY CODESEPARATOR <0255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465> CHECKSIG
|
||||
|
||||
|
||||
To sign it with a nHashType of 3 (SIGHASH_SINGLE):
|
||||
|
||||
|
||||
hashPrevouts:
|
||||
dSHA256(fe3dc9208094f3ffd12645477b3dc56f60ec4fa8e6f5d67c565d1c6b9216b36e000000000815cf020f013ed6cf91d29f4202e8a58726b1ac6c79da47c23d1bee0a6925f800000000)
|
||||
= ef546acf4a020de3898d1b8956176bb507e6211b5ed3619cd08b6ea7e2a09d41
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
hashPrevouts: ef546acf4a020de3898d1b8956176bb507e6211b5ed3619cd08b6ea7e2a09d41
|
||||
hashSequence: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -300,7 +300,7 @@ This example shows how <code>OP_CODESEPARATOR</code> and out-of-range <code>SIGH
|
||||
hashOutputs: 0000000000000000000000000000000000000000000000000000000000000000 (this is the second input but there is only one output)
|
||||
nLockTime: 00000000
|
||||
nHashType: 03000000
|
||||
|
||||
|
||||
scriptCode: 4721026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880aeadab210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac
|
||||
^^
|
||||
(please note that the not-yet-executed OP_CODESEPARATOR is not removed from the scriptCode)
|
||||
@ -309,7 +309,7 @@ This example shows how <code>OP_CODESEPARATOR</code> and out-of-range <code>SIGH
|
||||
public key: 026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880ae
|
||||
private key: 8e02b539b1500aa7c81cf3fed177448a546f19d2be416c0c61ff28e577d8d0cd
|
||||
signature: 3044022027dc95ad6b740fe5129e7e62a75dd00f291a2aeb1200b84b09d9e3789406b6c002201a9ecd315dd6a0e632ab20bbb98948bc0c6fb204f2c286963bb48517a7058e2703
|
||||
|
||||
|
||||
scriptCode: 23210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac
|
||||
(everything up to the last executed OP_CODESEPARATOR, including that OP_CODESEPARATOR, are removed)
|
||||
preimage: 01000000ef546acf4a020de3898d1b8956176bb507e6211b5ed3619cd08b6ea7e2a09d4100000000000000000000000000000000000000000000000000000000000000000815cf020f013ed6cf91d29f4202e8a58726b1ac6c79da47c23d1bee0a6925f80000000023210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac0011102401000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000003000000
|
||||
@ -317,36 +317,36 @@ This example shows how <code>OP_CODESEPARATOR</code> and out-of-range <code>SIGH
|
||||
public key: 0255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465
|
||||
private key: 86bf2ed75935a0cbef03b89d72034bb4c189d381037a5ac121a70016db8896ec
|
||||
signature: 304402200de66acf4527789bfda55fc5459e214fa6083f936b430a762c629656216805ac0220396f550692cd347171cbc1ef1f51e15282e837bb2b30860dc77c8f78bc8501e503
|
||||
|
||||
|
||||
The serialized signed transaction is: 01000000000102fe3dc9208094f3ffd12645477b3dc56f60ec4fa8e6f5d67c565d1c6b9216b36e000000004847304402200af4e47c9b9629dbecc21f73af989bdaa911f7e6f6c2e9394588a3aa68f81e9902204f3fcf6ade7e5abb1295b6774c8e0abd94ae62217367096bc02ee5e435b67da201ffffffff0815cf020f013ed6cf91d29f4202e8a58726b1ac6c79da47c23d1bee0a6925f80000000000ffffffff0100f2052a010000001976a914a30741f8145e5acadf23f751864167f32e0963f788ac000347304402200de66acf4527789bfda55fc5459e214fa6083f936b430a762c629656216805ac0220396f550692cd347171cbc1ef1f51e15282e837bb2b30860dc77c8f78bc8501e503473044022027dc95ad6b740fe5129e7e62a75dd00f291a2aeb1200b84b09d9e3789406b6c002201a9ecd315dd6a0e632ab20bbb98948bc0c6fb204f2c286963bb48517a7058e27034721026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880aeadab210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac00000000
|
||||
|
||||
|
||||
This example shows how unexecuted <code>OP_CODESEPARATOR</code> is processed, and <code>SINGLE|ANYONECANPAY</code> does not commit to the input index:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The following is an unsigned transaction:
|
||||
0100000002e9b542c5176808107ff1df906f46bb1f2583b16112b95ee5380665ba7fcfc0010000000000ffffffff80e68831516392fcd100d186b3c2c7b95c80b53c77e77c35ba03a66b429a2a1b0000000000ffffffff0280969800000000001976a914de4b231626ef508c9a74a8517e6783c0546d6b2888ac80969800000000001976a9146648a8cd4531e1ec47f35916de8e259237294d1e88ac00000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
txin: 02 e9b542c5176808107ff1df906f46bb1f2583b16112b95ee5380665ba7fcfc001 00000000 00 ffffffff
|
||||
80e68831516392fcd100d186b3c2c7b95c80b53c77e77c35ba03a66b429a2a1b 00000000 00 ffffffff
|
||||
txout: 02 8096980000000000 1976a914de4b231626ef508c9a74a8517e6783c0546d6b2888ac
|
||||
8096980000000000 1976a9146648a8cd4531e1ec47f35916de8e259237294d1e88ac
|
||||
nLockTime: 00000000
|
||||
|
||||
|
||||
The first input comes from a native P2WSH witness program:
|
||||
scriptPubKey: 0020ba468eea561b26301e4cf69fa34bde4ad60c81e70f059f045ca9a79931004a4d value: 0.16777215
|
||||
witnessScript:0063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac
|
||||
0 IF CODESEPARATOR ENDIF <0392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98> CHECKSIG
|
||||
|
||||
|
||||
The second input comes from a native P2WSH witness program:
|
||||
scriptPubKey: 0020d9bbfbe56af7c4b7f960a70d7ea107156913d9e5a26b0a71429df5e097ca6537 value: 0.16777215
|
||||
witnessScript:5163ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac
|
||||
1 IF CODESEPARATOR ENDIF <0392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98> CHECKSIG
|
||||
|
||||
|
||||
To sign it with a nHashType of 0x83 (SINGLE|ANYONECANPAY):
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
hashSequence: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -357,7 +357,7 @@ This example shows how unexecuted <code>OP_CODESEPARATOR</code> is processed, an
|
||||
hashOutputs: (see below)
|
||||
nLockTime: 00000000
|
||||
nHashType: 83000000
|
||||
|
||||
|
||||
outpoint: e9b542c5176808107ff1df906f46bb1f2583b16112b95ee5380665ba7fcfc00100000000
|
||||
scriptCode: 270063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac
|
||||
(since the OP_CODESEPARATOR is not executed, nothing is removed from the scriptCode)
|
||||
@ -367,7 +367,7 @@ This example shows how unexecuted <code>OP_CODESEPARATOR</code> is processed, an
|
||||
public key: 0392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98
|
||||
private key: f52b3484edd96598e02a9c89c4492e9c1e2031f471c49fd721fe68b3ce37780d
|
||||
signature: 3045022100f6a10b8604e6dc910194b79ccfc93e1bc0ec7c03453caaa8987f7d6c3413566002206216229ede9b4d6ec2d325be245c5b508ff0339bf1794078e20bfe0babc7ffe683
|
||||
|
||||
|
||||
outpoint: 80e68831516392fcd100d186b3c2c7b95c80b53c77e77c35ba03a66b429a2a1b00000000
|
||||
scriptCode: 2468210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac
|
||||
(everything up to the last executed OP_CODESEPARATOR, including that OP_CODESEPARATOR, are removed)
|
||||
@ -377,7 +377,7 @@ This example shows how unexecuted <code>OP_CODESEPARATOR</code> is processed, an
|
||||
public key: 0392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98
|
||||
private key: f52b3484edd96598e02a9c89c4492e9c1e2031f471c49fd721fe68b3ce37780d
|
||||
signature: 30440220032521802a76ad7bf74d0e2c218b72cf0cbc867066e2e53db905ba37f130397e02207709e2188ed7f08f4c952d9d13986da504502b8c3be59617e043552f506c46ff83
|
||||
|
||||
|
||||
The serialized signed transaction is:
|
||||
01000000000102e9b542c5176808107ff1df906f46bb1f2583b16112b95ee5380665ba7fcfc0010000000000ffffffff80e68831516392fcd100d186b3c2c7b95c80b53c77e77c35ba03a66b429a2a1b0000000000ffffffff0280969800000000001976a914de4b231626ef508c9a74a8517e6783c0546d6b2888ac80969800000000001976a9146648a8cd4531e1ec47f35916de8e259237294d1e88ac02483045022100f6a10b8604e6dc910194b79ccfc93e1bc0ec7c03453caaa8987f7d6c3413566002206216229ede9b4d6ec2d325be245c5b508ff0339bf1794078e20bfe0babc7ffe683270063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac024730440220032521802a76ad7bf74d0e2c218b72cf0cbc867066e2e53db905ba37f130397e02207709e2188ed7f08f4c952d9d13986da504502b8c3be59617e043552f506c46ff83275163ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac00000000
|
||||
nVersion: 01000000
|
||||
@ -390,7 +390,7 @@ This example shows how unexecuted <code>OP_CODESEPARATOR</code> is processed, an
|
||||
witness 02 483045022100f6a10b8604e6dc910194b79ccfc93e1bc0ec7c03453caaa8987f7d6c3413566002206216229ede9b4d6ec2d325be245c5b508ff0339bf1794078e20bfe0babc7ffe683 270063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac
|
||||
02 4730440220032521802a76ad7bf74d0e2c218b72cf0cbc867066e2e53db905ba37f130397e02207709e2188ed7f08f4c952d9d13986da504502b8c3be59617e043552f506c46ff83 275163ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac
|
||||
nLockTime: 00000000
|
||||
|
||||
|
||||
Since SINGLE|ANYONECANPAY does not commit to the input index, the signatures are still valid when the input-output pairs are swapped:
|
||||
0100000000010280e68831516392fcd100d186b3c2c7b95c80b53c77e77c35ba03a66b429a2a1b0000000000ffffffffe9b542c5176808107ff1df906f46bb1f2583b16112b95ee5380665ba7fcfc0010000000000ffffffff0280969800000000001976a9146648a8cd4531e1ec47f35916de8e259237294d1e88ac80969800000000001976a914de4b231626ef508c9a74a8517e6783c0546d6b2888ac024730440220032521802a76ad7bf74d0e2c218b72cf0cbc867066e2e53db905ba37f130397e02207709e2188ed7f08f4c952d9d13986da504502b8c3be59617e043552f506c46ff83275163ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac02483045022100f6a10b8604e6dc910194b79ccfc93e1bc0ec7c03453caaa8987f7d6c3413566002206216229ede9b4d6ec2d325be245c5b508ff0339bf1794078e20bfe0babc7ffe683270063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac00000000
|
||||
nVersion: 01000000
|
||||
@ -408,37 +408,37 @@ This example shows how unexecuted <code>OP_CODESEPARATOR</code> is processed, an
|
||||
|
||||
This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 different <code>SIGHASH</code> types.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The following is an unsigned transaction: 010000000136641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e0100000000ffffffff0200e9a435000000001976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688acc0832f05000000001976a9147480a33f950689af511e6e84c138dbbd3c3ee41588ac00000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
txin: 01 36641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e 01000000 00 ffffffff
|
||||
txout: 02 00e9a43500000000 1976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688ac
|
||||
c0832f0500000000 1976a9147480a33f950689af511e6e84c138dbbd3c3ee41588ac
|
||||
nLockTime: 00000000
|
||||
|
||||
|
||||
The input comes from a P2SH-P2WSH 6-of-6 multisig witness program:
|
||||
scriptPubKey : a9149993a429037b5d912407a71c252019287b8d27a587, value: 9.87654321
|
||||
redeemScript : 0020a16b5755f7f6f96dbd65f5f0d6ab9418b89af4b1f14a1bb8a09062c35f0dcb54
|
||||
witnessScript: 56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56ae
|
||||
|
||||
|
||||
hashPrevouts:
|
||||
dSHA256(36641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000)
|
||||
= 74afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0
|
||||
|
||||
|
||||
hashSequence:
|
||||
dSHA256(ffffffff)
|
||||
= 3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044
|
||||
|
||||
|
||||
hashOutputs for ALL:
|
||||
dSHA256(00e9a435000000001976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688acc0832f05000000001976a9147480a33f950689af511e6e84c138dbbd3c3ee41588ac)
|
||||
= bc4d309071414bed932f98832b27b4d76dad7e6c1346f487a8fdbb8eb90307cc
|
||||
|
||||
|
||||
hashOutputs for SINGLE:
|
||||
dSHA256(00e9a435000000001976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688ac)
|
||||
= 9efe0c13a6b16c14a41b04ebe6a63f419bdacb2f8705b494a43063ca3cd4f708
|
||||
|
||||
|
||||
hash preimage for ALL: 0100000074afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa03bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e7066504436641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56aeb168de3a00000000ffffffffbc4d309071414bed932f98832b27b4d76dad7e6c1346f487a8fdbb8eb90307cc0000000001000000
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 74afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0
|
||||
@ -454,7 +454,7 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
public key: 0307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba3
|
||||
private key: 730fff80e1413068a05b57d6a58261f07551163369787f349438ea38ca80fac6
|
||||
signature: 304402206ac44d672dac41f9b00e28f4df20c52eeb087207e8d758d76d92c6fab3b73e2b0220367750dbbe19290069cba53d096f44530e4f98acaa594810388cf7409a1870ce01
|
||||
|
||||
|
||||
hash preimage for NONE: 0100000074afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0000000000000000000000000000000000000000000000000000000000000000036641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56aeb168de3a00000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000002000000
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 74afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0
|
||||
@ -470,7 +470,7 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
public key: 03b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b
|
||||
private key: 11fa3d25a17cbc22b29c44a484ba552b5a53149d106d3d853e22fdd05a2d8bb3
|
||||
signature: 3044022068c7946a43232757cbdf9176f009a928e1cd9a1a8c212f15c1e11ac9f2925d9002205b75f937ff2f9f3c1246e547e54f62e027f64eefa2695578cc6432cdabce271502
|
||||
|
||||
|
||||
hash preimage for SINGLE: 0100000074afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0000000000000000000000000000000000000000000000000000000000000000036641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56aeb168de3a00000000ffffffff9efe0c13a6b16c14a41b04ebe6a63f419bdacb2f8705b494a43063ca3cd4f7080000000003000000
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 74afdc312af5183c4198a40ca3c1a275b485496dd3929bca388c4b5e31f7aaa0
|
||||
@ -486,7 +486,7 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
public key: 034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a
|
||||
private key: 77bf4141a87d55bdd7f3cd0bdccf6e9e642935fec45f2f30047be7b799120661
|
||||
signature: 3044022059ebf56d98010a932cf8ecfec54c48e6139ed6adb0728c09cbe1e4fa0915302e022007cd986c8fa870ff5d2b3a89139c9fe7e499259875357e20fcbb15571c76795403
|
||||
|
||||
|
||||
hash preimage for ALL|ANYONECANPAY: 010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56aeb168de3a00000000ffffffffbc4d309071414bed932f98832b27b4d76dad7e6c1346f487a8fdbb8eb90307cc0000000081000000
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -502,7 +502,7 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
public key: 033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f4
|
||||
private key: 14af36970f5025ea3e8b5542c0f8ebe7763e674838d08808896b63c3351ffe49
|
||||
signature: 3045022100fbefd94bd0a488d50b79102b5dad4ab6ced30c4069f1eaa69a4b5a763414067e02203156c6a5c9cf88f91265f5a942e96213afae16d83321c8b31bb342142a14d16381
|
||||
|
||||
|
||||
hash preimage for NONE|ANYONECANPAY: 010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56aeb168de3a00000000ffffffff00000000000000000000000000000000000000000000000000000000000000000000000082000000
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -518,7 +518,7 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
public key: 03a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac16
|
||||
private key: fe9a95c19eef81dde2b95c1284ef39be497d128e2aa46916fb02d552485e0323
|
||||
signature: 3045022100a5263ea0553ba89221984bd7f0b13613db16e7a70c549a86de0cc0444141a407022005c360ef0ae5a5d4f9f2f87a56c1546cc8268cab08c73501d6b3be2e1e1a8a0882
|
||||
|
||||
|
||||
hash preimage for SINGLE|ANYONECANPAY: 010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e01000000cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56aeb168de3a00000000ffffffff9efe0c13a6b16c14a41b04ebe6a63f419bdacb2f8705b494a43063ca3cd4f7080000000083000000
|
||||
nVersion: 01000000
|
||||
hashPrevouts: 0000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -534,7 +534,7 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
public key: 02d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b
|
||||
private key: 428a7aee9f0c2af0cd19af3cf1c78149951ea528726989b2e83e4778d2c3f890
|
||||
signature: 30440220525406a1482936d5a21888260dc165497a90a15669636d8edca6b9fe490d309c022032af0c646a34a44d1f4576bf6a4a74b67940f8faa84c7df9abe12a01a11e2b4783
|
||||
|
||||
|
||||
The serialized signed transaction is: 0100000000010136641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e0100000023220020a16b5755f7f6f96dbd65f5f0d6ab9418b89af4b1f14a1bb8a09062c35f0dcb54ffffffff0200e9a435000000001976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688acc0832f05000000001976a9147480a33f950689af511e6e84c138dbbd3c3ee41588ac080047304402206ac44d672dac41f9b00e28f4df20c52eeb087207e8d758d76d92c6fab3b73e2b0220367750dbbe19290069cba53d096f44530e4f98acaa594810388cf7409a1870ce01473044022068c7946a43232757cbdf9176f009a928e1cd9a1a8c212f15c1e11ac9f2925d9002205b75f937ff2f9f3c1246e547e54f62e027f64eefa2695578cc6432cdabce271502473044022059ebf56d98010a932cf8ecfec54c48e6139ed6adb0728c09cbe1e4fa0915302e022007cd986c8fa870ff5d2b3a89139c9fe7e499259875357e20fcbb15571c76795403483045022100fbefd94bd0a488d50b79102b5dad4ab6ced30c4069f1eaa69a4b5a763414067e02203156c6a5c9cf88f91265f5a942e96213afae16d83321c8b31bb342142a14d16381483045022100a5263ea0553ba89221984bd7f0b13613db16e7a70c549a86de0cc0444141a407022005c360ef0ae5a5d4f9f2f87a56c1546cc8268cab08c73501d6b3be2e1e1a8a08824730440220525406a1482936d5a21888260dc165497a90a15669636d8edca6b9fe490d309c022032af0c646a34a44d1f4576bf6a4a74b67940f8faa84c7df9abe12a01a11e2b4783cf56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56ae00000000
|
||||
|
||||
|
||||
@ -542,35 +542,35 @@ This example is a P2SH-P2WSH 6-of-6 multisig witness program signed with 6 diffe
|
||||
|
||||
These examples show that <code>FindAndDelete</code> for the signature is not applied. The transactions are generated in an unconventional way. Instead of signing using a private key, the signatures are pre-determined as part of <code>witnessScript</code>. The public keys are generated with key recovery, using the fixed signatures and the <code>sighash</code> defined in this proposal. Therefore, the private keys are unknown.
|
||||
|
||||
|
||||
|
||||
The following is an unsigned transaction: 010000000169c12106097dc2e0526493ef67f21269fe888ef05c7a3a5dacab38e1ac8387f14c1d000000ffffffff0101000000000000000000000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
txin: 01 69c12106097dc2e0526493ef67f21269fe888ef05c7a3a5dacab38e1ac8387f1 4c1d0000 00 ffffffff
|
||||
txout: 01 0100000000000000 00
|
||||
nLockTime: 00000000
|
||||
|
||||
|
||||
The input comes from a P2WSH witness program:
|
||||
scriptPubKey : 00209e1be07558ea5cc8e02ed1d80c0911048afad949affa36d5c3951e3159dbea19, value: 200000
|
||||
scriptPubKey : 00209e1be07558ea5cc8e02ed1d80c0911048afad949affa36d5c3951e3159dbea19, value: 0.00200000
|
||||
redeemScript : OP_CHECKSIGVERIFY <0x30450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e01>
|
||||
ad4830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e01
|
||||
|
||||
|
||||
To sign it with a nHashType of 1 (SIGHASH_ALL):
|
||||
|
||||
|
||||
hashPrevouts:
|
||||
dSHA256(69c12106097dc2e0526493ef67f21269fe888ef05c7a3a5dacab38e1ac8387f14c1d0000)
|
||||
= b67c76d200c6ce72962d919dc107884b9d5d0e26f2aea7474b46a1904c53359f
|
||||
|
||||
|
||||
hashSequence:
|
||||
dSHA256(ffffffff)
|
||||
= 3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044
|
||||
|
||||
|
||||
hashOutputs:
|
||||
dSHA256(010000000000000000)
|
||||
= e5d196bfb21caca9dbd654cafb3b4dc0c4882c8927d2eb300d9539dd0b934228
|
||||
|
||||
|
||||
hash preimage: 01000000b67c76d200c6ce72962d919dc107884b9d5d0e26f2aea7474b46a1904c53359f3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e7066504469c12106097dc2e0526493ef67f21269fe888ef05c7a3a5dacab38e1ac8387f14c1d00004aad4830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e01400d030000000000ffffffffe5d196bfb21caca9dbd654cafb3b4dc0c4882c8927d2eb300d9539dd0b9342280000000001000000
|
||||
|
||||
|
||||
nVersion: 01000000
|
||||
hashPrevouts: b67c76d200c6ce72962d919dc107884b9d5d0e26f2aea7474b46a1904c53359f
|
||||
hashSequence: 3bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e70665044
|
||||
@ -581,11 +581,11 @@ These examples show that <code>FindAndDelete</code> for the signature is not app
|
||||
hashOutputs: e5d196bfb21caca9dbd654cafb3b4dc0c4882c8927d2eb300d9539dd0b934228
|
||||
nLockTime: 00000000
|
||||
nHashType: 01000000
|
||||
|
||||
|
||||
sigHash: 71c9cd9b2869b9c70b01b1f0360c148f42dee72297db312638df136f43311f23
|
||||
signature: 30450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e 01
|
||||
pubkey: 02a9781d66b61fb5a7ef00ac5ad5bc6ffc78be7b44a566e3c87870e1079368df4c
|
||||
|
||||
|
||||
The serialized signed transaction is: 0100000000010169c12106097dc2e0526493ef67f21269fe888ef05c7a3a5dacab38e1ac8387f14c1d000000ffffffff01010000000000000000034830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e012102a9781d66b61fb5a7ef00ac5ad5bc6ffc78be7b44a566e3c87870e1079368df4c4aad4830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e0100000000
|
||||
|
||||
nVersion: 01000000
|
||||
@ -597,11 +597,11 @@ These examples show that <code>FindAndDelete</code> for the signature is not app
|
||||
2102a9781d66b61fb5a7ef00ac5ad5bc6ffc78be7b44a566e3c87870e1079368df4c
|
||||
4aad4830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e01
|
||||
nLockTime: 00000000
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
The following transaction is a <code>OP_CHECKMULTISIGVERIFY</code> version of the <code>FindAndDelete</code> examples: 010000000001019275cb8d4a485ce95741c013f7c0d28722160008021bb469a11982d47a6628964c1d000000ffffffff0101000000000000000007004830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e0148304502205286f726690b2e9b0207f0345711e63fa7012045b9eb0f19c2458ce1db90cf43022100e89f17f86abc5b149eba4115d4f128bcf45d77fb3ecdd34f594091340c0395960101022102966f109c54e85d3aee8321301136cedeb9fc710fdef58a9de8a73942f8e567c021034ffc99dd9a79dd3cb31e2ab3e0b09e0e67db41ac068c625cd1f491576016c84e9552af4830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e0148304502205286f726690b2e9b0207f0345711e63fa7012045b9eb0f19c2458ce1db90cf43022100e89f17f86abc5b149eba4115d4f128bcf45d77fb3ecdd34f594091340c039596017500000000
|
||||
|
||||
|
||||
redeemScript: OP_2 OP_CHECKMULTISIGVERIFY <30450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e01> <304502205286f726690b2e9b0207f0345711e63fa7012045b9eb0f19c2458ce1db90cf43022100e89f17f86abc5b149eba4115d4f128bcf45d77fb3ecdd34f594091340c03959601>
|
||||
hash preimage: 0100000039283953eb1e26994dde57b7f9362a79a8c523e2f8deba943c27e826a005f1e63bb13029ce7b1f559ef5e747fcac439f1455a2ec7c5f09b72290795e706650449275cb8d4a485ce95741c013f7c0d28722160008021bb469a11982d47a6628964c1d00009552af4830450220487fb382c4974de3f7d834c1b617fe15860828c7f96454490edd6d891556dcc9022100baf95feb48f845d5bfc9882eb6aeefa1bc3790e39f59eaa46ff7f15ae626c53e0148304502205286f726690b2e9b0207f0345711e63fa7012045b9eb0f19c2458ce1db90cf43022100e89f17f86abc5b149eba4115d4f128bcf45d77fb3ecdd34f594091340c0395960175400d030000000000ffffffffe5d196bfb21caca9dbd654cafb3b4dc0c4882c8927d2eb300d9539dd0b9342280000000001000000
|
||||
sighash: c1628a1e7c67f14ca0c27c06e4fdeec2e6d1a73c7a91d7c046ff83e835aebb72
|
||||
@ -618,7 +618,7 @@ The new serialization format is described in BIP144 <ref>[[bip-0144.mediawiki|BI
|
||||
|
||||
== Deployment ==
|
||||
|
||||
This proposal is deployed with Segregated Witness softfork (BIP 141)
|
||||
This proposal is deployed with Segregated Witness softfork (BIP 141)
|
||||
|
||||
== Backward compatibility ==
|
||||
|
||||
|
@ -79,7 +79,7 @@ The serialization has the following structure:
|
||||
|
||||
Parsers supporting this BIP will be able to distinguish between the old serialization format (without the witness) and this one. The marker byte is set to zero so that this structure will never parse as a valid transaction in a parser that does not support this BIP. If parsing were to succeed, such a transaction would contain no inputs and a single output.
|
||||
|
||||
If the witness is empty, the old serialization format must be used.
|
||||
If the witness is empty, the old serialization format must be used.
|
||||
|
||||
Currently, the only witness objects type supported are script witnesses which consist of a stack of byte arrays. It is encoded as a var_int item count followed by each item encoded as a var_int length followed by a string of bytes. Each txin has its own script witness. The number of script witnesses is not explicitly encoded as it is implied by txin_count. Empty script witnesses are encoded as a zero byte. The order of the script witnesses follows the same order as the associated txins.
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Jonas Schnelli <dev@jonasschnelli.ch>
|
||||
Comments-Summary: Discouraged for implementation (one person)
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0150
|
||||
Status: Draft
|
||||
Status: Deferred
|
||||
Type: Standards Track
|
||||
Created: 2016-03-23
|
||||
License: PD
|
||||
|
@ -5,10 +5,11 @@
|
||||
Author: Jonas Schnelli <dev@jonasschnelli.ch>
|
||||
Comments-Summary: Controversial; some recommendation, and some discouragement
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0151
|
||||
Status: Withdrawn
|
||||
Status: Replaced
|
||||
Type: Standards Track
|
||||
Created: 2016-03-23
|
||||
License: PD
|
||||
Superseded-By: 324
|
||||
</pre>
|
||||
|
||||
== Abstract ==
|
||||
@ -84,7 +85,7 @@ a 64 bit nonce and a 64 bit counter into 64 bytes of output. This output is used
|
||||
Poly1305, also by Daniel Bernstein [4], is a one-time Carter-Wegman MAC that computes a 128 bit integrity tag given a message and a single-use
|
||||
256 bit secret key.
|
||||
|
||||
The chacha20-poly1305@openssh.com specified and defined by openssh [5] combines these two primitives into an authenticated encryption mode. The construction used is based on that proposed for TLS by Adam Langley [6], but differs in the layout of data passed to the MAC and in the addition of encyption of the packet lengths.
|
||||
The chacha20-poly1305@openssh.com specified and defined by openssh [5] combines these two primitives into an authenticated encryption mode. The construction used is based on that proposed for TLS by Adam Langley [6], but differs in the layout of data passed to the MAC and in the addition of encryption of the packet lengths.
|
||||
|
||||
<code>K_1</code> must be used to only encrypt the payload size of the encrypted message to avoid leaking information by revealing the message size.
|
||||
|
||||
|
@ -209,9 +209,9 @@ There are several design goals for the Short ID calculation:
|
||||
* '''Space''' cmpctblock messages are never optional in this protocol, and contain a short ID for each non-prefilled transaction in the block. Thus, the size of short IDs is directly proportional to the maximum bandwidth savings possible.
|
||||
* '''Collision resistance''' It should be hard for network participants to create transactions that cause collisions. If an attacker were able to cause such collisions, filling mempools (and, thus, blocks) with them would cause poor network propagation of new (or non-attacker, in the case of a miner) blocks.
|
||||
|
||||
SipHash is a secure, fast, and simple 64-bit MAC designed for network traffic authentication and collision-resistant hash tables. We truncate the output from SipHash-2-4 to 48 bits (see next section) in order to minimize space. The resulting 48-bit hash is certainly not large enough to avoid intentionally created individual collisons, but by using the block hash as a key to SipHash, an attacker cannot predict what keys will be used once their transactions are actually included in a relayed block. We mix in a per-connection 64-bit nonce to obtain independent short IDs on every connection, so that even block creators cannot control where collisions occur, and random collisions only ever affect a small number of connections at any given time. The mixing is done using SHA256(block_header || nonce), which is slow compared to SipHash, but only done once per block. It also adds the ability for nodes to choose the nonce in a better than random way to minimize collisions, though that is not necessary for correct behaviour. Conversely, nodes can also abuse this ability to increase their ability to introduce collisions in the blocks they relay themselves. However, they can already cause more problems by simply refusing to relay blocks. That is inevitable, and this design only seeks to prevent network-wide misbehavior.
|
||||
SipHash is a secure, fast, and simple 64-bit MAC designed for network traffic authentication and collision-resistant hash tables. We truncate the output from SipHash-2-4 to 48 bits (see next section) in order to minimize space. The resulting 48-bit hash is certainly not large enough to avoid intentionally created individual collisions, but by using the block hash as a key to SipHash, an attacker cannot predict what keys will be used once their transactions are actually included in a relayed block. We mix in a per-connection 64-bit nonce to obtain independent short IDs on every connection, so that even block creators cannot control where collisions occur, and random collisions only ever affect a small number of connections at any given time. The mixing is done using SHA256(block_header || nonce), which is slow compared to SipHash, but only done once per block. It also adds the ability for nodes to choose the nonce in a better than random way to minimize collisions, though that is not necessary for correct behaviour. Conversely, nodes can also abuse this ability to increase their ability to introduce collisions in the blocks they relay themselves. However, they can already cause more problems by simply refusing to relay blocks. That is inevitable, and this design only seeks to prevent network-wide misbehavior.
|
||||
|
||||
====Random collision probabilty====
|
||||
====Random collision probability====
|
||||
|
||||
Thanks to the block-header-based SipHash keys, we can assume that the only collisions on links between honest nodes are random ones.
|
||||
|
||||
|
@ -71,7 +71,7 @@ solve the challenge and reconnect, or discard it and find a different peer (or w
|
||||
|
||||
There are two POW identifiers currently. When a new identifier is introduced, it should be added with an increment of 1
|
||||
to the last identifier in the list. When an identifier is deprecated, its status should be changed to <code>Deprecated</code> but it should
|
||||
retain its place in the list indefinitely.
|
||||
retain its place in the list indefinitely.
|
||||
|
||||
{|class="wikitable"
|
||||
! ID !! Algorithm Name !! Work !! Param size !! Solution size !! Provably Secure !! SPH Resistance !! Status
|
||||
@ -173,7 +173,7 @@ Additional notes:
|
||||
There is only one Purpose Identifier currently. In the future, more Purpose Identifiers could be added for at-DoS-risk operations,
|
||||
such as bloom filters. When a new identifier is introduced, it should be added with an increment of 1 to the last identifier in the
|
||||
list. When an identifier is deprecated, its status should be changed to <code>Deprecated</code> but it should retain its place in
|
||||
the list indefinitely.
|
||||
the list indefinitely.
|
||||
|
||||
{|class="wikitable"
|
||||
! ID !! Purpose Name !! Description !! Status
|
||||
@ -236,7 +236,7 @@ Normally mid-layer (all but the last) POW algorithms have a zero-length input. E
|
||||
|-
|
||||
| 1..4 || pow-id || 1 || sha256
|
||||
|-
|
||||
| 5 || pow-params (config_length) || 9 ||
|
||||
| 5 || pow-params (config_length) || 9 ||
|
||||
|-
|
||||
| 6..9 || pow-params (target) || 0x207fffff || Resulting hash must be <= the compact hash 0x207fffff*
|
||||
|-
|
||||
@ -248,7 +248,7 @@ Normally mid-layer (all but the last) POW algorithms have a zero-length input. E
|
||||
|-
|
||||
| 19..22 || pow-id || 2 || cuckoo-cycle
|
||||
|-
|
||||
| 23 || pow-params (config_length) || 8 ||
|
||||
| 23 || pow-params (config_length) || 8 ||
|
||||
|-
|
||||
| 24 || pow-params (sizeshift) || 28
|
||||
|-
|
||||
|
@ -44,7 +44,7 @@ interpreted as described in RFC 2119<ref>[https://tools.ietf.org/html/rfc2119 RF
|
||||
|
||||
The <code>addrv2</code> message is defined as a message where <code>pchCommand == "addrv2"</code>.
|
||||
It is serialized in the standard encoding for P2P messages.
|
||||
Its format is similar to the current <code>addr</code> message format, with the difference that the
|
||||
Its format is similar to the current <code>addr</code> message format, with the difference that the
|
||||
fixed 16-byte IP address is replaced by a network ID and a variable-length address, and the services format has been changed to [https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer CompactSize].
|
||||
|
||||
This means that the message contains a serialized <code>std::vector</code> of the following structure:
|
||||
@ -117,6 +117,11 @@ The list of reserved network IDs is as follows:
|
||||
| <code>CJDNS</code>
|
||||
| 16
|
||||
| Cjdns overlay network address
|
||||
|-
|
||||
| <code>0x07</code>
|
||||
| <code>YGGDRASIL</code>
|
||||
| 16
|
||||
| Yggdrasil overlay network address
|
||||
|}
|
||||
|
||||
Clients are RECOMMENDED to gossip addresses from all known networks even if they are currently not connected to some of them. That could help multi-homed nodes and make it more difficult for an observer to tell which networks a node is connected to.
|
||||
@ -184,6 +189,10 @@ I2P addresses MUST be sent with the <code>I2P</code> network ID, with the decode
|
||||
|
||||
Cjdns addresses are simply IPv6 addresses in the <code>fc00::/8</code> range<ref>[https://github.com/cjdelisle/cjdns/blob/6e46fa41f5647d6b414612d9d63626b0b952746b/doc/Whitepaper.md#pulling-it-all-together Cjdns whitepaper: Pulling It All Together]</ref>. They MUST be sent with the <code>CJDNS</code> network ID.
|
||||
|
||||
==Appendix E: Yggdrasil address encoding==
|
||||
|
||||
Yggdrasil addresses are simply IPv6 addresses in the <code>0200::/7</code> range<ref>[https://yggdrasil-network.github.io/faq.html#will-yggdrasil-conflict-with-my-network-routing Yggdrasil FAQ]</ref>. They MUST be sent with the <code>YGGDRASIL</code> network ID.
|
||||
|
||||
==References==
|
||||
|
||||
<references/>
|
||||
|
@ -109,7 +109,7 @@ Figure 3
|
||||
|
||||
To avoid this issue, we suggest "per-inbound-edge" routing. Each inbound peer is
|
||||
assigned a particular Dandelion destination. Each Dandelion transaction that
|
||||
arrives via this peer is forwarded to the same Dandelion destination.
|
||||
arrives via this peer is forwarded to the same Dandelion destination.
|
||||
Per-inbound-edge routing breaks the described attack by blocking an adversary's
|
||||
ability to construct useful fingerprints. Fingerprints arise when routing
|
||||
decisions are made independently per transaction at each node. In this case, two
|
||||
|
@ -396,7 +396,7 @@ Once the client has downloaded and verified all filter headers needed, ''and''
|
||||
no outbound peers have sent conflicting headers, the client can download the
|
||||
actual block filters it needs. The client MAY backfill filter headers before the
|
||||
first verified one at this point if it only downloaded them starting at a later
|
||||
point. Clients SHOULD persist the verified filter headers for last 100 blocks in
|
||||
point. Clients SHOULD persist the verified filter headers for the last 100 blocks in
|
||||
the chain (or whatever finality depth is desired), to compare against headers
|
||||
received from new peers after restart. They MAY store more filter headers to
|
||||
avoid redownloading them if a rescan is later necessary.
|
||||
|
@ -39,9 +39,6 @@ that is designed to reduce the filter size for regular wallets.
|
||||
''CompactSize'' is a compact encoding of unsigned integers used in the Bitcoin
|
||||
P2P protocol.
|
||||
|
||||
''Data pushes'' are byte vectors pushed to the stack according to the rules of
|
||||
Bitcoin script.
|
||||
|
||||
''Bit streams'' are readable and writable streams of individual bits. The
|
||||
following functions are used in the pseudocode in this document:
|
||||
* <code>new_bit_stream</code> instantiates a new writable bit stream
|
||||
@ -85,7 +82,7 @@ one is able to select both Parameters independently, then more optimal values
|
||||
can be
|
||||
selected<ref>https://gist.github.com/sipa/576d5f09c3b86c3b1b75598d799fc845</ref>.
|
||||
Set membership queries against the hash outputs will have a false positive rate
|
||||
of <code>M</code>. To avoid integer overflow, the number of items <code>N</code>
|
||||
of <code>1 / M</code>. To avoid integer overflow, the number of items <code>N</code>
|
||||
MUST be <2^32 and <code>M</code> MUST be <2^32.
|
||||
|
||||
The items are first passed through the pseudorandom function ''SipHash'', which
|
||||
@ -189,7 +186,7 @@ golomb_decode(stream, P: uint) -> uint64:
|
||||
A GCS is constructed from four parameters:
|
||||
* <code>L</code>, a vector of <code>N</code> raw items
|
||||
* <code>P</code>, the bit parameter of the Golomb-Rice coding
|
||||
* <code>M</code>, the target false positive rate
|
||||
* <code>M</code>, the inverse of the target false positive rate
|
||||
* <code>k</code>, the 128-bit key used to randomize the SipHash outputs
|
||||
|
||||
The result is a byte vector with a minimum size of <code>N * (P + 1)</code>
|
||||
@ -273,10 +270,8 @@ This BIP defines one initial filter type:
|
||||
The basic filter is designed to contain everything that a light client needs to
|
||||
sync a regular Bitcoin wallet. A basic filter MUST contain exactly the
|
||||
following items for each transaction in a block:
|
||||
* The previous output script (the script being spent) for each input, except
|
||||
for the coinbase transaction.
|
||||
* The scriptPubKey of each output, aside from all <code>OP_RETURN</code> output
|
||||
scripts.
|
||||
* The previous output script (the script being spent) for each input, except for the coinbase transaction.
|
||||
* The scriptPubKey of each output, aside from all <code>OP_RETURN</code> output scripts.
|
||||
|
||||
Any "nil" items MUST NOT be included into the final set of filter elements.
|
||||
|
||||
@ -314,6 +309,8 @@ complete serialization of a filter is:
|
||||
* <code>N</code>, encoded as a <code>CompactSize</code>
|
||||
* The bytes of the compressed filter itself
|
||||
|
||||
A zero element filter MUST be written as one byte containing zeroes.
|
||||
|
||||
==== Signaling ====
|
||||
|
||||
This BIP allocates a new service bit:
|
||||
@ -347,7 +344,7 @@ Light client: [https://github.com/lightninglabs/neutrino]
|
||||
|
||||
Full-node indexing: https://github.com/Roasbeef/btcd/tree/segwit-cbf
|
||||
|
||||
Golomb-Rice Coded sets: https://github.com/btcsuite/btcutil/blob/master/gcs
|
||||
Golomb-Rice Coded sets: https://github.com/btcsuite/btcd/tree/master/btcutil/gcs
|
||||
|
||||
== Appendix A: Alternatives ==
|
||||
|
||||
|
@ -37,7 +37,7 @@ var (
|
||||
{49291, "Tx pays to empty output script"},
|
||||
{180480, "Tx spends from empty output script"},
|
||||
{926485, "Duplicate pushdata 913bcc2be49cb534c20474c4dee1e9c4c317e7eb"},
|
||||
{987876, "Coinbase tx has unparseable output script"},
|
||||
{987876, "Coinbase tx has unparsable output script"},
|
||||
{1263442, "Includes witness data"},
|
||||
{1414221, "Empty data"},
|
||||
}
|
||||
@ -207,7 +207,7 @@ func main() {
|
||||
|
||||
prevOutputScripts, err := fetchPrevOutputScripts(client, block)
|
||||
if err != nil {
|
||||
fmt.Println("Couldn't fetch prev output scipts: ", err)
|
||||
fmt.Println("Couldn't fetch prev output scripts: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ func main() {
|
||||
}
|
||||
|
||||
// We'll now ensure that we've constructed the same filter as
|
||||
// the chain server we're fetching blocks form.
|
||||
// the chain server we're fetching blocks from.
|
||||
filter, err := client.GetCFilter(
|
||||
blockHash, wire.GCSFilterRegular,
|
||||
)
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Jonas Schnelli <dev@jonasschnelli.ch>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0159
|
||||
Status: Draft
|
||||
Status: Final
|
||||
Type: Standards Track
|
||||
Created: 2017-05-11
|
||||
License: BSD-2-Clause
|
||||
@ -50,7 +50,7 @@ Pruned peers following this BIP may consume more outbound bandwidth.
|
||||
|
||||
Light clients (and such) who are not checking the <code>nServiceFlags</code> (service bits) from a relayed <code>addr</code>-message may unwillingly connect to a pruned peer and ask for (filtered) blocks at a depth below their pruned depth. Light clients should therefore check the service bits (and eventually connect to peers signaling <code>NODE_NETWORK_LIMITED</code> if they require [filtered] blocks around the tip). Light clients obtaining peer IPs though DNS seed should use the DNS filtering option.
|
||||
|
||||
== Compatibility ==
|
||||
== Compatibility ==
|
||||
|
||||
This proposal is backward compatible.
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
Created: 2017-03-20
|
||||
License: BSD-2-Clause
|
||||
Replaces: 142
|
||||
Superseded-By: 350
|
||||
</pre>
|
||||
|
||||
==Introduction==
|
||||
@ -403,3 +404,12 @@ separator).
|
||||
This document is inspired by the [https://rusty.ozlabs.org/?p=578 address proposal] by Rusty Russell, the
|
||||
[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2014-February/004402.html base32] proposal by Mark Friedenbach, and had input from Luke Dashjr,
|
||||
Johnson Lau, Eric Lombrozo, Peter Todd, and various other reviewers.
|
||||
|
||||
==Disclosures (added 2024)==
|
||||
|
||||
Due to an oversight in the design of bech32, this checksum scheme is not always
|
||||
robust against
|
||||
[[https://gist.github.com/sipa/a9845b37c1b298a7301c33a04090b2eb|the insertion
|
||||
and deletion of fewer than 5 consecutive characters]]. Due to this weakness,
|
||||
[[bip-0350.mediawiki|BIP-350]] proposes using the scheme described in this BIP
|
||||
only for Native Segwit v0 outputs.
|
||||
|
@ -2,7 +2,7 @@
|
||||
BIP: 174
|
||||
Layer: Applications
|
||||
Title: Partially Signed Bitcoin Transaction Format
|
||||
Author: Andrew Chow <achow101@gmail.com>
|
||||
Author: Ava Chow <me@achow101.com>
|
||||
Comments-Summary: No comments yet.
|
||||
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0174
|
||||
Status: Final
|
||||
@ -120,7 +120,7 @@ The currently defined global types are as follows:
|
||||
| <tt>PSBT_GLOBAL_TX_VERSION = 0x02</tt>
|
||||
| None
|
||||
| No key data
|
||||
| <tt><32-bit little endian uint version></tt>
|
||||
| <tt><32-bit little endian int version></tt>
|
||||
| The 32-bit little endian signed integer representing the version number of the transaction being created. Note that this is not the same as the PSBT version number specified by the PSBT_GLOBAL_VERSION field.
|
||||
| 2
|
||||
| 0
|
||||
@ -171,6 +171,28 @@ The currently defined global types are as follows:
|
||||
| 2
|
||||
| [[bip-0370.mediawiki|370]]
|
||||
|-
|
||||
| Silent Payment Global ECDH Share
|
||||
| <tt>PSBT_GLOBAL_SP_ECDH_SHARE = 0x07</tt>
|
||||
| <tt><33 byte scan key></tt>
|
||||
| The scan key that this ECDH share is for.
|
||||
| <tt><33 byte share></tt>
|
||||
| An ECDH share for a scan key. The ECDH shared is computed with ''a * B_scan'', where ''a'' is the sum of all private keys of all eligible inputs, and ''B_scan'' is the scan key of a recipient.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| Silent Payment Global DLEQ Proof
|
||||
| <tt>PSBT_GLOBAL_SP_DLEQ = 0x08</tt>
|
||||
| <tt><33 byte scan key></tt>
|
||||
| The scan key that this proof covers.
|
||||
| <tt><64-byte proof></tt>
|
||||
| A BIP374 DLEQ proof computed for the matching ECDH share.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| PSBT Version Number
|
||||
| <tt>PSBT_GLOBAL_VERSION = 0xFB</tt>
|
||||
| None
|
||||
@ -410,7 +432,7 @@ The currently defined per-input types are defined as follows:
|
||||
| <tt>PSBT_IN_REQUIRED_HEIGHT_LOCKTIME = 0x12</tt>
|
||||
| None
|
||||
| No key data
|
||||
| <tt><32-bit uiht locktime></tt>
|
||||
| <tt><32-bit uint locktime></tt>
|
||||
| 32 bit unsigned little endian integer less than 500000000 representing the minimum block height that this input requires to be set as the transaction's lock time.
|
||||
|
|
||||
| 0
|
||||
@ -453,7 +475,7 @@ The currently defined per-input types are defined as follows:
|
||||
| Taproot Key BIP 32 Derivation Path
|
||||
| <tt>PSBT_IN_TAP_BIP32_DERIVATION = 0x16</tt>
|
||||
| <tt><32 byte xonlypubkey></tt>
|
||||
| A 32 byte X-only public key involved in this input. It may be the internal key, or a key present in a leaf script.
|
||||
| A 32 byte X-only public key involved in this input. It may be the output key, the internal key, or a key present in a leaf script.
|
||||
| <tt><compact size uint number of hashes> <32 byte leaf hash>* <4 byte fingerprint> <32-bit little endian uint path element>*</tt>
|
||||
| A compact size unsigned integer representing the number of leaf hashes, followed by a list of leaf hashes, followed by the 4 byte master key fingerprint concatenated with the derivation path of the public key. The derivation path is represented as 32-bit little endian unsigned integer indexes concatenated with each other. Public keys are those needed to spend this output. The leaf hashes are of the leaves which involve this public key. The internal key does not have leaf hashes, so can be indicated with a <tt>hashes len</tt> of 0. Finalizers should remove this field after <tt>PSBT_IN_FINAL_SCRIPTWITNESS</tt> is constructed.
|
||||
|
|
||||
@ -483,6 +505,74 @@ The currently defined per-input types are defined as follows:
|
||||
| 0, 2
|
||||
| [[bip-0371.mediawiki|371]]
|
||||
|-
|
||||
| MuSig2 Participant Public Keys
|
||||
| <tt>PSBT_IN_MUSIG2_PARTICIPANT_PUBKEYS = 0x1a</tt>
|
||||
| <33 byte plain aggregate pubkey>
|
||||
| The MuSig2 aggregate plain public key from the <tt>KeyAgg</tt> algorithm. This key may or may not
|
||||
be in the script directly (as x-only). It may instead be a parent public key from which the public keys in the
|
||||
script were derived.
|
||||
| <tt><33 byte compressed pubkey>*</tt>
|
||||
| A list of the compressed public keys of the participants in the MuSig2 aggregate key in the order
|
||||
required for aggregation. If sorting was done, then the keys must be in the sorted order.
|
||||
|
|
||||
|
|
||||
| 0, 2
|
||||
| [[bip-0373.mediawiki|373]]
|
||||
|-
|
||||
| MuSig2 Public Nonce
|
||||
| <tt>PSBT_IN_MUSIG2_PUB_NONCE = 0x1b</tt>
|
||||
| <tt><33 byte compressed pubkey> <33 byte plain pubkey> <32 byte hash or omitted></tt>
|
||||
| The compressed public key of the participant providing this nonce, followed by the plain public
|
||||
key the participant is providing the nonce for, followed by the BIP 341 tapleaf hash of
|
||||
the Taproot leaf script that will be signed. If the aggregate key is the taproot internal key or the
|
||||
taproot output key, then the tapleaf hash must be omitted. The plain public key must be
|
||||
the key found in the script and not the aggregate public key that it was derived from, if it was
|
||||
derived from an aggregate key.
|
||||
| <tt><66 byte public nonce></tt>
|
||||
| The public nonce produced by the <tt>NonceGen</tt> algorithm.
|
||||
|
|
||||
|
|
||||
| 0, 2
|
||||
| [[bip-0373.mediawiki|373]]
|
||||
|-
|
||||
| MuSig2 Participant Partial Signature
|
||||
| <tt>PSBT_IN_MUSIG2_PARTIAL_SIG = 0x1c</tt>
|
||||
| <tt><33 byte compressed pubkey> <33 byte plain pubkey> <32 byte hash or omitted></tt>
|
||||
| The compressed public key of the participant providing this partial signature, followed by the
|
||||
plain public key the participant is providing the signature for, followed by the BIP 341 tapleaf hash
|
||||
of the Taproot leaf script that will be signed. If the aggregate key is the taproot internal key or
|
||||
the taproot output key, then the tapleaf hash must be omitted. Note that the plain public key must
|
||||
be the key found in the script and not the aggregate public key that it was derived from, if it was
|
||||
derived from an aggregate key.
|
||||
| <tt><32 byte partial signature></tt>
|
||||
| The partial signature produced by the <tt>Sign</tt> algorithm.
|
||||
|
|
||||
|
|
||||
| 0, 2
|
||||
| [[bip-0373.mediawiki|373]]
|
||||
|-
|
||||
| Silent Payment Input ECDH Share
|
||||
| <tt>PSBT_IN_SP_ECDH_SHARE = 0x1d</tt>
|
||||
| <tt><33 byte scan key></tt>
|
||||
| The scan key that this ECDH share is for.
|
||||
| <tt><33 byte share></tt>
|
||||
| An ECDH share for a scan key. The ECDH shared is computed with ''a * B_scan'', where ''a'' is the private key of the corresponding prevout public key, and ''B_scan'' is the scan key of a recipient.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| Silent Payment Input DLEQ Proof
|
||||
| <tt>PSBT_IN_SP_DLEQ = 0x1e</tt>
|
||||
| <tt><33 byte scan key></tt>
|
||||
| The scan key that this proof covers.
|
||||
| <tt><64-byte proof></tt>
|
||||
| A BIP374 DLEQ proof computed for the matching ECDH share.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| Proprietary Use Type
|
||||
| <tt>PSBT_IN_PROPRIETARY = 0xFC</tt>
|
||||
| <tt><compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata></tt>
|
||||
@ -560,11 +650,11 @@ determine which outputs are change outputs and verify that the change is returni
|
||||
| None
|
||||
| No key data
|
||||
| <tt><bytes script></tt>
|
||||
| The script for this output, also known as the scriptPubKey. Must be omitted in PSBTv0. Must be provided in PSBTv2.
|
||||
| 2
|
||||
| The script for this output, also known as the scriptPubKey. Must be omitted in PSBTv0. Must be provided in PSBTv2 if not sending to a BIP352 silent payment address, otherwise may be omitted.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0370.mediawiki|370]]
|
||||
| [[bip-0370.mediawiki|370]], [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| Taproot Internal Key
|
||||
| <tt>PSBT_OUT_TAP_INTERNAL_KEY = 0x05</tt>
|
||||
@ -591,7 +681,7 @@ determine which outputs are change outputs and verify that the change is returni
|
||||
| Taproot Key BIP 32 Derivation Path
|
||||
| <tt>PSBT_OUT_TAP_BIP32_DERIVATION = 0x07</tt>
|
||||
| <tt><32 byte xonlypubkey></tt>
|
||||
| A 32 byte X-only public key involved in this output. It may be the internal key, or a key present in a leaf script.
|
||||
| A 32 byte X-only public key involved in this output. It may be the output key, the internal key, or a key present in a leaf script.
|
||||
| <tt><compact size uint number of hashes> <32 byte leaf hash>* <4 byte fingerprint> <32-bit little endian uint path element>*</tt>
|
||||
| A compact size unsigned integer representing the number of leaf hashes, followed by a list of leaf hashes, followed by the 4 byte master key fingerprint concatenated with the derivation path of the public key. The derivation path is represented as 32-bit little endian unsigned integer indexes concatenated with each other. Public keys are those needed to spend this output. The leaf hashes are of the leaves which involve this public key. The internal key does not have leaf hashes, so can be indicated with a <tt>hashes len</tt> of 0. Finalizers should remove this field after <tt>PSBT_IN_FINAL_SCRIPTWITNESS</tt> is constructed.
|
||||
|
|
||||
@ -599,6 +689,54 @@ determine which outputs are change outputs and verify that the change is returni
|
||||
| 0, 2
|
||||
| [[bip-0371.mediawiki|371]]
|
||||
|-
|
||||
| MuSig2 Participant Public Keys
|
||||
| <tt>PSBT_OUT_MUSIG2_PARTICIPANT_PUBKEYS = 0x08</tt>
|
||||
| <33 byte plain aggregate pubkey>
|
||||
| The MuSig2 aggregate plain public key from the <tt>KeyAgg</tt> algorithm. This key may or may not
|
||||
be in the script directly. It may instead be a parent public key from which the public keys in the
|
||||
script were derived.
|
||||
| <tt><33 byte compressed pubkey>*</tt>
|
||||
| A list of the compressed public keys of the participants in the MuSig2 aggregate key in the order
|
||||
required for aggregation. If sorting was done, then the keys must be in the sorted order.
|
||||
|
|
||||
|
|
||||
| 0, 2
|
||||
| [[bip-0373.mediawiki|373]]
|
||||
|-
|
||||
| Silent Payment Data
|
||||
| <tt>PSBT_OUT_SP_V0_INFO = 0x09</tt>
|
||||
| None
|
||||
| No key data
|
||||
| <tt><33 byte scan key> <33 byte spend key></tt>
|
||||
| The scan and spend public keys from the silent payments address.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| Silent Payment Label
|
||||
| <tt>PSBT_OUT_SP_V0_LABEL = 0x10</tt>
|
||||
| None
|
||||
| No key data
|
||||
| <tt><32-bit little endian uint label></tt>
|
||||
| The label to use to compute the spend key of the silent payments address to verify change.
|
||||
|
|
||||
| 0
|
||||
| 2
|
||||
| [[bip-0375.mediawiki|375]]
|
||||
|-
|
||||
| BIP 353 DNSSEC proof
|
||||
| <tt>PSBT_OUT_DNSSEC_PROOF = 0x35</tt>
|
||||
| None
|
||||
| No key data
|
||||
| <tt><1-byte-length-prefixed BIP 353 human-readable name><RFC 9102-formatted AuthenticationChain DNSSEC Proof></tt>
|
||||
| A BIP 353 human-readable name (without the ₿ prefix), prefixed by a 1-byte length.
|
||||
Followed by an [[https://www.rfc-editor.org/rfc/rfc9102.html#name-dnssec-authentication-chain|RFC 9102 DNSSEC <tt>AuthenticationChain</tt>]] (i.e. a series of DNS Resource Records in no particular order) providing a DNSSEC proof to a BIP 353 DNS TXT record.
|
||||
|
|
||||
|
|
||||
| 0, 2
|
||||
| [[bip-0353.mediawiki|353]]
|
||||
|-
|
||||
| Proprietary Use Type
|
||||
| <tt>PSBT_OUT_PROPRIETARY = 0xFC</tt>
|
||||
| <tt><compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata></tt>
|
||||
@ -633,7 +771,7 @@ values are valid, then it does not matter which is chosen as either way the tran
|
||||
===Proprietary Use Type===
|
||||
|
||||
For all global, per-input, and per-output maps, the type <tt>0xFC</tt> is reserved for proprietary use.
|
||||
The proprietary use type requires keys that follow the type with a compact size unsigned integer representing the length of the string identifer, followed by the string identifier, then a subtype, and finally any key data.
|
||||
The proprietary use type requires keys that follow the type with a compact size unsigned integer representing the length of the string identifier, followed by the string identifier, then a subtype, and finally any key data.
|
||||
|
||||
The identifier can be any variable length string that software can use to identify whether the particular data in the proprietary type can be used by it.
|
||||
It can also be the empty string although this is not recommended.
|
||||
@ -718,15 +856,8 @@ sign_non_witness(script_code, i):
|
||||
if IsMine(key) and IsAcceptable(sighash_type):
|
||||
sign(non_witness_sighash(script_code, i, input))
|
||||
|
||||
for input,i in enumerate(psbt.inputs):
|
||||
if non_witness_utxo.exists:
|
||||
assert(sha256d(non_witness_utxo) == psbt.tx.input[i].prevout.hash)
|
||||
if redeemScript.exists:
|
||||
assert(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey == P2SH(redeemScript))
|
||||
sign_non_witness(redeemScript, i)
|
||||
else:
|
||||
sign_non_witness(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey, i)
|
||||
else if witness_utxo.exists:
|
||||
for input, i in enumerate(psbt.inputs):
|
||||
if witness_utxo.exists:
|
||||
if redeemScript.exists:
|
||||
assert(witness_utxo.scriptPubKey == P2SH(redeemScript))
|
||||
script = redeemScript
|
||||
@ -737,6 +868,13 @@ for input,i in enumerate(psbt.inputs):
|
||||
else if IsP2WSH(script):
|
||||
assert(script == P2WSH(witnessScript))
|
||||
sign_witness(witnessScript, i)
|
||||
else if non_witness_utxo.exists:
|
||||
assert(sha256d(non_witness_utxo) == psbt.tx.input[i].prevout.hash)
|
||||
if redeemScript.exists:
|
||||
assert(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey == P2SH(redeemScript))
|
||||
sign_non_witness(redeemScript, i)
|
||||
else:
|
||||
sign_non_witness(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey, i)
|
||||
else:
|
||||
assert False
|
||||
</pre>
|
||||
@ -800,7 +938,7 @@ A MIME type name will be added to this document once one has been registered.
|
||||
==Extensibility==
|
||||
|
||||
The Partially Signed Transaction format can be extended in the future by adding
|
||||
new types for key-value pairs. Backwards compatibilty will still be maintained as those new
|
||||
new types for key-value pairs. Backwards compatibility will still be maintained as those new
|
||||
types will be ignored and passed-through by signers which do not know about them.
|
||||
|
||||
===Version Numbers===
|
||||
@ -821,7 +959,7 @@ If a field requires significant description as to its usage, it should be accomp
|
||||
The field must be added to the field listing tables in the Specification section.
|
||||
Although some PSBT version 0 implementations encode types as uint8_t rather than compact size,
|
||||
it is still safe to add >0xFD fields to PSBT 0, because these old parsers ignore
|
||||
unknown fields, and <keytype> is prefixed by its length.
|
||||
unknown fields, and <keytype> is prefixed by its length.
|
||||
|
||||
===Procedure For New Versions===
|
||||
|
||||
|
9
bip-0174/build.sh
Executable file
9
bip-0174/build.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
pdflatex -output-format=pdf coinjoin-workflow.tex && \
|
||||
inkscape --with-gui --export-text-to-path \
|
||||
--export-plain-svg=coinjoin-workflow.svg coinjoin-workflow.pdf && \
|
||||
pdflatex -output-format=pdf multisig-workflow.tex && \
|
||||
inkscape --with-gui --export-text-to-path \
|
||||
--export-plain-svg=multisig-workflow.svg multisig-workflow.pdf && \
|
||||
echo '"success"'
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 64 KiB |
@ -7,7 +7,7 @@
|
||||
\usepackage{lmodern}
|
||||
\renewcommand*\familydefault{\sfdefault}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{shapes,arrows}
|
||||
\usetikzlibrary{shapes,arrows.meta}
|
||||
\tikzset{>=latex}
|
||||
\begin{document}
|
||||
% \sffamily{}
|
||||
@ -22,7 +22,7 @@
|
||||
rounded corners]
|
||||
\begin{tikzpicture}[auto]
|
||||
% outlining the flowchart on a grid
|
||||
\matrix[column sep=3ex,row sep=2ex]{
|
||||
\matrix[column sep=3ex,row sep=3ex]{
|
||||
\node [block_center] (0alice1)
|
||||
{Alice creates a PSBT with only her inputs
|
||||
with UTXOs filled in.\\Sends it to Bob.};
|
||||
@ -49,7 +49,13 @@
|
||||
\\
|
||||
};% end matrix
|
||||
% connecting nodes with paths
|
||||
\draw[line width = 1pt, ->]
|
||||
\draw [ultra thick, draw=black, -{Stealth[length=8pt]}]
|
||||
(0alice1) edge (1bob1)
|
||||
(1bob1) edge (2carol1)
|
||||
(2carol1) edge (3bob2)
|
||||
(3bob2) edge (4alice1)
|
||||
(4alice1) edge (5alice2);
|
||||
\draw [thin, white, -{Stealth[color=black, fill=white, length=8pt]}]
|
||||
(0alice1) edge (1bob1)
|
||||
(1bob1) edge (2carol1)
|
||||
(2carol1) edge (3bob2)
|
||||
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 97 KiB |
@ -7,7 +7,7 @@
|
||||
\usepackage{lmodern}
|
||||
\renewcommand*\familydefault{\sfdefault}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{shapes,arrows}
|
||||
\usetikzlibrary{shapes,arrows.meta}
|
||||
\tikzset{>=latex}
|
||||
%\pgfdeclarelayer{bg} % declare background layer
|
||||
%\pgfsetlayers{bg,main} % set order of layers
|
||||
@ -83,7 +83,15 @@
|
||||
};% end matrix
|
||||
% connecting nodes with paths
|
||||
% \begin{pgfonlayer}{bg}
|
||||
\draw[line width = 1pt, ->]
|
||||
\draw [ultra thick, draw=black, -{Stealth[length=8pt]}]
|
||||
(R1) edge (R2)
|
||||
(R2) edge (R3)
|
||||
(R3) -| (R4C1)
|
||||
(R3) edge (R4C2)
|
||||
(R5) edge (R6)
|
||||
(R6) edge (R7)
|
||||
(R7) edge (stop);
|
||||
\draw [thin, white, -{Stealth[color=black, fill=white, length=8pt]}]
|
||||
(R1) edge (R2)
|
||||
(R2) edge (R3)
|
||||
(R3) -| (R4C1)
|
||||
@ -92,7 +100,12 @@
|
||||
(R6) edge (R7)
|
||||
(R7) edge (stop);
|
||||
% circumvent missing arrow
|
||||
\draw[line width = 1pt, ->]
|
||||
\draw [ultra thick, draw=black, -{Stealth[length=8pt]}]
|
||||
(R4C1) |-+(0,-2.2em)-| (R5)
|
||||
(R4C2) edge (R5)
|
||||
(R4C3) |-+(0,-2.2em)-| (R5)
|
||||
(R3) -| (R4C3);
|
||||
\draw [thin, white, -{Stealth[color=black, fill=white, length=8pt]}]
|
||||
(R4C1) |-+(0,-2.2em)-| (R5)
|
||||
(R4C2) edge (R5)
|
||||
(R4C3) |-+(0,-2.2em)-| (R5)
|
||||
|
@ -16,7 +16,7 @@ Bits is presented here as the standard term for 100 (one hundred) satoshis or 1/
|
||||
== Motivation ==
|
||||
The bitcoin price has grown over the years and once the price is past $10,000 USD or so, bitcoin amounts under $10 USD start having enough decimal places that it's difficult to tell whether the user is off by a factor of 10 or not. Switching the denomination to "bits" makes comprehension easier. For example, when BTC is $15,000 USD, $10.05 is a somewhat confusing 0.00067 BTC, versus 670 bits, which is a lot clearer.
|
||||
|
||||
Additonally, reverse comparisons are easier as 59 bits being $1 is easier to comprehend for most people than 0.000059 BTC being $1. Similar comparisons can be made to other currencies: 1 yen being 0.8 bits, 1 won being 0.07 bits and so on.
|
||||
Additionally, reverse comparisons are easier as 59 bits being $1 is easier to comprehend for most people than 0.000059 BTC being $1. Similar comparisons can be made to other currencies: 1 yen being 0.8 bits, 1 won being 0.07 bits and so on.
|
||||
|
||||
Potential benefits of utilizing "bits" include:
|
||||
|
||||
@ -48,7 +48,7 @@ The term "bit" has many different definitions, but the ones of particular note a
|
||||
* bit meaning some amount of data (e.g., the first bit of the version field is 0)
|
||||
* bit meaning strength of a cryptographic algorithm (e.g., 256-bit ECDSA is used in Bitcoin)
|
||||
|
||||
The first is a bit dated and isn't likely to confuse people dealing with Bitcoin. The second and third are computer science terms and context should be sufficient to figure out what the user of the word means.
|
||||
The first is a bit dated and isn't likely to confuse people dealing with Bitcoin. The second and third are computer science terms and context should be sufficient to figure out what the user of the word means.
|
||||
|
||||
== Copyright ==
|
||||
This BIP is licensed under the BSD 2-clause license.
|
||||
|
@ -79,7 +79,7 @@ The Seizable Collateral script takes the following form:
|
||||
|
||||
==Compatibility==
|
||||
|
||||
BIP 197 is compatible with [ERC 1850](https://github.com/ethereum/EIPs/pull/1850) for [atomic loans](https://arxiv.org/pdf/1901.05117.pdf) with Ethereum. Can be extended in the future to be compatible with other HTLC and smart contract compatible chains.
|
||||
BIP 197 is compatible with [https://github.com/ethereum/EIPs/pull/1850 ERC 1850] for [https://arxiv.org/pdf/1901.05117.pdf atomic loans] with Ethereum. Can be extended in the future to be compatible with other HTLC and smart contract compatible chains.
|
||||
|
||||
==Motivation==
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user