RootPN
(Work in progress) RootPrivateNote Contract Interface Documentation
Overview
RootPN is the system root contract responsible for deploying and managing PrivateNote contracts.
It also stores and manages the canonical contract code for related system components, including Pari Mutuel Pool, Oracles, and Nullifiers.
The contract acts as a trusted entry point for:
zero-knowledge–verified deposits
deterministic deployment of
PrivateNotesystem-wide code upgrades
Events
vaucherGenerated
Emitted when a new voucher is generated.
event vaucherGenerated(uint256 sk_u_commit, uint vaucher_nominal, uint32 token_type);sk_u_commit— Commitment of the user secret keyvaucher_nominal— Voucher nominal valuetoken_type— Token type associated with the voucher
PrivateNoteDeployed
Emitted when a new PrivateNote contract is deployed.
depositIdentifierHash— Deposit identifier hashnoteAddress— DeployedPrivateNoteaddressinitialBalance— Initial token balance
NullifierDeployed
Emitted when a Nullifier contract is deployed.
nullifierAddress— Address associated with the deploymentvalue— Value linked to the nullifier
Meaning:
A nullifier was created to prevent double-spending
Funds were transferred to the associated
PrivateNote
Public & External Interface
sendEccShellToPrivateNote
sendEccShellToPrivateNoteVerifies a zero-knowledge proof and deploys a Nullifier contract associated with a deterministic PrivateNote address.
Parameters:
proof— zero-knowledge proof validating the depositnullifier_hash— unique nullifier preventing double spenddeposit_identifier_hash— deposit identifier hashvalue— amount of ECC Shell tokens to mint and transfer
Behavior:
Verifies the proof using
zkhalo2verifyMints ECC Shell tokens
Deploys a
NullifiercontractForwards minted tokens to the corresponding
PrivateNoteEmits
NullifierDeployed
deployPrivateNote
deployPrivateNoteDeploys a new PrivateNote contract after ZK verification.
Parameters:
zkproof— zero-knowledge proof of deposit validitydeposit_identifier_hash— unique deposit identifierethemeral_pubkey— public key for the notevalue— initial token balancetoken_type— token type identifier
Behavior:
Ensures the root contract has sufficient native balance
Builds ZK public inputs from:
fixed zero padding
value(encoded into 8 bytes)more zero padding
token_type(encoded into 8 bytes)deposit_identifier_hash(encoded into 32 bytes)
Verifies the proof using
gosh.zkhalo2verify(pub_inputs, zkproof)Deploys the
PrivateNotecontract deterministically fromdeposit_identifier_hashEmits
PrivateNoteDeployed
privateNoteDeployed
privateNoteDeployedRecords the deployment of a PrivateNote.
Access Control:
Callable only by the corresponding
PrivateNotecontract
Behavior:
Updates internal accounting of deployed values by token type
View Functions
getPrivateNoteCode
getPrivateNoteCodeReturns the salted PrivateNote contract code.
Returns:
privateNoteCode— salted code cellprivateNoteHash— hash of the salted code
getPrivateNoteAddress
getPrivateNoteAddressReturns the deterministic address of a PrivateNote contract for a given deposit identifier hash.
Parameters:
deposit_identifier_hash— unique deposit identifier hash used to derive the PN address
Returns:
privateNoteAddress— deterministicPrivateNoteaddress for this deposit identifier
Notes:
The address is computed deterministically and can be obtained even if the
PrivateNoteis not deployed yet.Intended for off-chain tooling, indexers, and integrations.
getPMPAddress
getPMPAddressReturns the deterministic address of a PMP contract for the given event, token type, and oracle name set.
Parameters:
event_id— event identifier used by the PMP (e.g., hash of the pool name)names— list of oracle names participating in the pool; used to build the oracle list hashtoken_type— token type used by the PMP
Returns:
pmpAddress— deterministic PMP address computed from the provided inputs
Notes:
The oracle list hash is computed from the set of oracle name hashes.
The returned address matches the address used when deploying PMP from
PrivateNote.
getDetails
getDetailsReturns core RootPN state information.
Returns:
hash of PMP code
hash of PrivateNote code
root owner public key
current contract balance
getVersion()
getVersion()Returns version information for the RootPN contract.
Returns:
semantic version string
contract identifier:
"RootPN"
Last updated