|
3 | 3 | 
|
4 | 4 | 
|
5 | 5 |
|
6 |
| -A solidity library for (multi)signatures. |
| 6 | +A solidity library for verifying message multi-signatures. |
7 | 7 |
|
8 |
| -These utilities make it simple to interact with Ethereum signed messages based on [EIP 191](https://github.com/ethereum/EIPs/issues/191). Useful for multi-sig self-sovereign identity contracts implementing [ERC 1077](https://github.com/ethereum/EIPs/pull/1077). They are a building block for Cleargraph's open and decentralized identity system, and can be used for many other purposes in decentralized applications. |
| 8 | +These utilities make it simple to interact with Ethereum signed messages based on [EIP 191](https://github.com/ethereum/EIPs/issues/191). They are especially useful for multi-sig self-sovereign identity contracts based on [ERC 1077](https://github.com/ethereum/EIPs/pull/1077). They are a building block for Cleargraph's open and decentralized identity system, and can be used for many other purposes in decentralized applications. |
9 | 9 |
|
10 | 10 | You can sign a transaction/message using your private key by calling [web3.personal.sign()](https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html) using MetaMask, Toshi, or another compatible web3 runtime. All signatures are 65 bytes long with the format `{bytes32 r}{bytes32 s}{uint8 v}`. Multiple signatures are stored densely (no padding) by concatenating them.
|
11 | 11 |
|
@@ -33,29 +33,29 @@ contract MyContract {
|
33 | 33 | // Generate the message hash according to EIP 191
|
34 | 34 | bytes32 hash = SignatureUtils.toEthPersonalSignedMessageHash(_personalMessage);
|
35 | 35 |
|
36 |
| - // Returns a list of signatures extracted from _signatures |
| 36 | + // Returns the array of addresses which signed hash using their private key |
37 | 37 | return SignatureUtils.recoverAddresses(hash, _signatures);
|
38 | 38 | // or use SignatureUtils.recoverAddress(hash, _signatures, 0) for only one signature
|
39 | 39 | }
|
40 | 40 |
|
41 | 41 | }
|
42 | 42 | ```
|
43 | 43 |
|
44 |
| -## Working with Signed Messages |
| 44 | +## Working with Ethereum Signed Messages |
45 | 45 |
|
46 |
| -Signed messages are becoming an increasingly important part of decentralized applications, especially for identity management. Imagine a user wishes to perform a transaction on the Ethereum chain, but does not posses Ethereum and therefore cannot pay for gas costs. One emerging solution is to use signed messages, a proxy contract, and a gas relay. Here's how it goes: |
| 46 | +Signed messages are becoming an increasingly important part of decentralized applications, especially for identity management. Imagine a user wishes to perform a transaction on the Ethereum chain, but does not posses ether and therefore cannot pay for gas costs. One emerging solution is to use signed messages, a proxy contract, and a gas relay service. Here's how it goes: |
47 | 47 |
|
48 | 48 | 1. A user wishes to perform a transaction and signs a message with the transaction details using their private key.
|
49 | 49 | 2. The user sends the transaction details and signature to a relay service off-chain.
|
50 | 50 | 3. The relay verifies the message and executes it on the proxy contract, paying for gas costs.
|
51 | 51 | 4. The proxy contract verifies the transaction details and signature, reverting if invalid.
|
52 | 52 | 5. The proxy contract performs the transaction.
|
53 | 53 |
|
54 |
| -Because of signed messages based on the security of Ethereum's `ecrecover(...)`, a user does not need to trust a gas relay with their private key to perform actions on their behalf. Many relay implementations require that a signature be signed with a private key on an address whitelist. Additionally, self-sovereign identity contracts may require multiple signatures for the same message to be valid. |
| 54 | +Because signed messages inherit the security of Ethereum's `ecrecover()`, a user does not need to trust a gas relay with their private key to perform actions on their behalf. Many relay implementations require that a signature be signed with a private key on an address whitelist. Additionally, self-sovereign identity contracts may require multiple signatures for the same message to be valid. |
55 | 55 |
|
56 | 56 | ## Development
|
57 | 57 |
|
58 |
| -To install dependencies and start the local development server: |
| 58 | +PRs welcome. To install dependencies and start the local development server: |
59 | 59 |
|
60 | 60 | $ yarn install
|
61 | 61 | $ yarn run migrate
|
|
0 commit comments