Skip to content

add ShieldedMultiSigToken preset with threshold-gated mint and burn#451

Draft
pepebndc wants to merge 2 commits intoadd-multisigfrom
add-multisig-token
Draft

add ShieldedMultiSigToken preset with threshold-gated mint and burn#451
pepebndc wants to merge 2 commits intoadd-multisigfrom
add-multisig-token

Conversation

@pepebndc
Copy link
Copy Markdown
Contributor

Summary

  • Adds ShieldedMultiSigToken.compact: a multisig token contract where both mint and burn require threshold ECDSA authorization
  • No deposit function — tokens can only enter supply through an authorized mint
  • Operation domain prefixes (MGBP:MINT / MGBP:BURN) in the message hash prevent cross-operation signature replay
  • Clarifies ShieldedMultiSigV2 doc to distinguish it as a vault (unauthenticated deposit + threshold-gated send) and adds a cross-reference to the new contract

Contracts

Contract Purpose Public circuits
ShieldedMultiSigV2 Vault deposit (open), execute (threshold-gated send)
ShieldedMultiSigToken Token mint (threshold-gated), burn (threshold-gated)

Notes

  • ECDSA verification is still stubbed (stubVerifySignature always returns true) — pending the Compact ECDSA + Keccak primitives
  • Message hash uses persistentHash as a placeholder; will need to switch to keccak256 to match BitGo's HSM signing format once the primitive lands

Introduces ShieldedMultiSigToken.compact: a multisig token contract where
both minting and burning require threshold ECDSA authorization. No deposit
function exists — the only way tokens enter supply is through an authorized
mint(). Operation domain prefixes ("MGBP:MINT" / "MGBP:BURN") in the
message hash prevent cross-operation signature replay.

Also clarifies ShieldedMultiSigV2 doc to distinguish it as a vault
(unauthenticated deposit, threshold-gated send) and cross-references
the new token contract.
@pepebndc pepebndc requested review from a team as code owners April 20, 2026 10:06
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 616a3060-f18e-44f0-9fd2-3fde60ea1313

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-multisig-token

Comment @coderabbitai help to get the list of available commands and usage tips.

@pepebndc pepebndc marked this pull request as draft April 20, 2026 10:12
Replaces the receiveShielded/sendShielded flow (which expected externally
created coins) with Midnight's native shielded token primitives, following
the pattern from the archived ShieldedToken:

- mint() calls mintToken() to create a new UTXO of this contract's token
  type, addressed to the contract itself. No external coin input.
- burn() calls receive() + sendImmediate() to burnAddress() to destroy a
  coin. Only coins of this contract's token type can be burned.

Adds state required for native minting: _counter (doubles as op nonce for
replay protection and feeds evolveNonce for coin nonce uniqueness),
_coinNonce, and _tokenDomain (sealed, set at construction).

Constructor gains initCoinNonce and tokenDomain parameters. Adds
getTokenDomain() and getTokenType() views so callers can derive the color.
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.

1 participant