What EIP-712 defines
EIP-712 hashes a typed struct together with a domain separator that names the app, the chain ID, and the verifying contract. Wallets display the fields, and a contract recovers the signer withecrecover. It underlies permits, order
books, and gasless flows. ERC1271 extends verification to contract wallets
through isValidSignature.
Message signing on Solana
Solana wallets sign messages in two ways. Use offchain messages where the wallet supports them, and fall back to raw messages where it does not.Offchain messages: solana:signOffchainMessage
- Wraps your text in a standard format.
- Cannot be mistaken for a transaction.
- Names the accounts that must sign. It is the format hardware wallets can sign, though support depends on the device.
Raw messages: solana:signMessage
- Signs exactly the bytes your app passes in.
- Supported by most software wallets.
- Nothing in the bytes marks them as a message.
| Piece | EIP-712 | Solana |
|---|---|---|
| Signature scheme | secp256k1 | Ed25519 |
| Message format | Typed structs hashed with a domain separator | An offchain message envelope around your text |
| Domain binding | Chain ID and verifying contract in the domain | Fields you include in the message, such as your domain and program ID |
| Onchain verification | ecrecover in the contract | An Ed25519 verification instruction that your program inspects |
| Contract wallets | ERC1271 isValidSignature | PDAs sign onchain through CPIs |
Verify a signature on your server
For sign-in and other offchain actions, your backend verifies the signature. No transaction or fee is involved.1
Server issues a challenge
It includes your domain, a nonce, and an expiry time.
2
Wallet signs
The user approves the message in their wallet.
3
Server verifies
It checks the Ed25519 signature against the user’s address.
4
Server consumes the nonce
It rejects a second use of the same message.
Verify a signature in a program
Verifying an Ed25519 signature inside a program costs too much compute, and the verification program cannot be called through a CPI. Instead, the transaction includes an instruction for the Ed25519 signature verification program, and your program uses instruction introspection to confirm that the instruction checked the expected signer and message. With an offchain message, the signed bytes include the signing domain, the version, and the signer list before your text, so pass the full signed message to the verification instruction and parse it in your program.1
User signs a message
For example, an order with a price and an expiry.
2
Relayer builds a transaction
It adds the verification instruction, then your program’s instruction.
3
Runtime verifies
The transaction fails if the signature is invalid.
4
Program inspects
It reads the verification instruction and compares the signer and the signed
bytes with the values it expects.
Check the contents of the verification instructionA verification instruction can point at data in another instruction, so its
presence proves nothing. Confirm its program ID, that it holds exactly the
number of signatures you expect, and that each offset’s instruction index points
at the verification instruction itself. Then compare the public key and the
message bytes at those offsets with the values you expect. Load instructions
only from the real Instructions sysvar address.
Design the message
EIP-712’s domain separator prevents a signature from being replayed on another app or chain. On Solana, put the same protections in the message itself.- Include your app’s domain and the program ID that will consume the signature.
- Include the cluster, so a Devnet signature cannot be used on Mainnet.
- Include a nonce that your program or server marks as used.
- Include an expiry time and reject messages after it.
- Write the message so a person can read what they are approving.