# @matterlabs/hardhat-zksync-vyper

> Hardhat plugin to compile Vyper smart contracts for the ZKsync network

Latest version **1.4.0** (published 2025-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @matterlabs/hardhat-zksync-vyper
pnpm add @matterlabs/hardhat-zksync-vyper
yarn add @matterlabs/hardhat-zksync-vyper
bun add @matterlabs/hardhat-zksync-vyper
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2025-07-30 |
| First published | 2022-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 147.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 285 |
| Author | Matter Labs |
| Maintainers | npm-matterlabs, andreyg |
| Keywords | ethereum, smart-contracts, hardhat, hardhat-plugin, ZKsync, vyper |

## Links

- npm: https://www.npmjs.com/package/@matterlabs/hardhat-zksync-vyper
- Repository: https://github.com/matter-labs/hardhat-zksync
- Homepage: https://github.com/matter-labs/hardhat-zksync/tree/main/packages/hardhat-zksync-vyper
- Issues: https://github.com/matter-labs/hardhat-zksync/issues
- npm.io page: https://npm.io/package/@matterlabs/hardhat-zksync-vyper

## Dependencies (10)

- [chai](https://npm.io/package/chai.md) ^4.3.4
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [sinon](https://npm.io/package/sinon.md) ^18.0.0
- [semver](https://npm.io/package/semver.md) ^7.6.2
- [undici](https://npm.io/package/undici.md) ^6.18.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.2.0
- [dockerode](https://npm.io/package/dockerode.md) ^4.0.2
- [sinon-chai](https://npm.io/package/sinon-chai.md) ^3.7.0
- [@nomiclabs/hardhat-docker](https://npm.io/package/@nomiclabs/hardhat-docker.md) ^2.0.2
- [@matterlabs/hardhat-zksync-telemetry](https://npm.io/package/@matterlabs/hardhat-zksync-telemetry.md) ^1.1.1

## Recent versions

- 1.4.0 (latest) — 2025-07-30
- 0.2.0-beta.1 (beta) — 2023-06-20
- 1.3.0 — 2025-06-06
- 1.2.1 — 2025-05-12
- 1.2.0 — 2025-03-25
- 1.1.1 — 2024-10-21
- 1.1.0 — 2024-09-05
- 1.0.8 — 2024-02-26
- 1.0.7 — 2024-01-25
- 1.0.6 — 2024-01-15
- 1.0.5 — 2023-12-22
- 1.0.4 — 2023-12-13
- 1.0.3 — 2023-12-01
- 1.0.2 — 2023-11-23
- 1.0.1 — 2023-11-22
- … 14 more at https://npm.io/package/@matterlabs/hardhat-zksync-vyper/versions

## README

# hardhat-zksync-vyper 🚀

[Hardhat](https://hardhat.org/) plugin that adds ZKsync-specific capabilities to vyper.

![Era Logo](https://github.com/matter-labs/era-contracts/raw/main/eraLogo.svg)

## 📥 Installation

To install **hardhat-zksync-vyper** plugin, run:

`npm install -D @matterlabs/hardhat-zksync-vyper`

or

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

## 🔧 Setup

**Scaffold a new project**

Use the ZKsync Era cli to set up a project.

`npx zksync-cli@latest create project greeter-vyper-example --template hardhat_vyper`
`cd greeter-vyper-example`


Update the hardhat.config.ts file with: 

`import "@matterlabs/hardhat-zksync-vyper";`

```
const config: HardhatUserConfig = {
  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
      },
    },
  },
}
  ...
```

| 🔧 properties              | 📄 Description                                                                                                                       |
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| version                    | zkvyper compiler version. Default value is latest                                                                                    |
| compilerSource             | Indicates the compiler source and can be either binary. (A docker option is no longer recommended).                                  |
| compilerPath               | Optional field with the path to the zkvyper binary. By default, the binary in $PATH is used.                                         |
| libraries                  | Define any non-inlinable libraries your contracts use as dependencies here                                                           |
| optimizer                   | Compiler optimizations mode: 3 (default), fallback_to_optimizing_for_size: false (default) recommended for most projects.          |
| dockerImage                 | (deprecated) option used to identify the name of the compiler docker image.                                          |


Learn more about [compiling libraries](https://docs.zksync.io/build/tooling/hardhat/compiling-libraries).

**Create a simple vyper contract**

The ZKsync Era cli generates a contracts folder which includes a Greeter.sol contract.

- Delete Greeter.sol from the contracts/ directory.
- Add the equivalent Greeter.vy Vyper contract:

```
# @version ^0.3.3

greeting: constant(String[100]) = "Hello, World!"

@external
@view
def greet() -> String[100]:
    return self.greeting
```

**Compile the contract**

`yarn hardhat compile`

**Create deployment script**

First update the use-greeter.ts script, supplied by the CLI in the deploy/ directory by importing contract from correct location.

`import * as ContractArtifact from "../artifacts-zk/contracts/Greeter.vy/Greeter.json";`

**Add private key to environment variables**

Remove example from the .env.example file and add your private key to <WALLET-PRIVATE-KEY>.

Deploy the contract

`yarn hardhat deploy-zksync --script deploy-greeter.ts`

**Output**

You should see something like this:

```
Running deploy function for the Greeter contract
The deployment is projected to cost 0.000135806 ETH
constructor args:0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000094869207468657265210000000000000000000000000000000000000000000000
Greeter was deployed to 0x7CDF8A4334fafE21B8dCCe70487d6CBC00183c0d
```

## 📝 Documentation

In addition to the [hardhat-zksync-vyper](https://docs.zksync.io/build/tooling/hardhat/hardhat-zksync-vyper), ZKsync's Era [website](https://docs.zksync.io/build) offers a variety of resources including:

[Guides to get started](https://docs.zksync.io/build/start-coding/zksync-101): Learn how to start building on ZKsync Era.\
[Hardhat ZKsync Era plugins](https://docs.zksync.io/build/tooling/hardhat/getting-started): Overview and guides for all Hardhat ZKsync Era plugins.\
[ZK Chains](https://docs.zksync.io/zk-stack/concepts/zk-chains#what-are-zk-chains): Deep dive into the concept of ZK chains.

## 🤝 Contributing

Contributions are always welcome! Feel free to open any issue or send a pull request.

Go to [CONTRIBUTING.md](https://github.com/matter-labs/hardhat-zksync/blob/main/.github/CONTRIBUTING.md) to learn about steps and best practices for contributing to ZKsync hardhat tooling base repository.  


## 🙌 Feedback, help and news

[ZKsync Era Discord server](https://join.zksync.dev/): for questions and feedback.\
[Follow ZKsync Era on Twitter](https://twitter.com/zksync)

## Happy building! 👷‍♀️👷‍♂️

---
_Source: https://npm.io/package/@matterlabs/hardhat-zksync-vyper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
