5/5
_Follow along with the video_ --- In this lesson, we are going to deploy the contract `SimpleStorage.sol` on a **ZKsync local chain**. We start by verifying that the Forge version we are using is correct. By running the `forge --version` command it confirms that we are on version 0.2: this indicates we are using the right Foundry ZKsync edition. Next, we proceed with creating a `SimpleStorage` contract using the command: ```bash forge create src/SimpleStorage.sol:SimpleStorage --rpc_url <RPC_URL> --private_key <PRIVATE_KEY> --legacy --zksync ``` Here, `<RPC_URL>` represents ZKsync node address, such as `http://127.0.0.1:8011`. > đâ**IMPORTANT**:br > Including private keys directly in commands is not a safe practice. This command instructs Foundry to locate the `SimpleStorage` contract in the `src/SimpleStorage.sol` file and deploy it. Upon execution, the contract compiles and deploys successfully. The output will display details such as the deployer, the deployed contract address, and the transaction hash. ::image{src='/foundry-simply-storage/27-zksync-local-deploy/deployment-successful.png' style='width: 50%; height: auto;'} Using the `--legacy` flag is recommended for deploying simple contracts, while more complex codebases may require different approaches. Attempting to deploy without the `--legacy` flag might result in errors like `failed to serialize transaction, address to address is null`, which will be covered in future lessons. Once you are finished, you can close Docker Desktop and revert to the Vanilla Foundry environment using the `foundryup` command.
A hands-on guide to Deploying a Smart Contract to a Local zkSync Docker Node using Foundry - Learn to deploy contracts to a local zkSync Era node via Docker using the specialized `foundry-zksync` tool. Master the `forge create` command with essential flags like `--zksync` and `--legacy`, and troubleshoot common path specification errors.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Fuzz test not working for Windows Users
Last updated on June 1, 2025
Course Overview
About the course
Foundryup, Foundry Forge, and Anvil
Blockchain Oracles
How to create local Blockchain testnets
How to verify a smart contract
How to write and run smart contract tests
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Last updated on May 27, 2025
Solidity Developer
Foundry FundamentalsDuration: 2h 55min
Duration: 2h 56min
Duration: 26min
Duration: 5h 22min
Course Overview
About the course
Foundryup, Foundry Forge, and Anvil
Blockchain Oracles
How to create local Blockchain testnets
How to verify a smart contract
How to write and run smart contract tests
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Last updated on May 27, 2025