Sign a message
To request a signature from a wallet, first find your desired wallet from the wallets
array and get its EIP-1193 provider via its getEthereumProvider
method:
Then, using the provider’s request
method, send a personal_sign
JSON-RPC to the wallet. In the params
array, include the message to sign as the first entry, and the wallet’s address as the second entry.
If you’ve integrated Privy with another web3 library, you can also use that library’s syntax for requesting a signature from the wallet:
Library | Method |
---|---|
Viem | Use the wallet client’s signMessage method. |
Ethers | Use the signer’s signMessage method. |
Wagmi | Use the useSignMessage hook. |
When requesting a signature from an embedded wallet, you can customize the signature prompt by using Privy’s native signMessage method.
Was this page helpful?