-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into java-documentation-factoring
- Loading branch information
Showing
25 changed files
with
1,140 additions
and
829 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: Overview | ||
description: An introduction to the ZKsync Python SDK and its features. | ||
tags: ["zksync", "python", "sdk", "overview"] | ||
--- | ||
|
||
The ZKsync Python SDK is a powerful tool designed to facilitate interaction with the ZKsync Layer-2 scaling solution | ||
on the Ethereum blockchain. Leveraging zero-knowledge proofs, ZKsync provides efficient, low-cost transactions while | ||
ensuring security and scalability. This SDK makes it easier for developers to integrate and utilize ZKsync's advanced | ||
features in their applications. | ||
|
||
## Concept | ||
|
||
Most existing SDKs work right away, but deploying smart contracts or using unique ZKsync features, like account | ||
abstraction, needs extra fields that Ethereum transactions don't have by default. | ||
|
||
To make it easy to use all ZKsync Era features, we created the `zksync2` Python SDK. This SDK has an interface similar | ||
to [web3.py](https://web3py.readthedocs.io/en/latest/index.html). 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. | ||
|
||
::callout{icon="i-heroicons-light-bulb"} | ||
Explore the [Python SDK examples](https://github.com/zksync-sdk/zksync2-examples/tree/main/python) to quickly and | ||
efficiently develop applications with the ZKsync protocol. | ||
:: | ||
|
||
## Key features | ||
|
||
- **Transaction management**: Easily create, sign, and send transactions on the ZKsync network. | ||
- **Account operations**: Manage accounts, including creating, funding, and querying balances. | ||
- **Token support**: Support for multiple tokens, enabling transfers and swaps. | ||
- **Contract interaction**: Interact with smart contracts deployed on ZKsync. | ||
- **Batch transactions**: Bundle multiple transactions to reduce costs and improve efficiency. | ||
- **Security**: Leverage zero-knowledge proofs for enhanced security and privacy. | ||
- **Scalability**: Benefit from the scalability improvements provided by the ZKsync Layer-2 solution. | ||
|
||
### Additional resources | ||
|
||
For more detailed information and advanced usage, refer to the [official ZKsync documentation](https://docs.zksync.io/sdk). | ||
|
||
::callout{icon="i-heroicons-light-bulb"} | ||
To use the `Python SDK`, visit the [Getting Started](/sdk/python/guides/getting-started) page. | ||
:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
content/sdk/30.python/00.quickstart/03.platform-compatibility-python.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: Getting Started | ||
description: A guide to getting started with the ZKsync Python SDK. | ||
tags: ["zksync", "python", "sdk", "getting started"] | ||
--- | ||
|
||
This guide will help you get started with the ZKsync Python SDK, from connecting to the network to performing basic operations. | ||
|
||
::callout{icon="i-heroicons-light-bulb"} | ||
Check the [installation guide](/sdk/python/introduction/installation) for instructions. | ||
:: | ||
|
||
## Connecting to ZKsync Era | ||
|
||
Once you have all the necessary dependencies, connect to ZKsync Era using the endpoint of the operator node. | ||
|
||
```python | ||
from zksync2.module.module_builder import ZkSyncBuilder | ||
... | ||
sdk = ZkSyncBuilder.build("https://sepolia.era.zksync.dev") | ||
``` | ||
|
||
Get chain id: | ||
|
||
```python | ||
chain_id = zk_web3.zksync.chain_id | ||
``` | ||
|
||
Get block number: | ||
|
||
```python | ||
block_number = zk_web3.zksync.block_number | ||
``` | ||
|
||
Get the transaction by hash: | ||
|
||
```ts | ||
transaction = zksync_web3.zksync.eth_get_transaction_by_hash(hash); | ||
``` | ||
|
||
## Examples | ||
|
||
Also, the following examples demonstrate how to: | ||
|
||
1. [Deposit ETH and tokens from Ethereum into ZKsync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/01_deposit.py) | ||
2. [Transfer ETH and tokens on ZKsync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/02_transfer.py) | ||
3. [Withdraw ETH and tokens from ZKsync Era to Ethereum](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/09_withdrawal.py) | ||
4. [Use paymaster to pay fees with tokens](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/15_use_paymaster.py) | ||
|
||
Full code for all examples is available in the [Python ZKsync SDK](https://github.com/zksync-sdk/zksync2-examples/tree/main/python). | ||
Examples are configured to interact with `ZKsync Era` and `Sepolia` test networks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
content/sdk/30.python/02.api/00.providers/00.introduction.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Introduction | ||
description: Overview of Web3Providers and their functions. | ||
tags: ["web3", "blockchain", "provider", "zksync"] | ||
--- | ||
|
||
A Web3 Provider object provides application-layer access to underlying blockchain networks. It serves as a crucial | ||
interface for interacting with various blockchain functionalities, enabling developers to connect, communicate, and | ||
perform operations on the blockchain. | ||
|
||
The [`zksync2`](https://pypi.org/project/zksync2/) library supports provider methods from | ||
the [`web3.py`](https://web3py.readthedocs.io/en/stable/providers.html) library and supplies additional functionality | ||
tailored for the ZKsync Era network. | ||
|
||
### Key features | ||
|
||
- **Network connectivity:** Establishes connections to blockchain networks, allowing applications to interact with them. | ||
- **Transaction management:** Facilitates the creation, sending, and tracking of transactions. | ||
- **Gas estimation:** Provides estimations for the amount of gas required for transactions. | ||
- **Account management:** Retrieves balances and transaction histories for accounts. | ||
- **Contract interaction:** Enables interaction with smart contracts, including deploying and calling contract methods. |
Oops, something went wrong.