Releases: stackdump/bitwrap-io
v1.0.0 — .btw DSL + Full E2E Pipeline
bitwrap 1.0
Write Petri net models in .btw, get validated Solidity smart contracts.
.btw DSL
./bitwrap -validate examples/erc20.btw parse examples/erc20.btw
schema ERC20 (3 states, 5 actions, 10 arcs)
solidity ERC20.sol (5023 bytes), tests (2125 bytes), genesis (1083 bytes)
compile ok
test 10 passed
deploy 0x5FbDB2315678afecb367f032d93F642f64180aa3
PASS
- Full syntax: registers, functions, guards, events, arcs, nested maps
map[address,address]uint256shorthand for nested mappings#and//comments--output dirsaves generated Foundry project- Human-readable errors: type mismatches, unknown identifiers, reserved names, duplicate declarations
Validated Pipeline
Every generated contract is proven to compile, deploy, and pass tests:
| Template | Forge Tests | On-Chain |
|---|---|---|
| ERC20 | 10/10 ✅ | 5/5 ✅ |
| ERC721 | 10/10 ✅ | 5/5 ✅ |
| ERC1155 | 12/12 ✅ | 7/7 ✅ |
| ERC4626 | 10/10 ✅ | 1/5 |
| ERC5725 | 10/10 ✅ | 4/6 |
| Vote | 6/6 ✅ | 2/3 |
Three-Way Execution Parity
Go runtime, JavaScript runtime, and generated Solidity produce identical state for the same inputs. Tested in CI.
Dev Wallet
Test the full poll flow without MetaMask:
./bitwrap -port 8088 -dev
# open http://localhost:8088/poll?dev-wallet10 anvil accounts available via /api/dev/sign for multi-signer testing.
CI Pipeline
5 parallel jobs: lint, build, test, js-parity, playwright (19 browser tests).
What's New Since v0.9.0
.btwDSL with nested map support (map[k1,k2]v)- DSL guardrails: type checking, reserved names, guard validation, arc validation
bitwrap -validatecommand with--outputflag#comment supportGenerateProduction()strips test backdoors- Go/JS/Solidity execution parity (arc weights, read-arc detection)
- Fix secp256k1 signature recovery for Go 1.25
- Built-in dev wallet with 10 anvil accounts
- 19 Playwright e2e tests in CI
- 4 example .btw files with syntax reference
v0.9.0 — E2E Validated Solidity Generation
What's New
Validated end-to-end Solidity generation pipeline: every generated ERC template now compiles, deploys, and passes all generated Foundry tests.
E2E Testing Pipeline
- Foundry E2E (
make test-e2e): generates contracts for all 6 templates, compiles withforge build, deploys to local anvil, exercises transitions on-chain using Petri net reachability BFS - Playwright E2E (
make test-playwright): browser smoke tests for landing page, editor, polls UI, and all API endpoints - 100% forge test pass rate: 58/58 generated tests pass across ERC20, ERC721, ERC1155, ERC4626, ERC5725, Vote
On-Chain Validation
| Template | Forge Tests | On-Chain Fires |
|---|---|---|
| ERC20 | 10/10 ✅ | 5/5 ✅ |
| ERC721 | 10/10 ✅ | 5/5 ✅ |
| ERC1155 | 12/12 ✅ | 7/7 ✅ |
| ERC4626 | 10/10 ✅ | 1/5 (external assets) |
| ERC5725 | 10/10 ✅ | 3/5 (multi-step deps) |
| Vote | 6/6 ✅ | 2/3 (ZK proof by design) |
Codegen Fixes
- Fix ERC721/1155 variable shadowing (
approved→to/isApproved) - Fix ERC4626 missing
maxWithdraw/maxRedeemview functions - Fix ERC5725 event
memorykeyword, struct field, vesting helper names - Fix state variable initialization for non-zero
Initialvalues - Fix scalar arc weight (use literal 1 instead of
amountparameter) - Read-arc detection: skip decrements for read-then-write map patterns
- ERC721 balance arcs use explicit weight 1 (NFTs transfer exactly 1)
- Vote genesisgen now includes constructor args
Petri Net Reachability
The e2e test uses BFS over the Petri net model to find firing sequences that cover all transitions, then executes them against deployed contracts with multi-actor orchestration (owner, token holder, spender roles).
v0.8.0 — Production Ready
What's New since v0.7.0
- Live demo poll on landing page — fetches active polls inline, click to vote
- Wallet-Native Auth callout — MetaMask integration surfaced in the "Why ZK Voting?" section
- Deploy to Your Chain section — Foundry bundle download with 3-command workflow on the landing page
- Poll test coverage — 18 new tests covering poll creation, voting (duplicate nullifiers, closed/expired polls), and sealed-results enforcement
- CI pipeline upgraded —
go vet+ race detector + JS parity checks, all green - README rewritten — leads with ZK voting, full poll API docs, sealed results explanation, voting .btw DSL example
CI
| Job | Status |
|---|---|
| lint | go vet |
| build | make build |
| test | go test -race (18 poll tests + existing suite) |
| js-parity | MiMC + Merkle parity + JS syntax |
v0.7.0 — ZK Voting
What's New
- Landing page reoriented around ZK voting — hero, how-it-works, and feature sections now lead with anonymous on-chain voting
- API quick-start section — curl examples for poll creation, vote casting, and results
- Sealed results — tallies, nullifiers, and commitments are hidden while a poll is active to prevent vote-timing correlation attacks; full results exposed only after the poll closes
Commits
- Reorient landing page around ZK voting
- Tighten hero, add API quick-start section
- Seal poll results while voting is open
v0.6.3: ZK Polls
bitwrap v0.6.3
Anonymous voting with zero-knowledge proofs. Create polls, cast secret ballots, verify results — all from a Petri net model.
ZK Poll System
- Vote template — visual Petri net model for voting state machines (voterRegistry, nullifiers, tallies, pollConfig)
- VoteCast circuit — Groth16 proof of voter eligibility and valid choice without revealing identity or choice
- Secret ballots — vote choice hidden behind blinded commitment
mimcHash(voterSecret, choice), can't be brute-forced - Circuit-enforced bounds —
maxChoicespublic input rejects out-of-range choices at the proof level - 5 public inputs: pollId, voterRegistryRoot, nullifier, voteCommitment, maxChoices
Poll Lifecycle
- Create — wallet signature required (EIP-191 personal_sign), rate limited (5/hr per IP + wallet)
- Vote — ZK proof generated client-side, server re-verifies via gnark, tally updated in real-time
- Close — only the creator's wallet can close
- Results — event-sourced through the Petri net runtime:
State(t) = fold(apply, initialState, events[0..t])
Privacy Model
| Data | Visibility |
|---|---|
| Voter identity | Hidden (nullifier unlinkable to registry leaf) |
| Vote choice | Hidden (blinded commitment, never persisted per-vote) |
| Voter secret | Hidden (never leaves browser) |
| Vote count | Public |
| Per-choice tallies | Public (derived from event log) |
On-Chain Governance
IVerifierinterface with Groth16 proof verification incastVote- Contract stores
voteCommitments[nullifier], not plaintext choices - Foundry bundle: contract + verifier + tests + deploy script (8/8 tests pass)
- Constructor:
(voterRegistryRoot, maxChoices, verifier)
Poll UI
bitwrap.io/poll— create, vote, close, view resultsbitwrap.io/poll#deploy— download Foundry bundle or Solidity contract- MetaMask integration for poll creation and wallet-derived voter secrets
API Endpoints
| Method | Path | Purpose |
|---|---|---|
POST |
/api/polls |
Create poll (wallet sig required) |
GET |
/api/polls/{id} |
Get poll config + state |
POST |
/api/polls/{id}/vote |
Submit ZK-proven vote |
POST |
/api/polls/{id}/close |
Close poll (creator only) |
POST |
/api/polls/{id}/reveal |
Reveal vote (fallback) |
GET |
/api/polls/{id}/results |
Tallies from event log |
GET |
/api/polls/{id}/nullifiers |
Public audit log |
Size Limits
- Title: 200 chars, Description: 2000 chars
- Choices: 2–256 (matches circuit's 8-bit range proof)
- Voter commitments: 10,000 max
- Duration: up to 90 days
v0.2.0
bitwrap v0.2.0
Client-side ZK proving, EVM deployment, and full Go/JS parity.
New: WASM Prover
- Groth16 proving runs entirely in the browser via WASM
- Load pre-compiled keys from server or compile circuits offline
- Build with
make wasm(~4.6MB gzipped)
New: Key Persistence
-key-dir ./keyspersists circuit keys across restarts- First startup compiles circuits + saves keys; subsequent starts load instantly
GET /api/vk/{circuit}— export verifying keyGET /api/vk/{circuit}/solidity— export Solidity verifier contract
New: EVM Deployment
GET /api/bundle/{template}— download complete Foundry project (contract + verifier + tests + deploy script)- Remix plugin now deploys both contract and ZK verifier to workspace
- Added "Foundry Bundle" download button to Remix plugin
New: Full Go/JS Parity
mimc.js— MiMC-BN254 hash (verified against Go)merkle.js— fixed-depth binary Merkle treewitness-builder.js— witness builders for all 6 circuitssafemath.js— U256 overflow-checked arithmeticmodel.js— Petri net model with validationstate.js— state machine execution (fire, enabled, canReach)bridge.js— Schema <-> Model conversion
Breaking Changes
arc/moved frominternal/arc/— now importable asgithub.com/stackdump/bitwrap-io/arcpublic/moved to repo root — CDN path is now@latest/public/internal/static/removedNewArcnetService()now takes akeyDirstring parameter
v0.1.0
bitwrap v0.1.0
First release — Petri nets as ZK containers.
Features
- Visual Petri net editor with JSON-LD save/load
- 6 Groth16 ZK circuits: transfer, mint, burn, approve, transferFrom, vestClaim
- MiMC-BN254 Merkle state trees (Go + JS parity)
- Client-side witness builder for all circuits
- Solidity contract generation from ERC templates (020, 0721, 01155, 04626, 05725)
.btwDSL compiler- CID-based content-addressed model storage
- SVG rendering of Petri net models