Installation
How to install and set up zksync2-python for your project.
About zksync2-python
To make it easy to use all ZKsync features like smart contract deployment and native account abstraction, we created the zksync2-python Python SDK.
This SDK has an interface similar
to web3.py. In fact, web3.py is a peer dependency of our
library. Most objects exported by zksync2 inherit from web3.py objects and only change the fields that need adjustments.
Prerequisites
Make sure you have the following software installed on your system:
- Python: Version 3.8 or higher. Download and install it from the Python website.
- Pip: Version 23.1.2 or higher. Pip is the package installer for Python. Install it using the guide on the Pip website.
Adding dependencies
To add the ZKsync Era SDK to your project, follow these steps:
- Open your terminal: Use any terminal or command line interface you like.
- Install the ZKsync Era SDK: Run this command to install the SDK with pip:
pip install zksync2
Verification
Check if the installation was successful by importing the SDK in a Python script or an interactive Python session:
import importlib.metadata
zksync_version = importlib.metadata.version("zksync2")
print("ZKsync SDK version:", zksync_version)
You should see a response like:
ZKsync SDK version: 1.2.0