Built by Manasvi
This monorepo contains:
- CLI (
@zerosync/cli) - Command-line interface for rollup management - SDK Core (
@zerosync/sdk-core) - Sequencer, Proof Engine, State Manager - API (
@zerosync/api) - Express REST API for frontend integration - Contracts Interface (
@zerosync/contracts-interface) - Ethers.js wrapper for Anchor contract
# Install dependencies
npm install
# Make CLI globally available (optional)
npm link packages/clizerosync init my-rollup
cd my-rollupThis creates:
zerosync.config.json- Rollup configuration.env.example- Environment templatedata/- State storage directory
zerosync simulate --txs 20 --auditThis will:
- Generate 20 dummy transactions
- Batch them according to config
- Generate mock proofs
- Show performance metrics
First, set up your environment:
# Copy .env.example to .env
cp .env.example .env
# Add your private key and RPC URL
# PRIVATE_KEY=0x...
# RPC_URL=https://sepolia.infura.io/v3/YOUR_KEYThen deploy:
zerosync deploy --chain sepoliazerosync run --port 3001The API will start on http://localhost:3001
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| GET | /status |
Rollup status & stats |
| POST | /transactions |
Submit new transaction |
| GET | /batches |
Get all batches |
| GET | /batches/:id |
Get specific batch |
| GET | /proofs |
Get all proofs |
| GET | /proofs/:batchId |
Get specific proof |
| GET | /metrics |
Performance metrics |
| POST | /batch/trigger |
Manually trigger batch (testing) |
curl -X POST http://localhost:3001/api/transactions \
-H "Content-Type: application/json" \
-d '{
"from": "0x1234...",
"to": "0x5678...",
"value": 100
}'zerosync-backend/
├── packages/
│ ├── cli/ # CLI commands (init, simulate, deploy, run)
│ │ ├── bin/
│ │ │ └── zerosync.js
│ │ ├── commands/
│ │ │ ├── init.js
│ │ │ ├── simulate.js
│ │ │ ├── deploy.js
│ │ │ └── run.js
│ │ └── utils/
│ │ └── config.js
│ │
│ ├── sdk-core/ # Core rollup logic
│ │ └── src/
│ │ ├── Sequencer.js # Batch transactions
│ │ ├── ProofEngine.js # Generate mock proofs
│ │ ├── StateManager.js # JSON/SQLite storage
│ │ └── index.js
│ │
│ ├── api/ # Express REST API
│ │ └── src/
│ │ └── server.js
│ │
│ └── contracts-interface/ # Ethers.js integration
│ └── src/
│ └── index.js
│
├── package.json
└── README.md
{
"name": "my-rollup",
"type": "mock-zk",
"rollup": {
"batchSize": 10,
"blockTime": 2000,
"proofInterval": 5,
"gasLimit": 8000000
},
"chain": {
"target": "sepolia",
"rpcUrl": "",
"anchorAddress": ""
}
}# Test init
zerosync init test-rollup
# Test simulate
cd test-rollup
zerosync simulate --txs 10
# Test API
zerosync run
# In another terminal:
curl http://localhost:3001/api/statusState is stored in data/ directory:
data/
├── batches.json # All batches
├── proofs.json # All proofs
└── metrics.json # Performance metrics
- Add SQLite support (currently JSON only)
- Real ZK proof integration (Plonky2/Halo2)
- Plugin system for Polygon CDK, zkSync Stack
- WebSocket support for real-time updates
- Gas estimation improvements
- Runtime: Node.js
- CLI Framework: Commander.js
- API Framework: Express.js
- Blockchain: Ethers.js v6
- State: JSON (upgradeable to SQLite)
npm link packages/clinpm install
# Or reinstall specific package
cd packages/sdk-core && npm installzerosync run --port 3002Manasvi - Backend & SDK Engineer
Questions? Reach out to the team!!!!!!!!