Skip to main content

avalanche_signMessage

Core

Calculates an Avalanche specific signature by signing a message with a given private key. Before using this method, ensure that the user has granted permission to access their account by invoking eth_requestAccounts.

Params

(2)

1. Message (required)

The message to be signed.

string

Data to sign. This can be an arbitrary length string, or hexadecimal beginning with 0x.

2. Account Index

The index whose private key to be used to sign the message. If not provided the currently active account is used.

number

Account index to sign with.

Result

(SignMessageResult)
string

The signature of the message.

Errors

CodeMessage
-32602Missing mandatory param(s)
-32602Invalid account index provided
-32603Failed to sign message
4001User rejected the request.

Params

Message

Account Index


Request

await window.ethereum.request({
"method": "avalanche_signMessage",
"params": [
null,
null
]
});

Was this page helpful?