• This repository has been archived on 25/Mar/2024
  • Stars
    star
    201
  • Rank 188,040 (Top 4 %)
  • Language
    Solidity
  • License
    MIT License
  • Created about 1 year ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementation of the system contracts

zkSync Era: System Contracts

Logo

zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum projects can redeploy without refactoring or re-auditing a single line of code. zkSync Era also uses an LLVM-based compiler that will eventually let developers write smart contracts in C++, Rust and other popular languages.

system-contracts

To keep the zero-knowledge circuits as simple as possible and enable simple extensions, we created the system contracts. These are privileged special-purpose contracts that instantiate some recurring actions on the protocol level. Some of the most commonly used contracts:

ContractDeployer This contract is used to deploy new smart contracts. Its job is to make sure that the bytecode for each deployed contract is known. This contract also defines the derivation address. Whenever a contract is deployed, a ContractDeployed event is emitted.

L1Messenger This contract is used to send messages from zkSync to Ethereum. For each message sent, the L1MessageSent event is emitted.

NonceHolder This contract stores account nonces. The account nonces are stored in a single place for efficiency (the tx nonce and the deployment nonce are stored in a single place) and also for the ease of the operator.

Bootloader For greater extensibility and to lower the overhead, some parts of the protocol (e.g. account abstraction rules) were moved to an ephemeral contract called a bootloader.

We call it ephemeral because it is not physically deployed and cannot be called, but it has a formal address that is used on msg.sender, when it calls other contracts.

Building

This repository is used as a submodule of the zksync-era.

Compile the solidity and yul contracts: yarn build

Check the system contracts hashes: yarn calculate-hashes:check

Update the system contracts hashes: yarn calculate-hashes:fix

Update Process

System contracts handle core functionalities and play a critical role in maintaining the integrity of our protocol. To ensure the highest level of security and reliability, these system contracts undergo an audit before any release.

Here is an overview of the release process of the system contracts which is aimed to preserve agility and clarity on the order of the upgrades:

main branch

The main branch contains the latest code that is ready to be deployed into production. It reflects the most stable and audited version of the protocol.

dev branch

The dev branch is for active development & the latest code changes. Whenever a new PR with system contract changes is created it should be based on the dev branch.

Creating a new release

Whenever a new release is planned, a new branch named release-vX-<name> should be created off the dev branch, where X represents the release version, and <name> is a short descriptive name for the release. The PR with the new release should point to either the main branch or to the release branch with a lower version (in case the previous branch has not been merged into main for some reason).

Once the audit for the release branch is complete and all the fixes from the audit are applied, we need to merge the new changes into the dev branch. Once the release is final and merged into the main branch, the main branch should be merged back into the dev branch to keep it up-to-date.

Updating Unaudited Code

Since scripts, READMEs, etc., are code that is not subject to audits, these are to be merged directly into the main branch. The rest of the release branches as well as the dev branch should merge main to synchronize with these changes.

License

The zkSync Era system-contracts are distributed under the terms of the MIT license.

See LICENSE-MIT for details.

Official Links

Disclaimer

zkSync Era has been through lots of testing and audits. Although it is live, it is still in alpha state and will go through more audits and bug bounties programs. We would love to hear our community's thoughts and suggestions about it! It is important to state that forking it now can potentially lead to missing important security updates, critical features, and performance improvements.

More Repositories

1

awesome-zero-knowledge-proofs

A curated list of awesome things related to learning Zero-Knowledge Proofs (ZKP).
4,894
star
2

zksync

zkSync: trustless scaling and privacy engine for Ethereum
Rust
4,750
star
3

zksync-era

zkSync era
Rust
2,841
star
4

zksync-web-era-docs

zkSync Era Documentation
JavaScript
908
star
5

zksync-lite-docs

zkSync documentation
Shell
739
star
6

zksync-wallet-vue

zkSync web wallet
Vue
498
star
7

era-contracts

Smart Contract Submodule For zkSync Era
Solidity
421
star
8

l2-intro-pre-ethdenver

Introduction to layer two and zkSync
TypeScript
322
star
9

era-test-node

In-memory node that can be used for integration testing and debugging.
Rust
307
star
10

zinc

The Zinc language public repository
Rust
307
star
11

hardhat-zksync

TypeScript
266
star
12

era-boojum

Boojum, the scariest SNARK implementation.
Rust
264
star
13

era-sync_vm

Circuit Implementation of zkVM for zkSync Era
Rust
252
star
14

foundry-zksync

Fork of Foundry tailored for zkSync environment
Rust
217
star
15

zksync-cli

CLI tool that simplifies zkSync development
TypeScript
130
star
16

era-tutorial-examples

[DEPRECATED ]Full examples for tutorials in the zkSync Era documentation. Visit: https://github.com/matter-labs/tutorials
TypeScript
127
star
17

zksync-dapp-checkout

zkCheckout โ€” trustable permissionless DeFi payment gateway. Brand new zkSync dApp w/t all L2 perks: fast&cheap transfers / simple&quick withdrawal
Vue
115
star
18

block-explorer

zkSync Era Block Explorer
TypeScript
105
star
19

paymaster-examples

Ready to use paymaster contracts for zkSync Era
TypeScript
93
star
20

hodor

Open source implementation of zkSTARKs in pure Rust
Rust
74
star
21

eip1962

EIP1962 implementation effort
Rust
65
star
22

era-bellman-cuda

A library implementing GPU-accelerated cryptographic functionality for the zkSync prover
Cuda
64
star
23

franklin-crypto

Rust
63
star
24

v2-testnet-contracts

Solidity
60
star
25

zksync-hardhat-template

[DEPRECATED] Template project for zksync-hardhat
TypeScript
60
star
26

era-zk_evm

Out-of-circuit zkEVM implementation
Rust
58
star
27

era-compiler-solidity

EraVM Solidity compiler.
Rust
47
star
28

local-setup

zkSync 2.0 setup for local development
Shell
46
star
29

zksolc-bin

This repository contains current and historical builds of the zkEVM Solidity Compiler.
45
star
30

era-consensus

Consensus layer implementation for zkSync Era
Rust
44
star
31

era-zkevm_test_harness

Compare in-circuit and out-of-circuit VMs
Rust
42
star
32

zksync-link

PayNow - Create payment links, get paid in tokens
Svelte
41
star
33

zk_os

OS for next iteration of the world computer
Rust
40
star
34

era-zkevm_circuits

Rust
39
star
35

curve-zinc

The Curve Stableswap smart contract implementation in Zinc v0.2.2.
Rust
39
star
36

solidity_plonk_verifier

Solidity verifier for Plonk
Solidity
38
star
37

rescue-poseidon

Rescue and Poseidon hash function implementations
Rust
38
star
38

recursive_aggregation_circuit

Kate commitment based PLONK recursive aggregation circuit
Solidity
38
star
39

zksync-withdrawal-finalizer

zkSync 2.0 Withdrawal Finalizer
Rust
38
star
40

tutorials

TypeScript
34
star
41

era-zkevm_opcode_defs

Definitions of zkEVM opcodes (primary dependency for all other repos)
Rust
31
star
42

era-compiler-vyper

EraVM Vyper compiler.
Rust
28
star
43

zkSync-account-abstraction-template

27
star
44

schnorr-musig

Simple Schnorr Multi-Signatures
Rust
26
star
45

custom-aa-tutorial

A full example for the tutorial on custom AA
Solidity
25
star
46

cross-chain-tutorial

TypeScript
24
star
47

era-boojum-cuda

A library implementing GPU-accelerated cryptographic functionality for the zkSync prover.
Rust
24
star
48

era-shivini

A library implementing GPU-accelerated zkSync prover.
Rust
23
star
49

compiler-solidity

The zkEVM Solidity compiler.
Rust
22
star
50

zkvyper-bin

This repository contains current and historical builds of the zkEVM Vyper Compiler.
22
star
51

era-heavy-ops-service

Specialized GPU Prover for zkSync Era
Rust
22
star
52

hackathon-winner-projects

A list of all the projects submitted in all zksync hackathons.
20
star
53

zksync-web-landing

zkSync.io landing page
CSS
20
star
54

era-boojum-validator-cli

Rust
19
star
55

risc_v_simulator

Rust
18
star
56

custom-paymaster-tutorial

Full example for the custom paymaster tutorial in the documentation
TypeScript
18
star
57

z-prize-msm-gpu

Submission for https://www.zprize.io/prizes/accelerating-msm-operations-on-gpu-fpga
Cuda
18
star
58

era-compiler-llvm

The zkEVM fork of the LLVM framework
16
star
59

era-zkevm_tester

Assembly runner for zkEVM testing
Rust
14
star
60

era-compiler-llvm-context

Shared front end code of the EraVM compilers.
Rust
14
star
61

z-prize-msm-gpu-combined

Combined solution from Matter Labs and Yrrid based on their respective submissions for the Z-Prize category Accelerating MSM Operations on GPU/FPGA
Cuda
14
star
62

compiler-llvm

The zkEVM fork of the LLVM framework
13
star
63

era-compiler-tests

The collection of tests for the compilers for zkEVM
Solidity
11
star
64

era-revm

revm (Rust Ethereum VM) translation for Era / zkEVM
Rust
11
star
65

era-zkEVM-assembly

The zkEVM assembly tools
Rust
10
star
66

zksync-contract-templates

Contract Templates for zkSync: solidity, hardhat, vyper
TypeScript
10
star
67

vault-auth-tee

Hashicorp Vault plugin for authenticating Trusted Execution Environments (TEE) like SGX enclaves
Go
10
star
68

ETHLisbon-2022-hackathon

Information about MatterLabs bounty program for ETH Lisbon 2022 hackathon
TypeScript
9
star
69

era-hardhat-with-plugins

A zkSync Hardhat project configured with multiple plugins to improve the developer experience
TypeScript
9
star
70

zksync-packages-info

Information about the different packages and SDKs by MatterLabs to interact with zkSync Era
Vue
9
star
71

.github

zkSync Frontend Team workflow configuration
9
star
72

eravm-spec

Coq
9
star
73

proof_system_info_v1.0

Information about proof system used in zkSync v1.0
8
star
74

zksync-v2-issues

Report issues encountered when using the zkSync 2.0 testnet.
8
star
75

zksync-hardhat-vyper-template

[DEPRECATED] Template project for zksync-cli. Includes a Vyper smart contract, tests and script to deploy to zkSync Era
TypeScript
8
star
76

aa-signature-checker

TypeScript
7
star
77

era-compiler-llvm-builder

EraVM LLVM Framework Builder.
Rust
7
star
78

compiler-infra

Docker images with build tools for compiler repos
Dockerfile
7
star
79

vise

Tools to define and export metrics in Rust libraries and apps
Rust
7
star
80

l2-intro-ethdenver

Introduction to layer 2 protocols and smart contract examples on zkSync for ETH Denver
Vue
7
star
81

demo-circuit

Rust
7
star
82

eip1962_specs

Specification documents for EIP1962
6
star
83

compiler-tests

The compiler tests collection
Solidity
6
star
84

era-fee-withdrawer

TypeScript
6
star
85

zkcli-block-explorer

zkSync Block Explorer module for zkcli
TypeScript
6
star
86

zksync-hardhat-ft-template

Template for a fungible token project on zkSync Era
TypeScript
5
star
87

teepot

Key Value store in a TEE with Remote Attestation for Authentication
Rust
5
star
88

era-zk_evm_abstractions

Rust
5
star
89

multisig

JavaScript
5
star
90

era-compiler-common

Shared constants of the compilers for EraVM.
Rust
5
star
91

zksync-dapp-forced-exit

CSS
5
star
92

era-compiler-tester

zkEVM compilers integration test framework
Rust
5
star
93

simple-oracle-benchmarking

Deploy a simplified oracle, track gas usage.
TypeScript
5
star
94

era-solidity

Solidity compiler and language tuned for EraVM
C++
5
star
95

gated-nft-tutorial

TypeScript
4
star
96

l2-intro-demo

Introduction to layer 2 protocols and smart contract examples on zkSync
TypeScript
4
star
97

greeter-tutorial-starter

Vue
4
star
98

gated-nft-tutorial-starter

TypeScript
4
star
99

zksync-tool-locker

Vue
3
star
100

zinc.github.io

The Zinc circuit book, which corresponds to the version 0.1 of the Zinc language.
HTML
3
star