Go API

Introduction

Overview of the Client component in the ZKsync Era

The Client is a critical component that enables interaction with the ZKsync Era. It serves as a wrapper around the ZKsync Era RPC API and supports ethclient.Client from the geth library, along with additional methods specific to ZKsync Era.

Since the geth library has the concept of a Client, not a Provider, the Go SDK for ZKsync Era also adopts the concept of a Client, as opposed to using a Provider like in other ZKsync Era SDKs.

In code, the Client interface is composed of two main interfaces:

EthereumClient

This interface provides Ethereum RPC methods on the ZKsync Era node, prefixed with eth_. It includes the same methods as ethclient.Client from the geth library, ensuring compatibility with existing Ethereum tools and workflows. Additionally, it has extra methods capable of handling EIP-712 transactions, which are essential for the unique features of the ZKsync Era. The EthereumClient interface is designed to be compatible with the bind.ContractBackend interface from geth, which enables support for smart contracts generated using the abigen tool.

ZkSyncEraClient

This interface provides the API methods specific to ZKsync Era, prefixed with zks_. These methods facilitate the use of ZKsync Era’s unique features, such as account abstraction, custom fee systems, and other layer-2 functionalities. The ZkSyncEraClient interface ensures that developers can leverage all the capabilities of the ZKsync Era blockchain efficiently.

These interfaces are designed to make the SDK flexible and extensible.

Made with ❤️ by the ZKsync Community