What changed, and why it matters
This commit is a purely cosmetic documentation and comment change. It rewrites Bitcoin Improvement Proposal (BIP) references from formats like 'BIP-32' or 'BIP 68' to a new standardized four-digit format like 'BIP-0032' or 'BIP-0068' across changelogs, examples, source code comments, and markdown docs. No program logic, code behavior, or security properties were changed.
No security action needed. This is a non-functional formatting change. Reviewers can safely ignore it from a security perspective.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of string replacements for BIP identifiers in comments, doc comments, markdown files, and changelog entries. Examples include ‘BIP-32’ → ‘BIP-0032’, ‘BIP-141’ → ‘BIP-0141’, ‘BIP 68’ → ‘BIP-0068’, and ‘BIP-431’ → ‘BIP-0431’. No executable code, serialization logic, cryptographic operations, or API signatures were modified. The commit message explicitly states the intent: ‘Use the new format, four digits - repo wide including CHANGELOG’.
Changed components
Inspect captured patch +47 / −47
diff --git a/bitcoin/CHANGELOG.md b/bitcoin/CHANGELOG.md
index 05f738a3..0bf76496 100644
--- a/bitcoin/CHANGELOG.md
+++ b/bitcoin/CHANGELOG.md
@@ -6,7 +6,7 @@
## Breaking changes
-- Change Psbt serde implementation to contextually use the PSBT binary or base64 encoded formats described in BIP-174.
+- Change Psbt serde implementation to contextually use the PSBT binary or base64 encoded formats described in BIP-0174.
# 0.33.0-alpha.0 - 2024-11-18
@@ -142,7 +142,7 @@ For changes to our dependencies included in this release see:
# 0.32.3 - 2024-09-27
-- Backport BIP-32 alias' without typo [#3252](https://github.com/rust-bitcoin/rust-bitcoin/pull/3252)
+- Backport BIP-0032 alias' without typo [#3252](https://github.com/rust-bitcoin/rust-bitcoin/pull/3252)
# 0.32.2 - 2024-06-07
@@ -171,7 +171,7 @@ might be what you are after.
- `sig` becomes `signature`
- `hash_ty` becomes `sighash_type`
- Rename `txid` to `compute_txid` [#2366](https://github.com/rust-bitcoin/rust-bitcoin/pull/2366)
-- In hardcoded BIP-32 derivation paths: Remove `m/` prefix requirement [#2451](https://github.com/rust-bitcoin/rust-bitcoin/pull/2451)
+- In hardcoded BIP-0032 derivation paths: Remove `m/` prefix requirement [#2451](https://github.com/rust-bitcoin/rust-bitcoin/pull/2451)
## Crate smashing
@@ -262,7 +262,7 @@ In particular consider having some type that implements `AsRef<Params>`, we have
# 0.31.1 - 2024-01-09
- Fix bug in `FeeRate::checked_mul_by_weight` [#2128](https://github.com/rust-bitcoin/rust-bitcoin/pull/2182)
-- Add BIP-32 types remove in 0.31 back in and mark as deprecated [#2258](https://github.com/rust-bitcoin/rust-bitcoin/pull/2258)
+- Add BIP-0032 types remove in 0.31 back in and mark as deprecated [#2258](https://github.com/rust-bitcoin/rust-bitcoin/pull/2258)
# 0.31.0 - 2023-10-18
@@ -397,7 +397,7 @@ This release is big, to help users upgrade we wrote a blog post, please see http
all types except `Vec` and arrays, replace where appropriate with `FromStr`.
- Performance improvements:
- - [Remove needless allocation from BIP-158 encoding](https://github.com/rust-bitcoin/rust-bitcoin/pull/1146)
+ - [Remove needless allocation from BIP-0158 encoding](https://github.com/rust-bitcoin/rust-bitcoin/pull/1146)
- [Implement fast hex encoding](https://github.com/rust-bitcoin/rust-bitcoin/pull/1268) (usage added in a [later PR](https://github.com/rust-bitcoin/rust-bitcoin/pull/1476))
- Testing improvements:
@@ -678,7 +678,7 @@ the case and how we broke both `rust-miniscript` and BDK.
# 0.19.0 - 2019-08-16
* Add `Amount` and `SignedAmount` types.
-* Add BIP-158 support with `BlockFilter` and related types.
+* Add BIP-0158 support with `BlockFilter` and related types.
* Add `util::misc::signed_msg_hash()` for signing messages.
* Add `MerkleBlock` and `PartialMerkleTree` types.
* bip32: Support serde serialization for types and add some utility methods:
diff --git a/bitcoin/examples/sighash.rs b/bitcoin/examples/sighash.rs
index cfa3f990..2bfbd740 100644
--- a/bitcoin/examples/sighash.rs
+++ b/bitcoin/examples/sighash.rs
@@ -26,7 +26,7 @@ fn compute_sighash_p2wpkh(raw_tx: &[u8], inp_idx: usize, amount: Amount) {
let witness = &inp.witness;
println!("Witness: {witness:?}");
- // BIP-141: The witness must consist of exactly 2 items (≤ 520 bytes each). The first one a
+ // BIP-0141: The witness must consist of exactly 2 items (≤ 520 bytes each). The first one a
// signature, and the second one a public key.
assert_eq!(witness.len(), 2);
let sig_bytes = witness.get(0).unwrap();
@@ -34,7 +34,7 @@ fn compute_sighash_p2wpkh(raw_tx: &[u8], inp_idx: usize, amount: Amount) {
let sig = ecdsa::Signature::from_slice(sig_bytes).expect("failed to parse sig");
- //BIP-143: "The item 5 : For P2WPKH witness program, the scriptCode is 0x1976a914{20-byte-pubkey-hash}88ac"
+ //BIP-0143: "The item 5 : For P2WPKH witness program, the scriptCode is 0x1976a914{20-byte-pubkey-hash}88ac"
//this is nothing but a standard P2PKH script OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG:
let pk = CompressedPublicKey::from_slice(pk_bytes).expect("failed to parse pubkey");
let wpkh = pk.wpubkey_hash();
diff --git a/bitcoin/examples/sign-tx-segwit-v0.rs b/bitcoin/examples/sign-tx-segwit-v0.rs
index 778d8c38..e0477070 100644
--- a/bitcoin/examples/sign-tx-segwit-v0.rs
+++ b/bitcoin/examples/sign-tx-segwit-v0.rs
@@ -49,7 +49,7 @@ fn main() {
// The transaction we want to sign and broadcast.
let mut unsigned_tx = Transaction {
- version: transaction::Version::TWO, // Post BIP-68.
+ version: transaction::Version::TWO, // Post BIP-0068.
lock_time: absolute::LockTime::ZERO, // Ignore the locktime.
inputs: vec![input], // Input goes into index 0.
outputs: vec![spend, change], // Outputs, order does not matter.
diff --git a/bitcoin/examples/sign-tx-taproot.rs b/bitcoin/examples/sign-tx-taproot.rs
index 9c5b6017..69339fdd 100644
--- a/bitcoin/examples/sign-tx-taproot.rs
+++ b/bitcoin/examples/sign-tx-taproot.rs
@@ -49,7 +49,7 @@ fn main() {
// The transaction we want to sign and broadcast.
let mut unsigned_tx = Transaction {
- version: transaction::Version::TWO, // Post BIP-68.
+ version: transaction::Version::TWO, // Post BIP-0068.
lock_time: absolute::LockTime::ZERO, // Ignore the locktime.
inputs: vec![input], // Input goes into index 0.
outputs: vec![spend, change], // Outputs, order does not matter.
diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs
index f085d684..0912d2f5 100644
--- a/bitcoin/src/blockdata/block.rs
+++ b/bitcoin/src/blockdata/block.rs
@@ -289,7 +289,7 @@ impl BlockCheckedExt for Block<Checked> {
fn witness_root(&mut self) -> Option<WitnessMerkleNode> { self.cached_witness_root() }
fn weight(&self) -> Weight {
- // This is the exact definition of a weight unit, as defined by BIP-141 (quote above).
+ // This is the exact definition of a weight unit, as defined by BIP-0141 (quote above).
let wu = block_base_size(self.transactions()) * 3 + self.total_size();
Weight::from_wu(wu.to_u64())
}
diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs
index 4802b31e..2eba785e 100644
--- a/bitcoin/src/blockdata/transaction.rs
+++ b/bitcoin/src/blockdata/transaction.rs
@@ -343,7 +343,7 @@ impl TransactionExt for Transaction {
#[inline]
fn weight(&self) -> Weight {
- // This is the exact definition of a weight unit, as defined by BIP-141 (quote above).
+ // This is the exact definition of a weight unit, as defined by BIP-0141 (quote above).
let wu = self.base_size() * 3 + self.total_size();
Weight::from_wu(wu.to_u64())
}
@@ -464,7 +464,7 @@ trait TransactionExtPriv {
where
S: FnMut(&OutPoint) -> Option<TxOut>;
- /// Returns whether or not to serialize transaction as specified in BIP-144.
+ /// Returns whether or not to serialize transaction as specified in BIP-0144.
fn uses_segwit_serialization(&self) -> bool;
}
@@ -559,7 +559,7 @@ impl TransactionExtPriv for Transaction {
count
}
- /// Returns whether or not to serialize transaction as specified in BIP-144.
+ /// Returns whether or not to serialize transaction as specified in BIP-0144.
// This is duplicated in `primitives`, if you change it please do so in both places.
fn uses_segwit_serialization(&self) -> bool {
if self.inputs.iter().any(|input| !input.witness.is_empty()) {
@@ -704,7 +704,7 @@ impl Encodable for Transaction {
len += self.inputs.consensus_encode(w)?;
len += self.outputs.consensus_encode(w)?;
} else {
- // BIP-141 (SegWit) transaction serialization also includes marker, flag, and witness data.
+ // BIP-0141 (SegWit) transaction serialization also includes marker, flag, and witness data.
len += SEGWIT_MARKER.consensus_encode(w)?;
len += SEGWIT_FLAG.consensus_encode(w)?;
len += self.inputs.consensus_encode(w)?;
diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs
index 4127af79..fbf80355 100644
--- a/bitcoin/src/lib.rs
+++ b/bitcoin/src/lib.rs
@@ -83,7 +83,7 @@ pub extern crate io;
/// Re-export the `rust-secp256k1` crate.
///
-/// Rust wrapper library for Pieter Wuille's libsecp256k1. Implements ECDSA and BIP-340 signatures
+/// Rust wrapper library for Pieter Wuille's libsecp256k1. Implements ECDSA and BIP-0340 signatures
/// for the SECG elliptic curve group secp256k1 and related utilities.
pub extern crate secp256k1;
diff --git a/bitcoin/src/network/params.rs b/bitcoin/src/network/params.rs
index 35f467fd..e3aa6558 100644
--- a/bitcoin/src/network/params.rs
+++ b/bitcoin/src/network/params.rs
@@ -27,7 +27,7 @@
//! let mut params = Params::new(Network::Signet);
//! params.pow_target_spacing = POW_TARGET_SPACING;
//!
-//! // This would be something real (see BIP-325).
+//! // This would be something real (see BIP-00325).
//! let challenge_script = WitnessScriptBuf::new();
//!
//! Self {
diff --git a/bitcoin/tests/serde.rs b/bitcoin/tests/serde.rs
index e39ec511..213555a3 100644
--- a/bitcoin/tests/serde.rs
+++ b/bitcoin/tests/serde.rs
@@ -293,7 +293,7 @@ fn serde_regression_psbt() {
}],
};
- // Sanity, check we can roundtrip BIP-174 serialize.
+ // Sanity, check we can roundtrip BIP-0174 serialize.
let serialized = psbt.serialize();
Psbt::deserialize(&serialized).unwrap();
diff --git a/docs/bip-32.md b/docs/bip-32.md
index f8269472..8f6f501a 100644
--- a/docs/bip-32.md
+++ b/docs/bip-32.md
@@ -1,12 +1,12 @@
-# BIP-32 and BIP-380
+# BIP-0032 and BIP-0380
The current module has not been patched much in the last 5 years and the rest of the code base has
stylistically changed quite a bit.
-* Re-write the BIP-32 API
-* Add support for BIP-380
+* Re-write the BIP-0032 API
+* Add support for BIP-0380
-See [BIP-32 super issue](https://github.com/rust-bitcoin/rust-bitcoin/issues/4770).
+See [BIP-0032 super issue](https://github.com/rust-bitcoin/rust-bitcoin/issues/4770).
## Notes
diff --git a/docs/crates.md b/docs/crates.md
index f8d51190..a6bee57d 100644
--- a/docs/crates.md
+++ b/docs/crates.md
@@ -32,7 +32,7 @@ people or they have a (slightly) different set of maintainers and/or merge polic
## Future crates
- `addresses`: Bitcoin addresses (see [address.md])
-- `bip-32`: BIP-32 (and maybe BIP-380) support (see [bip-32.md])
+- `bip-32`: BIP-0032 (and maybe BIP-0380) support (see [bip-32.md])
- `psbt`: PSBTv2 support (see [psbt.md])
- `keys`/`crypto`: Cryptography stuff or maybe just keys (see [keys.md])
diff --git a/docs/roadmap.md b/docs/roadmap.md
index ad7127d6..d30afe2f 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -8,7 +8,7 @@
* Add support for consensus encoding to `primitives`
* Release `bitcoin v0.33.0-rc.0`
* Split out an address crate (see [addresses.md])
-* BIP-32 and BIP-380 (see [bip-32.md])
+* BIP-0032 and BIP-0380 (see [bip-32.md])
* PSBTv2 (see [psbt.md])
* Split out a crypto/keys crate. Includes discussion of `secp256k1`. See [crypto.md]
* Make it possible for `bitcoin` to depend on `miniscript` (see [#2882])
diff --git a/hashes/src/macros.rs b/hashes/src/macros.rs
index 2b1f8071..6df29f1b 100644
--- a/hashes/src/macros.rs
+++ b/hashes/src/macros.rs
@@ -23,7 +23,7 @@
/// ```
///
/// The `hash_str` marker says the midstate should be generated by hashing the supplied string in a
-/// way described in BIP-341. Alternatively, you can supply `hash_bytes` to hash raw bytes. If you
+/// way described in BIP-0341. Alternatively, you can supply `hash_bytes` to hash raw bytes. If you
/// have the midstate already pre-computed and prefer **compiler** performance to readability you
/// may use `raw(MIDSTATE_BYTES, HASHED_BYTES_LENGTH)` instead, note that HASHED_BYTES_LENGTH must
/// be a multiple of 64.
diff --git a/hashes/src/sha256/mod.rs b/hashes/src/sha256/mod.rs
index cea61a63..63f1362d 100644
--- a/hashes/src/sha256/mod.rs
+++ b/hashes/src/sha256/mod.rs
@@ -163,11 +163,11 @@ impl Hash {
/// It represents "partially hashed data" but does not itself have properties of cryptographic
/// hashes. For example, when (ab)used as hashes, midstates are vulnerable to trivial
/// length-extension attacks. They are typically used to optimize the computation of full hashes.
-/// For example, when implementing BIP-340 tagged hashes, which always begin by hashing the same
+/// For example, when implementing BIP-0340 tagged hashes, which always begin by hashing the same
/// fixed 64-byte prefix, it makes sense to hash the prefix once, store the midstate as a constant,
/// and hash any future data starting from the constant rather than from a fresh hash engine.
///
-/// For BIP-340 support we provide the [`sha256t`] module, and the [`sha256t_tag`] macro which will
+/// For BIP-0340 support we provide the [`sha256t`] module, and the [`sha256t_tag`] macro which will
/// create the midstate for you in const context.
#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Midstate {
diff --git a/primitives/src/script/mod.rs b/primitives/src/script/mod.rs
index f7517b2a..ba6dbc73 100644
--- a/primitives/src/script/mod.rs
+++ b/primitives/src/script/mod.rs
@@ -122,7 +122,7 @@ impl ScriptHash {
/// > no data greater than 520 bytes may be pushed to the stack. Thus it is not possible to
/// > spend a P2SH output if the redemption script it refers to is >520 bytes in length.
///
- /// ref: [BIP-16](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#user-content-520byte_limitation_on_serialized_script_size)
+ /// ref: [BIP-0016](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#user-content-520byte_limitation_on_serialized_script_size)
#[inline]
pub fn from_script<T>(redeem_script: &Script<T>) -> Result<Self, RedeemScriptSizeError>
where
@@ -139,9 +139,9 @@ impl ScriptHash {
/// Constructs a new `ScriptHash` from any script irrespective of script size.
///
/// If you hash a script that exceeds 520 bytes in size and use it to create a P2SH output
- /// then the output will be unspendable (see [BIP-16]).
+ /// then the output will be unspendable (see [BIP-0016]).
///
- /// [BIP-16]: <https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#user-content-520byte_limitation_on_serialized_script_size>
+ /// [BIP-0016]: <https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#user-content-520byte_limitation_on_serialized_script_size>
#[inline]
pub fn from_script_unchecked<T>(script: &Script<T>) -> Self {
ScriptHash(hash160::Hash::hash(script.as_bytes()))
@@ -156,7 +156,7 @@ impl WScriptHash {
/// > The witnessScript (≤ 10,000 bytes) is popped off the initial witness stack. SHA256 of the
/// > witnessScript must match the 32-byte witness program.
///
- /// ref: [BIP-141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
+ /// ref: [BIP-0141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
#[inline]
pub fn from_script(witness_script: &WitnessScript) -> Result<Self, WitnessScriptSizeError> {
if witness_script.len() > MAX_WITNESS_SCRIPT_SIZE {
@@ -170,9 +170,9 @@ impl WScriptHash {
/// Constructs a new `WScriptHash` from any script irrespective of script size.
///
/// If you hash a script that exceeds 10,000 bytes in size and use it to create a Segwit
- /// output then the output will be unspendable (see [BIP-141]).
+ /// output then the output will be unspendable (see [BIP-0141]).
///
- /// ref: [BIP-141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
+ /// ref: [BIP-0141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)
#[inline]
pub fn from_script_unchecked(script: &WitnessScript) -> Self {
WScriptHash(sha256::Hash::hash(script.as_bytes()))
diff --git a/primitives/src/transaction.rs b/primitives/src/transaction.rs
index 8f3d1914..7aec9f2f 100644
--- a/primitives/src/transaction.rs
+++ b/primitives/src/transaction.rs
@@ -90,14 +90,14 @@ use crate::{absolute, Amount, ScriptPubKeyBuf, ScriptSigBuf, Sequence, Weight, W
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
#[cfg(feature = "alloc")]
pub struct Transaction {
- /// The protocol version, is currently expected to be 1, 2 (BIP 68) or 3 (BIP 431).
+ /// The protocol version, is currently expected to be 1, 2 (BIP-0068) or 3 (BIP-0431).
pub version: Version,
/// Block height or timestamp. Transaction cannot be included in a block until this height/time.
///
/// # Relevant BIPs
///
- /// * [BIP-65 OP_CHECKLOCKTIMEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
- /// * [BIP-113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
+ /// * [BIP-0065 OP_CHECKLOCKTIMEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
+ /// * [BIP-0113 Median time-past as endpoint for lock-time calculations](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki)
pub lock_time: absolute::LockTime,
/// List of transaction inputs.
pub inputs: Vec<TxIn>,
@@ -163,7 +163,7 @@ impl Transaction {
Wtxid::from_byte_array(hash.to_byte_array())
}
- /// Returns whether or not to serialize transaction as specified in BIP-144.
+ /// Returns whether or not to serialize transaction as specified in BIP-0144.
// This is duplicated in `bitcoin`, if you change it please do so in both places.
#[inline]
fn uses_segwit_serialization(&self) -> bool {
@@ -218,10 +218,10 @@ impl From<&Transaction> for Wtxid {
}
// Duplicated in `bitcoin`.
-/// The marker MUST be a 1-byte zero value: 0x00. (BIP-141)
+/// The marker MUST be a 1-byte zero value: 0x00. (BIP-0141)
#[cfg(feature = "alloc")]
const SEGWIT_MARKER: u8 = 0x00;
-/// The flag MUST be a 1-byte non-zero value. Currently, 0x01 MUST be used. (BIP-141)
+/// The flag MUST be a 1-byte non-zero value. Currently, 0x01 MUST be used. (BIP-0141)
#[cfg(feature = "alloc")]
const SEGWIT_FLAG: u8 = 0x01;
@@ -234,7 +234,7 @@ fn hash_transaction(tx: &Transaction, uses_segwit_serialization: bool) -> sha256
enc.input(&tx.version.0.to_le_bytes()); // Same as `encode::emit_i32`.
if uses_segwit_serialization {
- // BIP-141 (SegWit) transaction serialization also includes marker and flag.
+ // BIP-0141 (SegWit) transaction serialization also includes marker and flag.
enc.input(&[SEGWIT_MARKER]);
enc.input(&[SEGWIT_FLAG]);
}
@@ -267,7 +267,7 @@ fn hash_transaction(tx: &Transaction, uses_segwit_serialization: bool) -> sha256
}
if uses_segwit_serialization {
- // BIP-141 (SegWit) transaction serialization also includes the witness data.
+ // BIP-0141 (SegWit) transaction serialization also includes the witness data.
for input in &tx.inputs {
// Same as `Encodable for Witness`.
enc.input(compact_size::encode(input.witness.len()).as_slice());
@@ -524,26 +524,26 @@ impl Wtxid {
/// The transaction version.
///
-/// Currently, as specified by [BIP-68] and [BIP-431], version 1, 2, and 3 are considered standard.
+/// Currently, as specified by [BIP-0068] and [BIP-0431], version 1, 2, and 3 are considered standard.
///
/// Standardness of the inner `u32` is not an invariant because you are free to create transactions
/// of any version, transactions with non-standard version numbers will not be relayed by the
/// Bitcoin network.
///
-/// [BIP-68]: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
-/// [BIP-431]: https://github.com/bitcoin/bips/blob/master/bip-0431.mediawiki
+/// [BIP-0068]: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
+/// [BIP-0431]: https://github.com/bitcoin/bips/blob/master/bip-0431.mediawiki
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Version(u32);
impl Version {
- /// The original Bitcoin transaction version (pre-BIP-68).
+ /// The original Bitcoin transaction version (pre-BIP-0068).
pub const ONE: Self = Self(1);
- /// The second Bitcoin transaction version (post-BIP-68).
+ /// The second Bitcoin transaction version (post-BIP-0068).
pub const TWO: Self = Self(2);
- /// The third Bitcoin transaction version (post-BIP-431).
+ /// The third Bitcoin transaction version (post-BIP-0431).
pub const THREE: Self = Self(3);
/// Constructs a potentially non-standard transaction version.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.