From a0bd2416199dd1b6e3d848977fd4364f4c21b698 Mon Sep 17 00:00:00 2001 From: cdetrio Date: Wed, 3 May 2017 11:12:34 -0400 Subject: [PATCH 1/4] copy EIP-155 from issues --- EIPS/eip-155.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 EIPS/eip-155.md diff --git a/EIPS/eip-155.md b/EIPS/eip-155.md new file mode 100644 index 00000000..e7be055e --- /dev/null +++ b/EIPS/eip-155.md @@ -0,0 +1,38 @@ +EDITOR NOTE: below is a copy of the EIP 155 https://github.com/ethereum/EIPs/issues/155#issue-183002027 raw text fetched on 2017-05-02. + +### Parameters +- `FORK_BLKNUM`: TBA +- `CHAIN_ID`: 1 +### Specification + +If `block.number >= FORK_BLKNUM` and `v = CHAIN_ID * 2 + 35` or `v = CHAIN_ID * 2 + 36`, then when computing the hash of a transaction for purposes of signing or recovering, instead of hashing only the first six elements (ie. nonce, gasprice, startgas, to, value, data), hash nine elements, with `v` replaced by `CHAIN_ID`, `r = 0` and `s = 0`. The currently existing signature scheme using `v = 27` and `v = 28` remains valid and continues to operate under the same rules as it does now. +### Example + +Consider a transaction with `nonce = 9`, `gasprice = 20 * 10**9`, `startgas = 21000`, `to = 0x3535353535353535353535353535353535353535`, `value = 10**18`, `data=''` (empty). + +The "signing data" becomes: + +``` +0xec098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a764000080018080 +``` + +The "signing hash" becomes: + +``` +0x2691916f9e6e5b304f135496c08f632040f02d78e36ae5bbbb38f919730c8fa0 +``` + +If the transaction is signed with the private key `0x4646464646464646464646464646464646464646464646464646464646464646`, then the v,r,s values become: + +``` +(37, 11298168949998536842419725113857172427648002808790045841403298480749678639159, 26113561835810707062310182368620287328545641189938585203131842552044123671646) +``` + +Notice the use of 37 instead of 27. The signed tx would become: + +``` +0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83 +``` +### Rationale + +This would provide a way to send transactions that work on ethereum without working on ETC or the Morden testnet. ETC is encouraged to adopt this EIP but replacing `CHAIN_ID` with a different value, and all future testnets, consortium chains and alt-etherea are encouraged to adopt this EIP replacing `CHAIN_ID` with a unique value. From 2a814ea28163bd155136a06fbe95a4652330a7e3 Mon Sep 17 00:00:00 2001 From: cdetrio Date: Wed, 3 May 2017 11:15:14 -0400 Subject: [PATCH 2/4] add preamble --- EIPS/eip-155.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-155.md b/EIPS/eip-155.md index e7be055e..139508c9 100644 --- a/EIPS/eip-155.md +++ b/EIPS/eip-155.md @@ -1,4 +1,13 @@ -EDITOR NOTE: below is a copy of the EIP 155 https://github.com/ethereum/EIPs/issues/155#issue-183002027 raw text fetched on 2017-05-02. +## Preamble +``` +EIP: 155 +Title: Simple replay attack protection +Author: Vitalik Buterin +Type: Standard Track +Category: Core +Status: Final +Created: 2016-10-14 +``` ### Parameters - `FORK_BLKNUM`: TBA From 581ce45afc5a10e218e75cff4bb2dc21997d121b Mon Sep 17 00:00:00 2001 From: cdetrio Date: Thu, 4 May 2017 12:28:26 -0400 Subject: [PATCH 3/4] correct example values --- EIPS/eip-155.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-155.md b/EIPS/eip-155.md index 139508c9..01c8615f 100644 --- a/EIPS/eip-155.md +++ b/EIPS/eip-155.md @@ -28,13 +28,13 @@ The "signing data" becomes: The "signing hash" becomes: ``` -0x2691916f9e6e5b304f135496c08f632040f02d78e36ae5bbbb38f919730c8fa0 +0xdaf5a779ae972f972197303d7b574746c7ef83eadac0f2791ad23db92e4c8e53 ``` If the transaction is signed with the private key `0x4646464646464646464646464646464646464646464646464646464646464646`, then the v,r,s values become: ``` -(37, 11298168949998536842419725113857172427648002808790045841403298480749678639159, 26113561835810707062310182368620287328545641189938585203131842552044123671646) +(37, 18515461264373351373200002665853028612451056578545711640558177340181847433846, 46948507304638947509940763649030358759909902576025900602547168820602576006531) ``` Notice the use of 37 instead of 27. The signed tx would become: From 1dee19d34b6883372b15af9e71813882385fdbda Mon Sep 17 00:00:00 2001 From: cdetrio Date: Thu, 4 May 2017 12:54:24 -0400 Subject: [PATCH 4/4] add table of chain id's --- EIPS/eip-155.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/EIPS/eip-155.md b/EIPS/eip-155.md index 01c8615f..869a842e 100644 --- a/EIPS/eip-155.md +++ b/EIPS/eip-155.md @@ -45,3 +45,19 @@ Notice the use of 37 instead of 27. The signed tx would become: ### Rationale This would provide a way to send transactions that work on ethereum without working on ETC or the Morden testnet. ETC is encouraged to adopt this EIP but replacing `CHAIN_ID` with a different value, and all future testnets, consortium chains and alt-etherea are encouraged to adopt this EIP replacing `CHAIN_ID` with a unique value. + + +### List of Chain ID's: + +| `CHAIN_ID` | Chain(s) | +| ---------------| -------------------------------------------| +| 1 | Ethereum mainnet | +| 2 | Morden (disused), Expanse mainnet | +| 3 | Ropsten | +| 4 | Rinkeby | +| 30 | Rootstock mainnet | +| 31 | Rootstock testnet | +| 42 | Kovan | +| 61 | Ethereum Classic mainnet | +| 62 | Ethereum Classic testnet | +| 1337 | Geth private chains (default) |