0/5
## Getting Started with ZK Sync and Moccasin In this lesson, we will continue our journey with Moccasin by working with ZK Sync. We will be focusing on deploying and testing our contracts with ZK Sync. First, let's make sure we have installed the necessary tools. We need to install the `anvil-zksync` and `zkVyper` commands. We can verify their installations with the following commands in our terminal: ```bash anvil-zksync --version ``` ```bash zkVyper --version ``` We will be using the `mox` command to deploy and test our smart contracts. We can deploy to ZK Sync with the following command: ```bash mox run deploy --network eravm ``` Moccasin will automatically spin up a local ZK Sync network when we run the `mox run deploy` command. We can then run our tests using the following command: ```bash mox test --network eravm ``` We will see a lot of warnings during the testing phase. These warnings are due to ZK Sync VM being different from the EVM. However, we can ignore these warnings as our tests will still pass. We also saw how to compile our contracts with both the EVM and ZK Sync: ```bash mox compile ``` ```bash mox compile --network eravm ``` Moccasin uses different bytecode for both the EVM and ZK Sync. We can check the bytecode by looking at the `favorites.json` file in our `out` folder. We will see that the VM has changed from EVM to `eravm` and the bytecode has changed. However, the ABI (Application Binary Interface) will remain the same for both the EVM and ZK Sync. We have now learned how to deploy and test our contracts with ZK Sync using Moccasin. This allows us to take advantage of the power of ZK Rollups, making our applications faster and more efficient. We are now ready to deploy and test our smart contracts in a ZK Sync environment, and we can do so with the confidence that our code is working as expected.
In this lesson, we will continue our journey with Moccasin by working with ZK Sync. We will be focusing on deploying and testing our contracts with ZK Sync.
First, let's make sure we have installed the necessary tools. We need to install the anvil-zksync
and zkVyper
commands. We can verify their installations with the following commands in our terminal:
We will be using the mox
command to deploy and test our smart contracts. We can deploy to ZK Sync with the following command:
Moccasin will automatically spin up a local ZK Sync network when we run the mox run deploy
command. We can then run our tests using the following command:
We will see a lot of warnings during the testing phase. These warnings are due to ZK Sync VM being different from the EVM. However, we can ignore these warnings as our tests will still pass.
We also saw how to compile our contracts with both the EVM and ZK Sync:
Moccasin uses different bytecode for both the EVM and ZK Sync. We can check the bytecode by looking at the favorites.json
file in our out
folder. We will see that the VM has changed from EVM to eravm
and the bytecode has changed. However, the ABI (Application Binary Interface) will remain the same for both the EVM and ZK Sync.
We have now learned how to deploy and test our contracts with ZK Sync using Moccasin. This allows us to take advantage of the power of ZK Rollups, making our applications faster and more efficient.
We are now ready to deploy and test our smart contracts in a ZK Sync environment, and we can do so with the confidence that our code is working as expected.
A comprehensive guide to using the Mochassin tool to deploy and test smart contracts on the Era VM. This lesson covers configuring the Mochassin tool, understanding the difference between the Era VM and EVM, and the basics of running tests.
Previous lesson
Previous
Next lesson
Next
Give us feedback
era_test_node has been renamed to anvil-zksync
Last updated on December 9, 2024
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,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)
Last updated on June 10, 2025
Duration: 2h 20min
Duration: 1h 51min
Duration: 58min
Duration: 2h 23min
Duration: 53min
Duration: 2h 24min
Duration: 28min
Duration: 1h 54min
Duration: 11min
Course Overview
About the course
Python basics
Introduction to Web3.py
Introduction to Titanoboa
Introduction to Moccasin
How to create an ERC-20
How to test Python code and Vyper smart contract
How to deploy Vyper smart contracts on ZKsync using Moccasin
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,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)
Last updated on June 10, 2025