feat(token): confidential note fungible token draft - #679
Draft
0xisk wants to merge 4 commits into
Draft
Conversation
Draft tier-4 exploration: a note-based confidential token with full graph privacy (amounts - including issuance and burns - sender, and recipient hidden), built as composable pieces: * ConfidentialNoteToken: the core (commitment tree, nullifier single-spend, value conservation, issuer gate) with ungated _-prefixed building blocks for composition * extensions: ConfidentialNoteTokenAudit (mandatory auditor viewing via audit-derived nonces), ConfidentialNoteTokenDelivery (on-chain note delivery for wallet scanning), ConfidentialNoteTokenSupply (homomorphic ElGamal supply with proof-backed attestation) * presets/RegulatedConfidentialNoteToken: the wired deployable token with issuer mint, burns, and escrow-free shared-nullifier seizure * crypto/NoteDelivery: the ECDH note-delivery primitive (7 passing tests) * mocks, simulators, and witness harnesses for the above; design doc and privacy exploration README NOT audited, NOT production.
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
* rename the family: ConfidentialNoteToken becomes ConfidentialNoteFungibleToken (asset class in the name, keeping the FungibleToken suffix family); the supply extension becomes ConfidentialNoteFungibleTokenPrivateSupply * split the issuer role out of the core into extensions/ConfidentialNoteFungibleTokenIssuer; the core is now role-free and initialization-free (pure note machinery) with two ungated value-creation blocks: _mint (core-derived fresh nonce) and _mintNote (policy-built note, e.g. audit-derived nonces) * convert presets/RegulatedConfidentialNoteFungibleToken from a top-level contract into a ready-to-use module: a one-shot initialize replaces the constructor, and the composed modules' observable ledgers and artifact types re-export under stable bare names; the new MockRegulatedConfidentialNoteFungibleToken carries the deployable shape for the simulators * drop the CNT_ import prefix (Core_ for the core internally, Token_ for the preset in consumers) * add compliance extensions: Freeze (freeze-before-seize via a frozen nullifier set), Allowlist (ZK Merkle-membership KYC with tombstone revocation), Review (selective disclosure to approved reviewer keys), plus self-rotation blocks for the issuer/audit/supply keys and rotateAuthority in the preset * mocks, simulators, and witness harnesses updated accordingly; verified via direct compact compile (skip-zk plus full keygen for circuit tags), tsc, and biome NOT audited, NOT production.
Complete the compliance layer on the confidential note token family and
add a concurrency track alongside it.
* Compliance:
- Split the seizure authority into its own
ConfidentialNoteFungibleTokenAuthority extension (key, secret
witness, _assertAuthority, self-rotation), mirroring Issuer; the
preset keeps only the seize wiring and _seizureCount.
- Wire Freeze into the regulated preset: transfer/burn assert
not-frozen at the owner-spend chokepoint, seize deliberately does
not, plus freeze/unfreeze circuits gated on the authority.
- Harden extensions: nonzero issuer-key guards, supply-key custody
warning, Review record-correctness and reviewer-selection caveats,
audit-scalar range note, unsalted-allowlist privacy caveat, and
@circuitInfo annotations across the family.
* Concurrency:
- Add utils/concurrency building blocks (UintDeltaInbox,
ElGamalDeltaInbox, ShardedCounter, RevocableMembershipTree) with
per-module docs.
- Add the ConfidentialNoteFungibleTokenConcurrentSupply extension and
a ConcurrentConfidentialNoteFungibleToken demo preset: encrypted
supply deltas commute via the inbox and a permissionless fold, and
attestation proves the inbox empty in-circuit.
- Document the conflict model, matrix, and fixes in the design doc
(new section) and in standalone concurrency.md and
cross-contract-calls.md.
This was referenced Jul 28, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
What types of changes does your code introduce to OpenZeppelin Midnight Contracts?
Put an
xin the boxes that applyFixes #???
DRAFT tier-4 exploration: a note-based confidential token with full graph privacy (amounts — including issuance and burns — sender, and recipient hidden), built as composable pieces:
ConfidentialNoteToken— the core: commitment tree, nullifier single-spend, value conservation, issuer gate, plus ungated_-prefixed building blocks for composition.extensions/ConfidentialNoteTokenAudit— mandatory auditor viewing; every output nonce derives from the audit ECDH, so all notes are auditor-recoverable by construction.extensions/ConfidentialNoteTokenDelivery— on-chain note delivery so recipients discover funds by scanning chain data.extensions/ConfidentialNoteTokenSupply— supply as a homomorphic ElGamal ciphertext withattestSupplypublishing a proof-backed public total.presets/RegulatedConfidentialNoteToken— the wired deployable token: issuer mint, burns, and escrow-free shared-nullifier seizure.crypto/NoteDelivery— the ECDH note-delivery primitive (unit-tested, 7 passing).contracts/src/token/docs/hybrid-confidential-token.mdand a privacy exploration overview atcontracts/privacy_readme.md.NOT audited, NOT production — opened as a draft for design discussion.
Known gaps (deliberate for the draft):
privacy_readme.mdreferencesprivacy-spectrum-*.svg/.htmlvisuals that are not committed yet.feat/crypto-hashersbranch and itscompact-bug-report/).PR Checklist
Further comments
The note-based (UTXO) design was chosen over encrypted-balance accounts to get sender/recipient unlinkability, escrow-free seizure (owner-spend and seizure race on the same nullifier), and auditor completeness by construction (nonces derive from the audit ECDH). Compliance and UX concerns live in optional extensions rather than the core, so each piece is independently reusable.