AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 49 Bitcoin

Merge rust-bitcoin/rust-bitcoin#6958: primitives: Use txid for coinbase ntxid

Public commit record

What the developer wrote

Authored by Andrew Poelstra

96/100 · Strong
Merge rust-bitcoin/rust-bitcoin#6958: primitives: Use txid for coinbase ntxid

adb2c69e089be1a330feb35390440e1e8a819a6d primitives: Test coinbase ntxid behavior (Jamil Lambert, PhD)
542317a55591b10a25ca3628149b86b9a5111bcc primitives: Keep coinbase script_sig in ntxid (Jamil Lambert, PhD)

Pull request description:

A coinbase `script_sig` is not a signature and can contain a BIP-34 height commitment. Clearing it can give distinct coinbases the same `ntxid`.

Use the `txid` as the `ntxid` for coinbase transactions. Existing stores keyed by coinbase `ntxid` must recompute those keys. Like `txid`, the new `ntxid` do not distinguish identical historical coinbases.

Closes project-loupe/audit-rust-bitcoin#157


ACKs for top commit:
apoelstra:
ACK adb2c69e089be1a330feb35390440e1e8a819a6d; successfully ran local tests
tcharding:
ACK adb2c69e089be1a330feb35390440e1e8a819a6d


Tree-SHA512: 6f3d4fcb30ae5d92dcc73292a6fb16b97f4abc4a9e32b417353fdb108e3cb3de7e232752abe12b944782063d934674c680bec28b8cdac8a9f0f2aa424f729cb8
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This change fixes how a secondary transaction identifier called 'ntxid' is calculated for coinbase transactions (the special first transaction in each Bitcoin block). Previously, the code treated the coinbase's script_sig like a normal signature and cleared it when computing ntxid. Because coinbase script_sig actually contains required block-height data, two different valid coinbases could end up with the same ntxid. The fix makes coinbase ntxid equal to the regular txid, so distinct coinbases stay distinct. Any database or index that used the old coinbase ntxid as a key would need to recompute those keys.

Recommended action

Review any systems using coinbase ntxid as a lookup key and recompute those keys. Ensure downstream consumers of rust-bitcoin understand the semantic change for coinbase transactions. Consider whether the old behavior could have caused duplicate-key bugs in deployed services.

Security signals we found

01

Identifier collision risk in transaction indexing/keying

02

Incorrect normalization of consensus-critical coinbase script_sig

03

Potential key reuse/collision for stores indexed by coinbase ntxid

04

Fix references an external audit issue (project-loupe/audit-rust-bitcoin#157)

Risk score

Why this scored 49/100

Our methodology →
Potential impact 12/30
Exploitability 8/25
Stealth signal 7/15
Affected reach 10/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.