Skip to main content
All CollectionsDevelop with Core
Core API Calls: eth_sign
Core API Calls: eth_sign
A
Written by Ana
Updated this week

Calculates an Ethereum 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. Address (required)

The address whose private key will be used to sign the message.

string

The Ethereum address to sign with.

Match pattern:^0x[a-fA-F0-9]{40}$

2. Message (required)

The message to be signed.

string

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

Result (Signature)

The signature of the message.

string

The hexadecimal signature string.

Match pattern:^0x[a-fA-F0-9]{130}$

Errors

Code

Message

4100

The requested account and/or method has not been authorized by the user.

Example

Request

await window.ethereum.request({
"method": "eth_sign",
"params": [
"0xBB900BbE1A20dA4d474666B79a5fa6CE12629733",
"Hello, World!"
]
});

Result

"0x531412b81138a2101edc79fed1fbb35a3659d41a49d1c5d2c8cf4dad46752fb576648bb369ae6c9f39d9451a013845849cf8eed7ecc207e728337a6e14cce5221c"


For any additional questions, please view our other knowledge base articles or contact a Product Support team member via the chat button. Examples are for illustrative purposes only.

Did this answer your question?