Skip to main content
Mint authority is gated by the witness-derived admin keypair from Access Control. The admin proves knowledge of a witness secret whose hash matches the stored _admin public key.

The Contract

How It Works

Admin authentication

The contract stores the admin’s public key. To mint, the caller must produce a ZK proof that they know a witness secret whose hash equals that public key. Reading _admin off chain gives an attacker the hash, not the secret — preimage resistance means they cannot forge the proof.

Total supply invariant

sum(all balances) == _totalSupply is maintained by always updating both sides together. Minting increases both; burning (Burning) decreases both; transferring preserves both.

Cast back to Uint<128> on store

Arithmetic widens; after the overflow assertion we cast back to Uint<128> before writing. See Overflow Protection.

Privacy Note

Each mint discloses account and amount on the public ledger. The full participant set and amount of every mint is observable to anyone reading the chain. This contract is suitable for transparent registries (game items, public rewards) but not for private finance.

What’s Next

Burning Tokens

Learn how to destroy tokens

ERC20 Token

Complete token with minting