Accounts: overview

Accounts: overview

The zkSync Python SDK has a method that generates a signature and a method that verifies messages.

  • sign_typed_data : used to sign EIP712-typed zkSync transactions.
  • verify_typed_data : used to verify the signed EIP712-typed zkSync transactions.


For constructing the instance it needs only account and chain_id.


from zksync2.signer.eth_signer import PrivateKeyEthSigner
from eth_account import Account
from zksync2.module.module_builder import ZkSyncBuilder

account = Account.from_key("PRIVATE_KEY")
zksync_web3 ="ZKSYNC_NETWORK_URL")

chain_id = zksync_web3.zksync.chain_id
signer = PrivateKeyEthSigner(account, chain_id)


The signer is used to generate the signature of the provided transaction based on your account(your private key).


ParametersReturn valueDescription
EIP712 Structure, optional domainWeb3 py SignedMessageBuilds SignedMessage based on the encoded in EIP712 format Transaction.


It's used to verify the provided transaction, whose signature is added to the final EIP712 transaction for its validation.


ParametersReturn valueDescription
signature, EIP712 structure, optional domainboolReturns True if the encoded transaction is signed with provided signature.

The signer class also has the following properties:

addressAccount address
domainDomain that is used to generate signature. It depends on chain_id of network.