Skip to main content
Since smart contract accounts don’t have a way to validate signatures like an EOA, it is also recommended that you implement EIP-1271 for your smart contract accounts. This EIP provides a standardized way for smart contracts to verify whether a signature is valid for a given message.

EIP-1271 Specification

EIP-1271 specifies a single function, isValidSignature, that can contain any arbitrary logic to validate a given signature and largely depends on how you have implemented your smart contract account.

OpenZeppelin Implementation

OpenZeppelin provides a way to verify signatures for different account implementations that you can use in your smart contract account. Install the OpenZeppelin contracts library:
Implement the isValidSignature function in your smart contract account:

Verifying Signatures

On the client, you can use zksync-ethers to verify signatures for your smart contract account using either:
  • isMessageSignatureCorrect for verifying a message signature.
  • isTypedDataSignatureCorrect for verifying a typed data signature.
Both of these methods return true or false depending on whether the message signature is correct. Currently, these methods only support verifying ECDSA signatures, but will soon also support EIP-1271 signature verification.