Polygon CDK¶
Overview¶
Polygon Chain Development Kit (CDK) is a modular, open-source software toolkit for blockchain developers that supports the installation and configuration of ZK-powered L2s. There are two primary configurations for chains built with CDK: rollup and validium.
CDK can also be deployed as sovereign chains, which provide a low-cost, less complex execution environment that is pre-configured for integration with the Agglayer.
Note: The latest version of Polygon CDK is forkID12. For more on this release, available configurations, and system architecture, see: Polygon CDK.
Modes of Integration¶
Currently, the Agglayer only supports integration with CDK chains. While CDK chains can be configured across a number of specifications, integration with the Agglayer requires only that the chain provide the inputs required to generate a pessimistic proof.
All chains deployed with Polygon CDK share the same RPC node and sequencer software, CDK-Erigon.
Rollup & Validium¶
CDK chains configured as either rollups or validiums use an EVM-equivalent ZK-EVM to generate state transitions. These two modes differ in how that state is stored.
- Rollups post all transaction data to Ethereum.
- Validiums manage transaction data off-chain via a Data Availability Committee (DAC).
By posting transaction data to Ethereum, rollups provide the additional security guarantee that the state of the chain can always be reconstructed in the event of a liveness failure.
Note: For more on these configurations and their differences, see: Rollups vs. Validiums.
As an additional safeguard, rollups and validiums deployed with CDK include a replayability feature that allows the chain’s state to be rolled back to a checkpoint if an error occurs after a batch has been submitted.
Because rollups and validiums use ZK-proofs to generate state transitions, the current version of the Agglayer allows these chains to use the legacy settlement mechanism without generating a pessimistic proof.
CDK Sovereign¶
CDK chains configured as sovereign are integrated with the Agglayer and store transaction data off-chain using a DAC. These chains do not use a ZK-EVM to generate state transitions. This setup is intended to provide early-stage projects with a lightweight, low-cost execution environment that still supports integration with a ZK prover.
Instead of a ZK-EVM, a sovereign chain attests to its state transition by signing transaction batches generated by the protocol’s sequencer. Pre-configured allowlists determine the addresses that may provide this signature.
CDK Sovereign chains must also provide the inputs required to generate a pessimistic proof. These inputs include: - Local Exit Tree - Last Local Balance Root - Expected Local Balance Root
By generating a valid pessimistic proof, the Agglayer ensures that no chain may withdraw more tokens from the unified bridge than have been deposited into it.
Note: For more on the pessimistic proof and its inputs, see: Pessimistic Proof.
AggSender & AggOracle¶
Currently, connecting to the Agglayer can only be done with an implementation provider because integration with the unified bridge contracts requires modification of the L1 rollup contracts, including the rollup manager.
The integration path for different CDK chain configurations exposes the sub-components and tooling for existing EVM chains not built with CDK to connect to the Agglayer.
Note: For CDK chains in either rollup or validium mode, these sub-components are run automatically by the CDK client, CDK-Erigon.
AggSender¶
The AggSender sub-component is responsible for fetching certificates from chains and communicating the information to the Agglayer using the interop_sendCertificate API.
AggOracle (experimental)¶
AggOracle may be used by chains to fetch the settled Agglayer state, represented by the Global Exit Root, from L1. For users of CDK, this functionality is built into the CDK client and doesn’t require an external service.
- globalExitRootUpdater is used to update the chain’s Global Exit Root.
- This address is configured via the
setGlobalExitRootUpdater
function on the deployedGlobalExitRootManagerL2SovereignChain
contract. - AggOracle will call the
insertGlobalExitRoot
function on the deployedGlobalExitRootManagerL2SovereignChain
contract each time the Global Exit Root is updated on L1.