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

Transactions 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 gasPerPubdata parameter:

const transactionRequest: types.TransactionRequest = {
  to: "<RECEIVER_ADDRESS>",
  value: 1,
  customData: {
    gasPerPubdata: 50_000,
  },
};
const response: types.PriorityOpResponse =
  await wallet.signAndSend(transactionRequest);

Made with ❤️ by the ZKsync Community