personal_sign
Presents a plain text signature challenge to the user and returns the signed response. Prepends a safe prefix to the signed message to prevent the challenge tricking users into signing a financial transaction. MetaMask implements personal_sign similarly to the Go Ethereum client's eth_sign implementation. MetaMask's personal_sign doesn't accept a password. This method requires that the user has granted permission to interact with their account first, so make sure to call eth_requestAccounts (recommended) or wallet_requestPermissions first.
Parameters
Challenge(string)requiredA hex-encoded UTF-8 string to present to the user. See how to encode a string like this in the browser-string-hexer module.
Address(string)requiredThe address of the requested signing account.
Returns
A hex-encoded signature.
Example request
await provider.request({
method: "personal_sign",
params: [
"0x506c65617365207369676e2074686973206d65737361676520746f20636f6e6669726d20796f7572206964656e746974792e",
"0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7"
]
});
Example response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x43d7215ebe96c09a5adac69fc76dea5647286b501954ea273e417cf65e6c80e1db4891826375a7de02467a3e01caf125f64c851a8e9ee9467fd6f7e83523b2115bed8e79d527a85e28a36807d79b85fc551b5c15c1ead2e43456c31f565219203db2aed86cb3601b33ec3b410836d4be7718c6148dc9ac82ecc0a04c5edecd8914"
}