Ethereum: What’s the difference between zkSync `system contracts` and EVM precompiles?

Ethereum: Understanding ZkSync System Contracts and EVM precompiles

When it comes to deploying and executing smart contracts on the Ethereum network, developers have to choose between two popular approaches: zk-Synched (zS) system contracts and EVM precompiles. In this article, we’ll dive into the differences between the two approaches and explore when each is appropriate.

What are ZkSync system contracts?

ZkSynched system contracts are a new standard for deploying Ethereum smart contracts, introduced in June 2021. They aim to improve the performance and security of z-Synched deployments by introducing a more efficient and robust way to execute code on the blockchain.

Here’s how it works:

  • ZS contracts use the EVM (Ethereum Virtual Machine) under the hood, just like other Ethereum contracts.
  • However, ZS contracts have an additional layer of abstraction built into them. They are essentially precompiled assemblies that contain all the code needed to run on the blockchain.
  • When a developer wants to deploy a contract to zk-Synched, they can use a tool like zkSync or Hardhat to create a zS contract assembly from their code.

What are EVM precompilations?

EVM precompilations, also known as “system contracts,” are similar to ZK-Sync system contracts, but instead run on top of the EVM. They allow developers to build and deploy Ethereum smart contracts directly to the blockchain without the need for a separate assembly process.

Here’s how it works:

  • When a developer wants to deploy a contract, they can use a tool like Web3.js or Truffle Suite to create an EVM precompilation from their code.
  • The precompilation is then stored in a decentralized storage solution like the InterPlanetary File System (IPFS).
  • To execute a contract on the blockchain, the developer must link the precompilation to the zS contract assembly using a tool like zkSync or Hardhat.

Key Differences:

Here are the main differences between ZK-Synced system contracts and EVM precompilations:

| | ZK-Sync system contracts | EVM precompilations (system contracts) |

| — | — | — |

|
Execution context | Requires a separate assembly process | Works on top of EVM |

|
Code abstraction

| Another layer of abstraction built into the contract | Native to EVM under the hood |

|
Storage requirements | Requires separate storage solutions (e.g. zS contracts) | No separate storage solutions required |

When to choose ZK-Synced System Contracts?

ZK-Sync System Contracts are a good choice when:

  • You want more control over execution context and code abstraction.
  • Your contract requires additional features or optimizations that cannot be achieved through EVM precompilations.

When to choose EVM precompilations (system contracts)?

Ethereum: What's the difference between zkSync `system contracts` and EVM precompiles?

EVM precompilations (system contracts) are a good choice when:

  • You need to deploy your contract directly to the blockchain without a separate assembly process.
  • Your contract is small in size and requires minimal optimizations.

In conclusion, while both ZK-Synced and EVM precompilations can be used to deploy Ethereum smart contracts, they have significant differences in terms of execution context, code abstraction, and storage requirements. By understanding these differences, developers can choose the approach that best suits their needs and goals.

SOLANA RAYDIUM TRACKING