Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify eth.personal.sign docs #3091

Merged
merged 1 commit into from
Oct 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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