Skip to content

Commit

Permalink
Clarify eth.personal.sign docs (web3#3091)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgewecke authored and nachomazzara committed Jun 4, 2020
1 parent ce136d6 commit a25f75c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/web3-eth-personal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,17 @@ sign
web3.eth.personal.sign(dataToSign, address, password [, callback])
Signs data using a specific account.
The sign method calculates an Ethereum specific signature with:

.. code-block:: javascript
sign(keccak256("\x19Ethereum Signed Message:\n" + dataToSign.length + dataToSign)))
Adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature.

If you have the original message and the signed message, you can discover the signing account address
using :ref:`web3.eth.personal.ecRecover <eth-personal-ecRecover>` (See example below)


.. note:: Sending your account password over an unsecured HTTP RPC connection is highly unsecure.

Expand Down Expand Up @@ -119,6 +129,11 @@ Example
.then(console.log);
> "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"
// recover the signing account address using original message and signed message
web3.eth.personal.ecRecover("Hello world", "0x30755ed65396...etc...")
.then(console.log);
> "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe"
------------------------------------------------------------------------------

Expand Down

0 comments on commit a25f75c

Please sign in to comment.