state_mask Circuit
state_mask proves properties about hidden state without revealing it: that a collateral_ratio
lies within a required range and that a hidden_balance exceeds a threshold — while
committing to the secret values with a Poseidon hash. It is a good first circuit for learning the
ZeroStyl workflow. Size: k=10.
What it proves
For witnesses state_value, nonce, collateral_ratio, hidden_balance, and a public
threshold, the circuit proves:
commitment = Poseidon(state_value, collateral_ratio, hidden_balance, nonce)— a hash chain binding all the secret values, exposed as a public input.collateral_ratio ∈ [150, 300]— a bounded range proof.hidden_balance > threshold— a comparison (both operands are range-checked first, so the comparison is sound).
Because the range and comparison operate on the same cells that feed the commitment, the statements are provably about the committed values — not free witnesses.
Use cases: private solvency ("my collateral ratio is healthy and my balance clears this bar") without disclosing the ratio or the balance; credit-scoring; eligibility checks.
Witness
{
"state_value": "42",
"nonce": "7",
"collateral_ratio": "200",
"hidden_balance": "5000",
"threshold": "1000"
}
| Field | Type | Visibility | Description |
|---|---|---|---|
state_value | u64 | private | Secret value committed via Poseidon |
nonce | field | private | Commitment randomness |
collateral_ratio | u64 | private | Must lie in [150, 300] |
hidden_balance | u64 | private | Must be strictly greater than threshold |
threshold | u64 | public | Public minimum balance |
Public inputs
| Input | Description |
|---|---|
commitment | Poseidon(state_value, collateral_ratio, hidden_balance, nonce) |
threshold | The public minimum balance |
Run it
zerostyl-debug debug --circuit state_mask --witnesses state_mask.json
zerostyl-prove generate --circuit state_mask --witnesses state_mask.json --output proof.bin
zerostyl-prove verify --circuit state_mask --proof proof.bin --inputs public_inputs.json