Skip to content

Add CMR to compiler JSON output#231

Merged
apoelstra merged 1 commit intoBlockstreamResearch:masterfrom
0ceanSlim:add-cmr-to-output
Mar 17, 2026
Merged

Add CMR to compiler JSON output#231
apoelstra merged 1 commit intoBlockstreamResearch:masterfrom
0ceanSlim:add-cmr-to-output

Conversation

@0ceanSlim
Copy link
Contributor

The compiler currently outputs only the program binary (base64). Callers deploying programs on-chain also need the Commitment Merkle Root (CMR) to:

  • Derive the taproot address (P2TR scriptPubKey)
  • Build the control block for script-path spending

Without CMR in the output, callers must reimplement the entire commitment hash computation externally. Since the CMR is already computed internally during compilation, this patch exposes it by adding a cmr field (hex string) to
both the Output struct and the JSON output (--json flag). The human-readable display also prints it. The change is
non-breaking — existing callers that ignore unknown JSON fields are unaffected.

@0ceanSlim 0ceanSlim requested a review from delta1 as a code owner March 10, 2026 17:54
Copy link
Contributor

@stringhandler stringhandler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. This is possible already with hal-simplicity. but that is a whole other binary.

Copy link
Collaborator

@delta1 delta1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ddaabe0; tested locally, adds CMR to the output

@delta1
Copy link
Collaborator

delta1 commented Mar 13, 2026

@0ceanSlim could you please sign your GPG sign your commit? Then I can merge.

https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

delta1 added a commit to delta1/SimplicityHL that referenced this pull request Mar 13, 2026
ddaabe0 Add CMR to compiler output (0ceanslim)

Pull request description:

  The compiler currently outputs only the program binary (base64). Callers deploying programs on-chain also need the   Commitment Merkle Root (CMR) to:
    - Derive the taproot address (P2TR scriptPubKey)
    - Build the control block for script-path spending

  Without CMR in the output, callers must reimplement the entire commitment hash computation externally. Since the     CMR is already computed internally during compilation, this patch exposes it by adding a cmr field (hex string) to
    both the Output struct and the JSON output (--json flag). The human-readable display also prints it. The change is
    non-breaking — existing callers that ignore unknown JSON fields are unaffected.

ACKs for top commit:
  delta1:
    ACK ddaabe0; tested locally, adds CMR to the output

Tree-SHA512: 6640d185acdabd22dc49444bf162de8647ad325a85de193b86cf42156b04cd1b527c0c3db40e9d6b3408cd878a39488c289b9b5d5dfb1cb91dab4e8fae120ea7
@0ceanSlim
Copy link
Contributor Author

All done. I initially made a new verified commit but then realized you needed the pr rebased to sign the initial commit. Looks good now. Thanks!

@apoelstra
Copy link
Contributor

In 8ab4613:

This commit was empty, so I took the liberty of removing it.

Copy link
Contributor

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5c63de2; successfully ran local tests

@apoelstra apoelstra merged commit 897e3f8 into BlockstreamResearch:master Mar 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants