You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lead with anonymous voting, add poll API docs, sealed results
explanation, wallet auth section, deploy bundle, and CI badge.
Keep ERC templates and .btw DSL as secondary sections.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bitwrap is a tool for modeling state machines as Petri nets and compiling them into ZK proofs and Solidity smart contracts. One model produces the editor view, the circuit constraints, and the contract code.
8
+
Create polls where every vote is backed by a Groth16 proof. No one sees how you voted. Everyone can verify the result is correct. Deploy to any EVM chain.
A Petri net is a directed bipartite graph: places hold tokens, transitions move them, arcs define the rules. This structure is simple enough to draw on a napkin but formal enough to prove properties about.
Every token standard is a Petri net. ERC-20 has three places (balances, allowances, totalSupply) and five transitions (transfer, approve, transferFrom, mint, burn). The arcs encode which maps get decremented and incremented. Guards express the `require` statements. Invariants express conservation laws.
20
+
Three API calls to create a poll, cast a vote, and read results:
16
21
17
-
The same model that a human reads in the editor is the same model that generates the Solidity contract and the same model that compiles to ZK circuit constraints. There's no translation layer, no impedance mismatch, no spec-to-implementation gap.
**Model to proof.**Petri net structure maps directly to ZK circuit constraints. Guards become arithmetic checks (`balance >= amount` becomes a range proof). Arc weights become balance equations. Invariants become circuit assertions. The topology of the net *is* the specification of the circuit.
39
+
**Vote.**Voters register with a commitment hash. When they cast a ballot, a nullifier (derived from `mimcHash(voterSecret, pollId)`) prevents double-voting without revealing identity.
22
40
23
-
**Verifiable execution.**Run a Petri net state machine where each transition firing produces a Groth16 proof. The proof attests that the state change was valid without revealing the full state. Token movements are private but provably correct. The model becomes its own audit trail.
41
+
**Prove.**Each vote generates a Groth16 proof attesting the voter is registered and the ballot is valid — without revealing the choice. The circuit verifies Merkle inclusion in the voter registry, nullifier binding, and vote range.
24
42
25
-
## What it does
43
+
**Tally.** Results stay sealed until the poll closes. Once closed, the final tally is publicly verifiable — anyone can audit the proofs without accessing individual ballots.
26
44
27
-
-**Visual editor** — draw places, transitions, and arcs in the browser. Models are stored as content-addressed JSON-LD (CID = hash of canonicalized RDF).
28
-
-**ERC templates** — start from ERC-20, ERC-721, ERC-1155, or ERC-4626. Each template is a complete Petri net with guards, arcs, and events already wired.
29
-
-**Solidity generation** — produce a deployable `.sol` contract from any template. Guards become `require` statements, arcs become storage operations, events are emitted automatically.
30
-
-**ZK circuits** — Groth16 circuits for each transition type (transfer, mint, burn, approve). Merkle proofs verify state inclusion without revealing balances.
31
-
-**Remix IDE plugin** — generate and deploy contracts directly inside the Remix editor at [solver.bitwrap.io](https://solver.bitwrap.io).
32
-
-**`.btw` DSL** — a compact schema language for defining Petri net models with registers, events, guards, and arc syntax.
45
+
### Sealed results
33
46
34
-
## .btw schema language
47
+
While a poll is active, the results endpoint only returns the vote count. Tallies, nullifiers, and commitments are hidden to prevent observers from diffing the tally after each vote and correlating timing to de-anonymize voters. Full results are exposed only after the poll is closed.
Poll creation requires an EIP-191 `personal_sign` signature from MetaMask or any Ethereum wallet. Voting secrets can be derived from wallet signatures, making the nullifier deterministic per voter per poll — no accounts, no passwords.
0 commit comments