Getting started

Learn to build and deploy smart contracts on ZKsync Era.

Welcome to ZKsync 101 for deploying smart contracts on ZKsync! In this guide, we'll walk you through the process of creating and deploying a simple smart contract that creates a crowdfunding campaign for Zeek.

By the end of the series, you will learn integral pieces that will help you become a great developer on ZKsync! You will learn how to:

Initialize a new project with zksync-cli.

Deploy contracts on ZKsync Era using Hardhat or Foundry.

Test your contracts with Hardhat or Foundry.

Implement upgradable patterns for your contracts.

Implement a Paymaster to simplify transactions for your users.

Install zksync-cli

Our Quickstart series utilizes the zksync-cli to help you develop and interact with ZKsync from your local machine. Check out our zksync-cli section to learn more on how to use the CLI.

You will need to install a couple tools to effectively use zksync-cli:

Install Node.js or

You will need either Node.js or The choice depends on your project's requirements and personal preference for package management and execution speed. If you are unfamiliar with both, choose Node.js.

  • Node.js
    • Obtain the latest version from the Bun installation page. is known for its high performance and modern JavaScript features.

Setup era local node (optional)

Our Quickstart series will have you compile and deploy contracts to ZKsync Sepolia Testnet which requires you to have ETH in your wallet for funding transactions. Alternatively, our zksync-cli tool provides a way for you to setup a test node locally. This era local node allows for quicker testing and debugging processes without incurring testnet transaction costs.

Install Docker

The era local node will need Docker to run locally on your machine. Download the appropriate version from the Docker website.

Run a local ZKsync Era node

Run the following command in your terminal:

zksync-cli dev start

Choose "In memory node" to deploy a local ZKsync Era node in a Docker container.

The local era node will also include pre-configured rich wallets for use, visit era-test-node rich wallets.

Your local ZKsync Era node is accessible at, ready for deployment or testing purposes. Leave this terminal open and running as you build your projects. When you are done running your local Era node, you can stop it with Ctrl+C.

Choose Hardhat or Foundry

Our Quickstart series provides two options for your learning process using either Hardhat or Foundry. Pick one to use and stick with as you go through each of the guides.

Install foundry-zksync

If you choose to use Foundry for the Quick Start series, you will need to install the foundry-zksync tool. This tool is a specialized fork of Foundry, tailored for ZKsync. It extends Foundry's capabilities for Ethereum app development to support ZKsync, allowing for the compilation, deployment, testing, and interaction with smart contracts on ZKsync.

foundry-zksync is still in an alpha stage, so some features might not be fully supported yet and may not work as fully intended. It is open-sourced and contributions are welcome.

Quickly set up foundry-zksync by following these steps:

  1. Clone the Repository: Download the latest version from GitHub:
    git clone
    cd foundry-zksync
  2. Run the Installer: Execute the script to install the foundry-zksync binaries forge and cast:

Private key setup with Foundry keystore

Follow these steps to securely store your wallet's private key to use it in Foundry projects:

  1. Extract Your Private Key: If you are using the local era node, use a private key from the available rich accounts. Otherwise, find your personal wallet's private key. For MetaMask users, here's how to export your wallet's private key.
  2. Create a Foundry keystore: Create a keystore and import your private key by running
cast wallet import myKeystore --interactive
# enter your PK when prompted, provide a password, and copy the returned address

It'll return an address (keystore address).

Note that the name myKeystore is arbitrary and can be updated. For our docs, we've chosen this name for consistency. If you decide to use another name, be sure to reference it when using cast.

Using the keystore

When running commands that require a private key, like forge create or cast send, use --account myKeystore --sender <KEYSTORE_ADDRESS>. This will require you to enter the keystore password you provided before.

Fund your wallet

If you did not set up a local era node for development and plan to use ZKsync Sepolia Testnet, you will need testnet ETH to fund transactions.

  1. Obtaining Testnet ETH:
  2. Verify your balance:

Next Steps

You should now have a fully working local environment to build new projects on ZKsync!

  • Continue to Hello ZKsync! to begin the series on building a crowdfunding campaign for Zeek.
  • This setup provides you everything you need to build in ZKsync. You can skip on to creating your own projects using zksync-cli with your fully set up local dev environment.

Made with ❤️ by the ZKsync Community