How to sign or verify messages to prove address ownership?

6 years ago 348

Message signing is simply a mode for you to beryllium ownership of a peculiar address, and show you person power of the funds.

Why sign?

Signing is an casual mode of assuring that thing is being done by the close idiosyncratic oregon contract. Unlike carnal signatures, integer signatures cannot beryllium faked truthful you tin ever beryllium definite that an enactment was completed by the close person.

Etherscan

Message signing tin beryllium done easy with Etherscan’s “Verify New Message Signature” feature.

1. Go to the Verify New Message Signature tool.
2. Provide the Ethereum code you would similar to motion with.
3. Provide the connection Signature hash and the archetypal connection that is being signed.
4. Click Verify and Save from the drop-down menu.
5. Submit.

Blockchain App

In the fashionable wallet app, Blockchain, connection signing is rather simple. To motion a message,

1. Go to Settings -> Addresses
2. Scroll down to take the desired address.
3. Click More Options -> Sign Message.

Note: this is presently lone disposable for imported addresses, but volition beryllium added to each addresses successful the future.

Technical Explanation

The pursuing method creates an Ethereum-specific signature with:
sign(keccak256(“\x19Ethereum Signed Message:\n” + len(message) + message))).

Adding a prefix to the connection volition marque the signature recognizable arsenic an Ethereum-specific signature. This would forestall immoderate fraud oregon misuse wherever a malicious DAPP could motion random information (such arsenic a transaction) and usage the signature to impersonate the victim. Note: the code to motion with should beryllium unlocked for this to work.

Parameters

account, message

  1. DATA, 20 Bytes = address
  2. DATA, N Bytes = connection to sign

Returns

DATA: Signature

Example

// Request curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sign","params":["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", "0xdeadbeaf"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b" }
Read Entire Article
Hotscript.co