Validium Docs
  • Overview
  • Connect to Validium
  • Start Coding 🚀
    • Quickstart
      • Overview
      • Deploy using Validium CLI
      • Deploy using Quickstart Repository
      • Deploy your first contract
      • Create an ERC20 token
  • Tooling
    • Block Explorers
    • Hardhat-Validium
      • Overview
      • Installation
      • Guides
        • Getting started
        • Migrating Hardhat project to Validium
        • Compiling non-inlinable libraries
      • Plugins
        • hardhat-zksync
        • hardhat-zksync-solc
        • hardhat-zksync-vyper
        • hardhat-zksync-deploy
        • hardhat-zksync-upgradable
        • hardhat-zksync-verify
        • hardhat-zksync-verify-vyper
        • hardhat-zksync-ethers
        • hardhat-zksync-node
        • Hardhat Community Plugins
    • Foundary
      • Overview
      • Installation
      • Getting Started
      • Migration Guide
        • Overview
        • Compilation
        • Deployment
        • Testing
  • Test and Debug
    • Getting Started
    • Docker L1 - L2 Nodes
    • In-Memory Node
    • Continuous Integration
    • Hardhat
    • Foundry
  • API Reference
    • Overview
    • Conventions
    • ZKs JSON-RPC API
    • Debug JSON-RPC API
    • Ethereum JSON-RPC API
    • PubSub JSON-RPC API
  • Concepts
    • Transaction Lifecycle
    • Blocks and Batches
    • Validium Network Fee Mechanism
    • Finality
    • System Upgrades
    • ZK Chains
    • Data Availability
      • Overview
      • Recreating L2 state from L1 pubdata
      • Validiums
    • Account Abstraction
    • L1 <-> L2 Communication
  • Components
    • Overview
    • Smart & System Contracts
      • Smart Contracts
      • System Contracts
    • Shared Bridges
    • Sequencer / Server
    • Validium Network EVM
      • Overview
      • Bootloader
      • Precompiles
      • Virtual Machine Specification
        • ZKsync Virtual Machine primer
        • VM Formal Specification
    • Prover
      • Overview
      • ZK Terminology
      • Running the Prover
      • Circuits
        • Overview
        • Circuit Testing
        • CodeDecommitter
        • DemuxLogQueue
        • ECRecover
        • KeccakRoundFunction
        • L1MessagesHasher
        • LogSorter
        • Main VM
        • RAMPermutation
        • Sha256RoundFunction
        • StorageApplication
        • Sorting and Deduplicating
          • Overview
          • SortDecommitments
          • StorageSorter
          • LogSorter
      • Boojum Gadgets
      • Boojum Function - `check_if_satisfied`
    • Compiler
      • Compiler Toolchain Overview
        • Compiler Toolchain Overview
        • Solidity Compiler
        • Vyper Compiler
        • LLVM Framework
      • Specification
        • Overview
        • Code Separation
        • System Contracts
        • Exception Handling
        • EVM Legacy Assembly Translator
        • Instructions
          • Instruction Reference
          • EVM
            • Native EVM Instructions
            • Arithmetic
            • Bitwise
            • Block
            • Call
            • Create
            • Environment
            • Logging
            • Logical
            • Memory
            • Return
            • Sha3
            • Stack
          • Extensions
            • Overview
            • Validium Network Extension Simulation (call)
            • Validium Network Extension Simulation (verbatim)
          • EVM Legacy Assembly
          • Yul
        • EraVM Binary Layout
    • Fee Withdrawer
    • Portal - Wallet + Bridge
    • Block Explorer
    • Transaction filtering
Powered by GitBook
On this page
  • High-level Source Code Compilers
  • IR Compilers
  • Assembler
  • Hardhat Plugins
  • Installing and configuring plugins
  1. Components
  2. Compiler
  3. Compiler Toolchain Overview

Compiler Toolchain Overview

PreviousCompiler Toolchain OverviewNextSolidity Compiler

Last updated 8 months ago


This section introduces the zkEVM LLVM-based compiler toolchain for smart contract languages with Ethereum Virtual Machine (EVM) support. The toolchain works on top of existing compilers and requires their output, which typically includes intermediate representations (IRs), abstract syntax trees (ASTs), and auxiliary contract metadata and documentation.

At the time of writing, we support Solidity and Vyper.

The toolchain consists of the following:

  1. : solc and vyper.

  2. : zksolc and zkvyper.

  3. with a zkEVM back end which emits zkEVM text assembly.

  4. which produces the zkEVM bytecode from text assembly.

  5. which set up the environment.

Compiler Toolchain Visualization

High-level Source Code Compilers

High-level source code is processed by third-party compilers. These compilers do the following:

  1. Process and validate the high-level source code.

  2. Translate the source code into IR and metadata.

  3. Pass the IR and metadata to our IR compilers via the standard I/O streams.

We are using two high-level source code compilers at the time of writing:

IR Compilers

Our toolchain includes LLVM front ends, written in Rust, that process the output of high-level source code compilers:

These IR compilers perform the following steps:

  1. Receive the input, which is usually standard or combined JSON passed by the Hardhat plugin via standard input.

  2. Save the relevant data, modify the input with zkEVM settings, and pass it to the underlying high-level source code compiler which is called as a child process.

  3. Receive the IR and metadata from the underlying compiler.

  4. Translate the IR into LLVM IR, resolving dependencies with the help of metadata.

  5. Optimize the LLVM IR with the powerful LLVM framework optimizer and emit zkEVM text assembly.

  6. Print the output matching the format of the input method the IR compiler is called with.

Our IR compilers leverage I/O mechanisms which already exist in the high-level source code compilers. They may modify the input and output to some extent, add data for features unique to zkEVM, and remove unsupported feature artifacts.

Assembler

Hardhat Plugins

Installing and configuring plugins

: the official Solidity compiler. For more info, see the latest .

: the official Vyper compiler. For more info, see the latest .

Security and best practices: Follow the to build smart contracts on ZKsync Era.

which calls solc as a child process. For more info, see the latest .

: which calls vyper as a child process. For more info, see the latest .

The , which is written in Rust, compiles zkEVM assembly to zkEVM bytecode. This tool is not a part of our LLVM back end as it uses several cryptographic libraries which are easier to maintain outside of the framework.

We recommend using our IR compilers via . Add these plugins to the Hardhat's config file to compile new projects or migrate existing ones to ZKsync Era. For a lower-level approach, download our compiler binaries via the links above and use their CLI interfaces.

Add the plugins below to the Hardhat's config file to compile new projects or migrate existing ones to ZKsync Era. For a lower-level approach, download our compiler binaries and use their CLI interfaces.

solc
Solidity documentation
vyper
Vyper documentation
security considerations and best practices
zksolc
zksolc documentation
zkvyper
zkvyper documentation
assembler
their corresponding Hardhat plugins
links above
hardhat-zksync-solc documentation
hardhat-zksync-vyper documentation
High-level source code compilers
IR compilers, front ends to LLVM
The LLVM framework
The assembler
Hardhat plugins