| name | zk-dex-transfer-python |
| description | Generate zk-DEx transfer note. Run `python generate_transfer.py --sk <key> --to-pk-x <hex> --to-pk-y <hex> --value <amount>` to create a Poseidon note hash for transfers. |
zk-dex-transfer-python
Python-based transfer note generation for zk-DEx. Creates a 7-input Poseidon note hash compatible with the circom transfer circuit. The sender's secret key is used for ownership proof, and the recipient's public key becomes the note owner. Uses the shared zkdex_lib library (pure Python, no npm/web3 dependency).
Dependencies
zkdex_lib/ (shared library: Poseidon hash, Note, Account)
- Python 3.x
- Node.js + snarkjs (ZK proof ์์ฑ ์์๋ง ํ์)
Usage
python generate_transfer.py \
--sk <sender_secret_key> \
--to-pk-x <hex> \
--to-pk-y <hex> \
--value <amount> \
--token-type <hex>
--salt <hex>
python generate_transfer.py \
--sk <sender_secret_key> \
--to-pk-x <hex> \
--to-pk-y <hex> \
--value <amount> \
--proof \
--old-note0 <json_path>
--old-note1 <json_path>
--change-salt <hex>
--sk1 <hex>
Output Format
{
"noteHash": "0x05fa764f...",
"noteRaw": { "owner0": "0x...", ... },
"sender": {
"address": "c63db0d1...",
"publicKey": { "x": "0x...", "y": "0x..." }
},
"changeNote": {
"noteHash": "0x...",
"noteRaw": { "owner0": "0x...", ... }
},
"proof": {
"a": ["<uint256>", "<uint256>"],
"b": [["<uint256>", "<uint256>"], ["<uint256>", "<uint256>"]],
"c": ["<uint256>", "<uint256>"],
"input": ["<o0Hash>", "<o1Hash>", "<newHash>", "<changeHash>"]
}
}
- changeNote (with
--proof): ์๋ ์์ฑ๋ ๊ฑฐ์ค๋ฆ ๋
ธํธ (์ก์ ์์๊ฒ ๋์๊ฐ)
- proof (with
--proof): Groth16 proof for transfer_note circuit
input: public signals [o0Hash, o1Hash, newHash, changeHash]
--old-note0/--old-note1 JSON ํ์: {"noteRaw": {"owner0": ..., "salt": ...}} ๋๋ ํ๋ ์ง์ ํฌํจ
Structure
generate_transfer.py: CLI script for transfer note generation