A class extending ethers.VoidSigner for Layer 2 operations

Methods that are not listed below do not work since they require signing the transaction with the key!

A L2VoidSigner is an extension of the ethers.VoidSigner class providing only L2 (Layer 2) operations.


  • provider: Provider
    • The provider instance connected to the L2 network.


connect(provider: Provider): L2VoidSigner

Connects the L2VoidSigner to the L2 network using the specified provider.

  • provider: Provider - The provider instance for connecting to an L2 network.
  • L2VoidSigner - A new instance of L2VoidSigner connected to the specified provider.
import { Provider, L2VoidSigner, types } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);

let signer = new L2VoidSigner("<ADDRESS>");
signer = signer.connect(provider);

populateTransaction(tx: TransactionRequest): Promise<TransactionLike>

Populates a transaction with the necessary fields. The only required fields are and either or transaction.value (or both if the method is payable). Other fields will be automatically filled.

  • tx: TransactionRequest - The transaction request to be populated.
  • Promise<TransactionLike> - A promise that resolves to a populated transaction.
import { Provider, L2VoidSigner, Wallet, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const signer = new L2VoidSigner("<ADDRESS>", provider);

const populatedTx = await signer.populateTransaction({
  to: Wallet.createRandom().address,
  value: 7_000_000n,
  maxFeePerGas: 3_500_000_000n,
  maxPriorityFeePerGas: 2_000_000_000n,
  customData: {
    gasPerPubdata: utils.DEFAULT_GAS_PER_PUBDATA_LIMIT,
    factoryDeps: [],

Private Methods

These methods are used internally and are not intended for direct use by consumers of the class.

_signerL2(): L2VoidSigner

Returns the current L2VoidSigner instance.

  • L2VoidSigner - The current instance of L2VoidSigner.

_providerL2(): Provider

Returns the provider connected to the L2 network.

  • Provider - The provider instance connected to the L2 network.

Made with ❤️ by the ZKsync Community