EVM -> Solana

EIP-712 on Solana: Signing and Verifying Messages

EIP-712 defines how Ethereum wallets sign structured data so that users can read what they approve and contracts can verify it. Solana wallets sign messages with the account's Ed25519 key, and programs verify those signatures through a signature verification instruction.

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 with ecrecover. 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.
PieceEIP-712Solana
Signature schemesecp256k1Ed25519
Message formatTyped structs hashed with a domain separatorAn offchain message envelope around your text
Domain bindingChain ID and verifying contract in the domainFields you include in the message, such as your domain and program ID
Onchain verificationecrecover in the contractAn Ed25519 verification instruction that your program inspects
Contract walletsERC1271 isValidSignaturePDAs 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.

01
Server issues a challenge
It includes your domain, a nonce, and an expiry time.
02
Wallet signs
The user approves the message in their wallet.
03
Server verifies
It checks the Ed25519 signature against the user's address.
04
Server consumes the nonce
It rejects a second use of the same message.
Signing in with a wallet.

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.

01
User signs a message
For example, an order with a price and an expiry.
02
Relayer builds a transaction
It adds the verification instruction, then your program's instruction.
03
Runtime verifies
The transaction fails if the signature is invalid.
04
Program inspects
It reads the verification instruction and compares the signer and the signed bytes with the values it expects.
Verifying an offchain signature onchain.
Check the contents of the verification instruction
A 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.

Signatures from programs

ERC1271 exists because a contract wallet has no private key. A Solana program has none either, and it does not need an offchain signature: it authorizes actions onchain by signing for its PDAs in a cross-program invocation. If a multisig or smart wallet must approve an offchain message, have its members sign and verify their signatures against the wallet's stored owners.

Next steps

© 2026 Yayasan Solana. Semua hak dilindungi.
EIP-712 on Solana: Signing and Verifying Messages | Solana