Web3JS

Custom Transaction Data

Add ZKsync custom data to a transaction

Transactions submitted to the ZKsync Era network with the Web3.js plugin for ZKsync may contain the following custom ZKsync-specific parameters:

  • gasPerPubdata: Specifies L2 gas per published byte.
  • factoryDeps: Array of contract bytecodes for deployment.
  • customSignature: Custom signature for the transaction.
  • paymasterParams: Parameters for using a paymaster.

Add custom data to a transaction

Any transaction made to the ZKsync Era network with the Web3.js plugin for ZKsync can include the above ZKsync-specific parameters by specifying a customData property of the type Eip712Meta. The following code snippet demonstrates specifying the gasPerpPubdata parameter for a deposit transaction:

const tx: types.PriorityOpResponse = await wallet.deposit({
  token: "<TOKEN_ADDRESS>",
  to: "<RECEIVER_ADDRESS>",
  amount: 2_000_000_000n,
  refundRecipient: wallet.getAddress(),
  customData: {
    gasPerPubdata: 50_000,
  },
});

Made with ❤️ by the ZKsync Community