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
  • Prerequisite
  • Installation
  • Configuration
  • Commands
  1. Tooling
  2. Hardhat-Validium
  3. Plugins

hardhat-zksync-vyper

Guide on using the hardhat-zksync-vyper plugin.

Previoushardhat-zksync-solcNexthardhat-zksync-deploy

Last updated 7 months ago


The plugin provides an interface for compiling Vyper smart contracts before deploying them to ZKsync Era.

Learn more about the latest updates in the .

Prerequisite

To use the hardhat-zksync-vyper in your project, we recommend that:

  • You have Node installed and yarn or npm package manager.

Installation

Add the latest version of this plugin to your project with the following command:

yarn add -D @matterlabs/hardhat-zksync-vyper @nomiclabs/hardhat-vyper

Configuration

hardhat-zksync-vyper v0.2.0 introduced a default configuration so all parameters are optional.

Any configuration parameters should be added inside a zkvyper property in the hardhat.config.ts file:

zkvyper: {
    version: "latest", // Uses latest available in https://github.com/matter-labs/zkvyper-bin
    settings: {
      // compilerPath: "zkvyper", // optional field with the path to the `zkvyper` binary.
      libraries: {}, // optional. References to non-inlinable libraries
      optimizer: {
        mode: '3' // optional. 3 by default, z to optimize bytecode size
        fallback_to_optimizing_for_size: false, // optional. Try to recompile with optimizer mode "z" if the bytecode is too large
      },
      experimental: {
        dockerImage: '', // deprecated
        tag: ''   // deprecated
      },
    },
  }

Compilers are no longer released as Docker images and its usage is no longer recommended.

  • compilerSource: Indicates the compiler source and can be either binary. (A docker option is no longer recommended). If there is no previous installation, the plugin automatically downloads one.

  • optimizer - Compiler optimizations:

    • mode: 3 (default) recommended for most projects. Mode z reduces bytecode size for large projects that make heavy use of keccak and far calls.

    • fallback_to_optimizing_for_size (optional) indicates that the compiler will try to recompile with optimizer mode "z" if the bytecode is too large.

  • compilerPath: Optional field with the path to the zkvyper binary. By default, the binary in $PATH is used.

fallback_to_optimizing_for_size option is supported for zkvyper compiler version 1.3.15 or higher.

Commands

yarn hardhat compile

Compiles all the smart contracts in the contracts directory and creates the artifacts-zk folder with all the compilation artifacts, including factory dependencies for the contracts, which could be used for contract deployment.

version: The zkvyper compiler version. Default value is latest. Find the latest compiler versions in the .

libraries: Define any non-inlinable libraries your contracts use as dependencies here. Learn more about .

@matterlabs/hardhat-zksync-vyper
changelog
@matterlabs/hardhat-zksync-vyper
zkvyper repo
compiling libraries