L2PS Quick Start Guide
This guide walks you through setting up L2PS from scratch on your Demos node.Prerequisites
- Running Demos node
- Node.js 18+
- Docker (for PostgreSQL)
1. Create L2PS Network
Create Configuration Directory
Generate Encryption Keys
Create Config File
Createdata/l2ps/testnet_l2ps_001/config.json:
2. ZK Proof Setup (Optional)
ZK proofs provide cryptographic verification of L2PS batch validity.Without ZK keys, the system still works but batches are submitted without proofs (graceful degradation).
Install Circom
Generate ZK Keys
keys/batch_5/- For 1-5 tx batches (~37K constraints)keys/batch_10/- For 6-10 tx batches (~74K constraints)
3. Start Node
4. Test with POC App
The POC app provides a visual interface to test L2PS transactions.The L2PS POC app is available as a separate repository. Clone it to test your L2PS setup.
Install and Run
Configure Keys
Create.env file in the POC app directory:
5. Send Test Transactions
Via POC App
- Generate or enter a mnemonic
- Connect wallet
- Toggle to L2PS (Private) mode
- Enter recipient and amount
- Click Send L2PS Transaction
Via CLI
6. Verify Results
Wait for batch aggregation, then check:Check Proofs
Check Mempool Status
Expected Results
For 50 transactions:| Metric | Expected |
|---|---|
| Proofs in DB | ~5 (1 per batch of 10) |
| L1 batch transactions | ~5 |
| Mempool status | confirmed |
| Total fees burned | 50 DEM |
Environment Configuration
| Variable | Description | Default |
|---|---|---|
L2PS_AGGREGATION_INTERVAL_MS | Batch check interval | 10000 (10s) |
L2PS_MIN_BATCH_SIZE | Min transactions to batch | 1 |
L2PS_MAX_BATCH_SIZE | Max transactions per batch | 10 |
L2PS_CLEANUP_AGE_MS | Cleanup confirmed after | 300000 (5m) |
Troubleshooting
L2PS config not found
L2PS config not found
Check
data/l2ps/<uid>/config.json exists and JSON is valid.Missing L2PS key material
Missing L2PS key material
Ensure
private_key.txt and iv.txt exist with valid hex values (64 and 32 chars respectively).Client keys don't match node
Client keys don't match node
POC
.env keys must exactly match node key files. Use the auto-copy command above.Insufficient balance
Insufficient balance
Remember: L2PS requires
amount + 1 DEM fee. Fund wallet first.ZK Prover not available
ZK Prover not available
Run
npm run l2ps:zk:setup. System works without ZK (graceful degradation).