Building Your Own Layer 2: From Optimistic Rollup to ZK Stack

Building Your Own Layer 2: From Optimistic Rollup to ZK Stack «We need our own L2» — a phrase I hear from clients. Sometimes it’s genuinely necessary: the project processes thousands of transactions per second, doesn’t want to pay high Ethereum gas fees, and isn’t ready to depend on third-party i

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1309
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1270
  • image_logo-advance_0.webp
    B2B Advance company logo design
    719
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1011
  • image_logo-aider_0.webp
    AIDER company logo development
    954
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1062

Building Your Own Layer 2: From Optimistic Rollup to ZK Stack

«We need our own L2» — a phrase I hear from clients. Sometimes it’s genuinely necessary: the project processes thousands of transactions per second, doesn’t want to pay high Ethereum gas fees, and isn’t ready to depend on third-party infrastructure. But more often than not, an existing L2 would suffice. Before building your own rollup, honestly ask: do you need an application-specific rollup, or just cheap transactions? In the latter case, deploying on Arbitrum or OP Stack takes days, not months. Transaction cost savings reach 90% compared to L1 — tens of thousands of dollars per month for active dApps.

How to Choose Between Optimistic and ZK Rollup?

The choice of L2 architecture is a trade-off between withdrawal speed, complexity, and security. Optimistic Rollup is simpler: it’s EVM-compatible, uses fraud proofs, and finalizes in 7 days (with a bridge, instantaneous for liquid assets). ZK Rollup is more complex but offers instant finality and cryptographic guarantees. For early-stage projects, Optimistic is better — fast launch on OP Stack. If instant finality is critical (e.g., for DeFi with frequent withdrawals) — go ZK. Validium (ZK with off-chain data) offers even lower fees but weaker data availability guarantees. An application-specific chain on Cosmos SDK gives full independence but requires deep engineering.

Development on OP Stack: Key Components

OP Stack is the most mature framework for EVM-compatible Optimistic Rollup. The architecture is standard: L1 contracts (OptimismPortal, L2OutputOracle, DisputeGameFactory) and L2 clients (op-node, op-geth, op-batcher, op-proposer). Deployment includes configuration and node startup.

git clone https://github.com/ethereum-optimism/optimism.git cd optimism && git checkout op-contracts/v1.6.0 pnpm install make op-node op-batcher op-proposer # Configuration in deploy-config.json (example below) forge script scripts/deploy/Deploy.s.sol:Deploy \ --rpc-url $L1_RPC_URL --broadcast --private-key $DEPLOYER_PRIVATE_KEY --slow 
{ "l1ChainID": 1, "l2ChainID": 42069, "l2BlockTime": 2, "l1BlockTime": 12, "maxSequencerDrift": 600, "sequencerWindowSize": 3600, "channelTimeout": 300, "p2pSequencerAddress": "0x...", "batchInboxAddress": "0xff00000000000000000000000000000000042069", "batchSenderAddress": "0x...", "l2OutputOracleSubmissionInterval": 120, "l2OutputOracleStartingBlockNumber": 0, "l2OutputOracleStartingTimestamp": null, "l2OutputOracleProposer": "0x...", "l2OutputOracleChallenger": "0x...", "finalizationPeriodSeconds": 604800, "proxyAdminOwner": "0x...", "baseFeeVaultRecipient": "0x...", "l1FeeVaultRecipient": "0x...", "sequencerFeeVaultRecipient": "0x...", "enableGovernance": false, "governanceTokenSymbol": "OP", "governanceTokenName": "Optimism", "eip1559Denominator": 50, "eip1559Elasticity": 6, "l2GenesisBlockGasLimit": "0x2faf080", "l2GenesisBlockBaseFeePerGas": "0x3B9ACA00" } 

With the Dencun update (EIP-4844), L2s publish data via blobs — cutting L1 costs by 10–100x. For high-load L2s, you can configure an external DA layer (EigenDA, Celestia) as a fallback.

Why the Sequencer Is the Weakest Link in L2

The classic OP Stack has a single trusted sequencer — a trade-off of convenience for centralization. For production projects, consider a shared sequencer (Espresso Systems) or a based rollup (sequencer-free, blocks proposed by L1 validators). At a minimum, put the sequencer behind a multisig with monitoring and automatic force-include for users the sequencer ignores. Misconfiguring the sequencer can lead to loss of funds — as shown by incidents on Ronin and Nomad.

ZK Path: zkSync ZK Stack

If you choose ZK Rollup, ZK Stack from Matter Labs is the go-to. Installation is straightforward:

curl -L https://raw.githubusercontent.com/matter-labs/zksync-era/main/zkstack_cli/zkstackup/install | bash zkstackup zkstack ecosystem create zkstack chain create --chain-name mychain --chain-id 12345 

Proof generation requires a GPU: on a CPU (~32 cores) — 15–30 minutes per batch; on an RTX 4090 — 2–5 minutes. For projects with frequent transactions, a GPU prover is mandatory.

How Fast Can You Launch an L2 in Production?

Phase OP Stack ZK Stack Cosmos SDK
Deployment & configuration 1–2 weeks 2–4 weeks 4–8 weeks
Bridge + explorer 1–2 weeks 2–3 weeks 2–4 weeks
Infrastructure audit 2–4 weeks 4–8 weeks 4–8 weeks
Production-ready 1–2 months 2–4 months 3–6 months

Monthly L1 gas costs can drop from $5,000 to $500 thanks to blobs. Exact figures depend on network activity. In one project, we reduced monthly gas spend from $8,000 to $700 after switching to a blob-based L2.

What Is Included in the Work

The deliverables include:

  • Designing the L2 architecture tailored to your requirements (technology choice, chain parameters)
  • Deploying and configuring the entire infrastructure (sequencer, nodes, batcher, proposer, block explorer)
  • Integrating a bridge for standard and custom tokens
  • Setting up monitoring and alerting (Tenderly, Grafana)
  • Security auditing with Slither, Mythril, Echidna
  • Operations documentation and team training
  • Launch support (first 30 days)

A custom L2 is not a one-time job — it’s an operational responsibility. Someone must watch the nodes, update clients, monitor the bridge, and respond to incidents 24/7.

Contact us for a detailed consultation on architecture selection and project assessment. Order a preliminary security audit of your L2 — we will check the configuration and smart contracts for common vulnerabilities.