Skip to content

Releases: stackdump/bitwrap-io

v1.0.0 — .btw DSL + Full E2E Pipeline

04 Apr 05:55
dee260f

Choose a tag to compare

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]uint256 shorthand for nested mappings
  • # and // comments
  • --output dir saves 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-wallet

10 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

  • .btw DSL with nested map support (map[k1,k2]v)
  • DSL guardrails: type checking, reserved names, guard validation, arc validation
  • bitwrap -validate command with --output flag
  • # comment support
  • GenerateProduction() 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

02 Apr 21:26
35be94b

Choose a tag to compare

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 with forge 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 (approvedto/isApproved)
  • Fix ERC4626 missing maxWithdraw/maxRedeem view functions
  • Fix ERC5725 event memory keyword, struct field, vesting helper names
  • Fix state variable initialization for non-zero Initial values
  • Fix scalar arc weight (use literal 1 instead of amount parameter)
  • 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

27 Mar 14:43
183b9b6

Choose a tag to compare

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 upgradedgo 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

27 Mar 14:09
7b58d04

Choose a tag to compare

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

19 Mar 20:11
834c86d

Choose a tag to compare

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 boundsmaxChoices public 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

  • IVerifier interface with Groth16 proof verification in castVote
  • 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 results
  • bitwrap.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

18 Mar 14:13
e3c9869

Choose a tag to compare

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 ./keys persists circuit keys across restarts
  • First startup compiles circuits + saves keys; subsequent starts load instantly
  • GET /api/vk/{circuit} — export verifying key
  • GET /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 tree
  • witness-builder.js — witness builders for all 6 circuits
  • safemath.js — U256 overflow-checked arithmetic
  • model.js — Petri net model with validation
  • state.js — state machine execution (fire, enabled, canReach)
  • bridge.js — Schema <-> Model conversion

Breaking Changes

  • arc/ moved from internal/arc/ — now importable as github.com/stackdump/bitwrap-io/arc
  • public/ moved to repo root — CDN path is now @latest/public/
  • internal/static/ removed
  • NewArcnetService() now takes a keyDir string parameter

v0.1.0

18 Mar 03:03
db6896c

Choose a tag to compare

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)
  • .btw DSL compiler
  • CID-based content-addressed model storage
  • SVG rendering of Petri net models