zk-dex-mint-python
Python-based mint note generation for zk-DEx. Creates a 7-input Poseidon note hash compatible with the circom mint circuit. Uses the shared zkdex_lib library (pure Python, no npm/web3 dependency).
Dependencies
zkdex_lib/ (shared library: Poseidon hash, Note class)
- Python 3.x
- Node.js + snarkjs (ZK proof 생성 시에만 필요)
Usage
# 노트만 생성
python generate_mint.py \
--owner-pk-x <hex> \
--owner-pk-y <hex> \
--value <amount> \
--token-type <hex> # optional, default: 0x0 (ETH)
--salt <hex> # optional, auto-generated if omitted
# 노트 + ZK proof 생성
python generate_mint.py \
--owner-pk-x <hex> \
--owner-pk-y <hex> \
--value <amount> \
--proof \
--sk <secret_key> # required with --proof
Output Format
{
"noteHash": "0x05fa764f...",
"noteRaw": {
"owner0": "0x...",
"owner1": "0x...",
"value": "0x...",
"token": "0x...",
"vk0": "0x...",
"vk1": "0x...",
"salt": "0x..."
},
"proof": {
"a": ["<uint256>", "<uint256>"],
"b": [["<uint256>", "<uint256>"], ["<uint256>", "<uint256>"]],
"c": ["<uint256>", "<uint256>"],
"input": ["<noteHash>", "<value>", "<tokenType>"]
}
}
- noteHash:
Poseidon(owner0, owner1, value, token, vk0, vk1, salt) — 64 hex chars
- noteRaw: All 7 note fields as 0x-prefixed 64-char hex strings
- Regular note:
owner0=pk.x, owner1=pk.y, vk0=pk.x, vk1=pk.y
- proof (optional): Groth16 proof formatted for Solidity verifier. Only present with
--proof flag.
a, b, c: proof elements
input: public signals [noteHash, value, tokenType]
Structure
generate_mint.py: CLI script for mint note generation
zkdex_lib/proof.py: ZK proof generation (Python subprocess wrapper)
zkdex_lib/generate_proof.js: Node.js CLI for snarkjs
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: zk-dex-mint-python3description: Generate zk-DEx mint note. Run `python generate_mint.py --owner-pk-x <hex> --owner-pk-y <hex> --value <amount>` to create a 7-input Poseidon note hash for minting. Use when this capability is needed.4---56# zk-dex-mint-python78Python-based mint note generation for zk-DEx. Creates a 7-input Poseidon note hash compatible with the circom mint circuit. Uses the shared `zkdex_lib` library (pure Python, no npm/web3 dependency).910## Dependencies1112- `zkdex_lib/` (shared library: Poseidon hash, Note class)13- Python 3.x14- Node.js + snarkjs (ZK proof 생성 시에만 필요)1516## Usage1718```bash19# 노트만 생성20python generate_mint.py \21 --owner-pk-x <hex> \22 --owner-pk-y <hex> \23 --value <amount> \24 --token-type <hex> # optional, default: 0x0 (ETH)25 --salt <hex> # optional, auto-generated if omitted2627# 노트 + ZK proof 생성28python generate_mint.py \29 --owner-pk-x <hex> \30 --owner-pk-y <hex> \31 --value <amount> \32 --proof \33 --sk <secret_key> # required with --proof34```3536## Output Format3738```json39{40 "noteHash": "0x05fa764f...",41 "noteRaw": {42 "owner0": "0x...",43 "owner1": "0x...",44 "value": "0x...",45 "token": "0x...",46 "vk0": "0x...",47 "vk1": "0x...",48 "salt": "0x..."49 },50 "proof": {51 "a": ["<uint256>", "<uint256>"],52 "b": [["<uint256>", "<uint256>"], ["<uint256>", "<uint256>"]],53 "c": ["<uint256>", "<uint256>"],54 "input": ["<noteHash>", "<value>", "<tokenType>"]55 }56}57```5859- **noteHash**: `Poseidon(owner0, owner1, value, token, vk0, vk1, salt)` — 64 hex chars60- **noteRaw**: All 7 note fields as 0x-prefixed 64-char hex strings61- Regular note: `owner0=pk.x`, `owner1=pk.y`, `vk0=pk.x`, `vk1=pk.y`62- **proof** (optional): Groth16 proof formatted for Solidity verifier. Only present with `--proof` flag.63 - `a`, `b`, `c`: proof elements64 - `input`: public signals `[noteHash, value, tokenType]`6566## Structure6768- `generate_mint.py`: CLI script for mint note generation69- `zkdex_lib/proof.py`: ZK proof generation (Python subprocess wrapper)70- `zkdex_lib/generate_proof.js`: Node.js CLI for snarkjs7172---73> Converted and distributed by [TomeVault](https://tomevault.io/claim/tokamak-network) — claim your Tome and manage your conversions.74<!-- tomevault:4.0:skill_md:2026-04-16 -->