Sign messages with custodial wallets
This guide is for custodial smart accounts. If you are using non-custodial smart accounts, you should use the Sign Messages with Openfort's embedded signer.
Signing and verifying messages for smart accounts is different than with EOAs. There are a few reasons why:
-
With an EOA, the address is effectively the public key of the private key used for signing. Therefore, verifying a EOA signature is as simple as recovering the signature and compare the recovered public key with the address.
- With a smart account, the address is the address of a smart contract that has no cryptographic link to the signing private key. Therefore, you must use ERC-1271 to validate the message.
-
With an EOA, you don't have to deploy the account. It just exists.
- Since smart accounts need to be deployed, it may not be clear how you can validate messages against a smart account not yet deployed.
Signing messages#
To sign messages:
Validating signatures#
You can validate signatures with ERC-1271. Here's an example with ethers: