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

Merge bitcoin/bitcoin#36978: rpc: require a hex string for OP_RETURN data

Public commit record

What the developer wrote

Authored by merge-script

81/100 · Strong
Merge bitcoin/bitcoin#36978: rpc: require a hex string for OP_RETURN data

f0518a30afb2b5a6c25525f5b624b203374f9eb9 rpc: require a hex string for OP_RETURN data (Lőrinc)

Pull request description:

**Problem:** `createrawtransaction` accepts a JSON number as `data` when its digits form valid hex. For example, it treats `99` as the string `"99"` and writes the byte `0x99` to the output.

**Fix:** Pass the original JSON value to the hex parser so it can enforce the documented string type.

ACKs for top commit:
maflcko:
lgtm ACK f0518a30afb2b5a6c25525f5b624b203374f9eb9
stickies-v:
ACK f0518a30afb2b5a6c25525f5b624b203374f9eb9
rkrux:
lgtm ACK f0518a30afb2b5a6c25525f5b624b203374f9eb9

Tree-SHA512: 26276de2b84e7d7d81d3d818bf7e9843381b7ca6d5422e327a8bb7b61046abeffcfced25ade6f6a3780086290638f8eb15301e98df5dbabd2b8a2e851b3c542b
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit fixes a small but real type-checking bug in Bitcoin Core's `createrawtransaction` RPC command. Previously, if a user accidentally passed a JSON number where a hex string was expected for OP_RETURN data, the command could silently accept it and write unintended bytes into the transaction. The fix forces the RPC to reject non-string values, matching the documented behavior. It is not a critical money-stealing bug, but it removes a foot-gun that could surprise developers or tools building transactions.

Recommended action

No urgent action required beyond normal patching. Node operators and developers using `createrawtransaction` with `data` outputs should ensure they pass hex strings, not numbers, after upgrading. Review any tooling that may have relied on the accidental numeric acceptance.

Security signals we found

01

Type confusion between JSON number and hex string in RPC input parsing

02

Silent acceptance of unintended byte values in OP_RETURN outputs

03

Input validation strengthened to match documented API contract

04

Regression test added for numeric input rejection

Risk score

Why this scored 34/100

Our methodology →
Potential impact 5/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 9/10
Evidence quality 5/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.