Setup
The circuit and the keys. Everything a checker needs to reproduce a proof, with hashes.
Single-contributor setup, demo only. Phase 2 has one contribution, made on the build machine. Whoever made it could forge proofs if they kept the randomness, so a seal here is a demonstration, not something to rely on for real stakes. A multi-party ceremony is Concept.
Trusted setup
Files served to your browser
Rebuild them yourself: npm run circuit:build compiles the circuit, checks the Powers of Tau hash and makes a NEW phase 2 key (so a new verifier). The full list lives in /zk/manifest.json.
Test issuer (public key, simulated records)
EdDSA on Baby Jubjub with Poseidon. The private seed is published on purpose so the demo works for anyone; it is the reason every record it signs is simulated data.
Sample account (public key)
Contracts on Robinhood Chain
The verifier is generated by snarkjs from this key. The gate book holds rules and seals: no funds, no global admin, no upgrade. Both were deployed by one wallet; anyone can confirm they run this repository's code with npm run verify-deployment.
Concept (not built)
- · a real issuer that signs actual positions
- · a multi-party phase 2 ceremony
- · several assets or a sum of positions in one proof
- · $ZKRYN token features
The circuit
pragma circom 2.1.6;
// Zkryn threshold proof.
// Proves: "the issuer signed a position record for this account, on this asset, at this time,
// and the amount in that record is at least `threshold`" without revealing the amount.
//
// Record message signed by the issuer (EdDSA over Baby Jubjub, Poseidon hash):
// M = Poseidon(DOMAIN, asset, amount, timestamp, accountHash)
// accountHash = Poseidon(account) (account = the trader's 20-byte address as a field element)
//
// Public signals, in snarkjs order (outputs first, then public inputs):
// [0] accountHash [1] nullifier [2] asset [3] threshold [4] timestamp
// [5] issuerAx [6] issuerAy [7] ruleId
include "../node_modules/circomlib/circuits/poseidon.circom";
include "../node_modules/circomlib/circuits/eddsaposeidon.circom";
include "../node_modules/circomlib/circuits/comparators.circom";
include "../node_modules/circomlib/circuits/bitify.circom";
template ZkrynThreshold() {
// "zkryn-v1" as ASCII bytes, big-endian. Ties a signature to this record format only.
var DOMAIN = 0x7a6b72796e2d7631;
signal input asset;
signal input threshold;
signal input timestamp;
signal input issuerAx;
signal input issuerAy;
signal input ruleId;
signal input amount;
signal input account;
signal input sigR8x;
signal input sigR8y;
signal input sigS;
signal output accountHash;
signal output nullifier;
// Range checks keep the comparison honest (no wrap-around in the field).
component amountBits = Num2Bits(64);
amountBits.in <== amount;
component thresholdBits = Num2Bits(64);
thresholdBits.in <== threshold;
component timeBits = Num2Bits(40);
timeBits.in <== timestamp;
component accountBits = Num2Bits(160);
accountBits.in <== account;
component assetBits = Num2Bits(160);
assetBits.in <== asset;
// amount >= threshold
component enough = GreaterEqThan(64);
enough.in[0] <== amount;
enough.in[1] <== threshold;
enough.out === 1;
component acct = Poseidon(1);
acct.inputs[0] <== account;
accountHash <== acct.out;
component msg = Poseidon(5);
msg.inputs[0] <== DOMAIN;
msg.inputs[1] <== asset;
msg.inputs[2] <== amount;
msg.inputs[3] <== timestamp;
msg.inputs[4] <== accountHash;
component sig = EdDSAPoseidonVerifier();
sig.enabled <== 1;
sig.Ax <== issuerAx;
sig.Ay <== issuerAy;
sig.R8x <== sigR8x;
sig.R8y <== sigR8y;
sig.S <== sigS;
sig.M <== msg.out;
// One pass per signed record and rule: the contract refuses a nullifier it has seen.
component nf = Poseidon(2);
nf.inputs[0] <== sigS;
nf.inputs[1] <== ruleId;
nullifier <== nf.out;
}
component main {public [asset, threshold, timestamp, issuerAx, issuerAy, ruleId]} = ZkrynThreshold();