arunmozhi commited on
Commit
31fcf05
·
verified ·
1 Parent(s): 00ee31a

Upload 4 files

Browse files
eips_ethereum_org_EIPS_eip_1.md ADDED
@@ -0,0 +1,546 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AlertSourceDiscuss
2
+
3
+ [Meta](https://eips.ethereum.org/meta)
4
+
5
+ # EIP-1: EIP Purpose and Guidelines
6
+
7
+ | Authors | Martin Becze < [mb@ethereum.org](mailto:mb@ethereum.org) >, Hudson Jameson < [hudson@ethereum.org](mailto:hudson@ethereum.org) >, et al. |
8
+ | Created | 2015-10-27 |
9
+
10
+ ## Table of Contents
11
+
12
+ - [What is an EIP?](https://eips.ethereum.org/EIPS/eip-1#what-is-an-eip)
13
+ - [EIP Rationale](https://eips.ethereum.org/EIPS/eip-1#eip-rationale)
14
+ - [EIP Types](https://eips.ethereum.org/EIPS/eip-1#eip-types)
15
+ - [Special requirements for Core EIPs](https://eips.ethereum.org/EIPS/eip-1#special-requirements-for-core-eips)
16
+ - [EIP Work Flow](https://eips.ethereum.org/EIPS/eip-1#eip-work-flow)
17
+ - [Shepherding an EIP](https://eips.ethereum.org/EIPS/eip-1#shepherding-an-eip)
18
+ - [Core EIPs](https://eips.ethereum.org/EIPS/eip-1#core-eips)
19
+ - [EIP Process](https://eips.ethereum.org/EIPS/eip-1#eip-process)
20
+ - [What belongs in a successful EIP?](https://eips.ethereum.org/EIPS/eip-1#what-belongs-in-a-successful-eip)
21
+ - [EIP Formats and Templates](https://eips.ethereum.org/EIPS/eip-1#eip-formats-and-templates)
22
+ - [EIP Header Preamble](https://eips.ethereum.org/EIPS/eip-1#eip-header-preamble)
23
+ - [author header](https://eips.ethereum.org/EIPS/eip-1#author-header)
24
+ - [discussions-to header](https://eips.ethereum.org/EIPS/eip-1#discussions-to-header)
25
+ - [type header](https://eips.ethereum.org/EIPS/eip-1#type-header)
26
+ - [category header](https://eips.ethereum.org/EIPS/eip-1#category-header)
27
+ - [created header](https://eips.ethereum.org/EIPS/eip-1#created-header)
28
+ - [requires header](https://eips.ethereum.org/EIPS/eip-1#requires-header)
29
+ - [Linking to External Resources](https://eips.ethereum.org/EIPS/eip-1#linking-to-external-resources)
30
+ - [Execution Client Specifications](https://eips.ethereum.org/EIPS/eip-1#execution-client-specifications)
31
+ - [Consensus Layer Specifications](https://eips.ethereum.org/EIPS/eip-1#consensus-layer-specifications)
32
+ - [Networking Specifications](https://eips.ethereum.org/EIPS/eip-1#networking-specifications)
33
+ - [World Wide Web Consortium (W3C)](https://eips.ethereum.org/EIPS/eip-1#world-wide-web-consortium-w3c)
34
+ - [Web Hypertext Application Technology Working Group (WHATWG)](https://eips.ethereum.org/EIPS/eip-1#web-hypertext-application-technology-working-group-whatwg)
35
+ - [Internet Engineering Task Force (IETF)](https://eips.ethereum.org/EIPS/eip-1#internet-engineering-task-force-ietf)
36
+ - [Bitcoin Improvement Proposal](https://eips.ethereum.org/EIPS/eip-1#bitcoin-improvement-proposal)
37
+ - [National Vulnerability Database (NVD)](https://eips.ethereum.org/EIPS/eip-1#national-vulnerability-database-nvd)
38
+ - [Digital Object Identifier System](https://eips.ethereum.org/EIPS/eip-1#digital-object-identifier-system)
39
+ - [Linking to other EIPs](https://eips.ethereum.org/EIPS/eip-1#linking-to-other-eips)
40
+ - [Auxiliary Files](https://eips.ethereum.org/EIPS/eip-1#auxiliary-files)
41
+ - [Transferring EIP Ownership](https://eips.ethereum.org/EIPS/eip-1#transferring-eip-ownership)
42
+ - [EIP Editors](https://eips.ethereum.org/EIPS/eip-1#eip-editors)
43
+ - [EIP Editor Responsibilities](https://eips.ethereum.org/EIPS/eip-1#eip-editor-responsibilities)
44
+ - [Style Guide](https://eips.ethereum.org/EIPS/eip-1#style-guide)
45
+ - [Titles](https://eips.ethereum.org/EIPS/eip-1#titles)
46
+ - [Descriptions](https://eips.ethereum.org/EIPS/eip-1#descriptions)
47
+ - [EIP numbers](https://eips.ethereum.org/EIPS/eip-1#eip-numbers)
48
+ - [RFC 2119 and RFC 8174](https://eips.ethereum.org/EIPS/eip-1#rfc-2119-and-rfc-8174)
49
+ - [History](https://eips.ethereum.org/EIPS/eip-1#history)
50
+ - [Copyright](https://eips.ethereum.org/EIPS/eip-1#copyright)
51
+
52
+ ## What is an EIP?
53
+
54
+ EIP stands for Ethereum Improvement Proposal. An EIP is a design document providing information to the Ethereum community, or describing a new feature for Ethereum or its processes or environment. The EIP should provide a concise technical specification of the feature and a rationale for the feature. The EIP author is responsible for building consensus within the community and documenting dissenting opinions.
55
+
56
+ ## EIP Rationale
57
+
58
+ We intend EIPs to be the primary mechanisms for proposing new features, for collecting community technical input on an issue, and for documenting the design decisions that have gone into Ethereum. Because the EIPs are maintained as text files in a versioned repository, their revision history is the historical record of the feature proposal.
59
+
60
+ For Ethereum implementers, EIPs are a convenient way to track the progress of their implementation. Ideally each implementation maintainer would list the EIPs that they have implemented. This will give end users a convenient way to know the current status of a given implementation or library.
61
+
62
+ ## EIP Types
63
+
64
+ There are three types of EIP:
65
+
66
+ - A **Standards Track EIP** describes any change that affects most or all Ethereum implementations, such as—a change to the network protocol, a change in block or transaction validity rules, proposed application standards/conventions, or any change or addition that affects the interoperability of applications using Ethereum. Standards Track EIPs consist of three parts—a design document, an implementation, and (if warranted) an update to the [formal specification](https://github.com/ethereum/yellowpaper). Furthermore, Standards Track EIPs can be broken down into the following categories:
67
+
68
+ - **Core**: improvements requiring a consensus fork (e.g. [EIP-5](https://eips.ethereum.org/EIPS/eip-5), [EIP-101](https://eips.ethereum.org/EIPS/eip-101)), as well as changes that are not necessarily consensus critical but may be relevant to [“core dev” discussions](https://github.com/ethereum/pm) (for example, \[EIP-90\], and the miner/node strategy changes 2, 3, and 4 of [EIP-86](https://eips.ethereum.org/EIPS/eip-86)).
69
+ - **Networking**: includes improvements around [devp2p](https://github.com/ethereum/devp2p/blob/readme-spec-links/rlpx.md) ( [EIP-8](https://eips.ethereum.org/EIPS/eip-8)) and [Light Ethereum Subprotocol](https://ethereum.org/en/developers/docs/nodes-and-clients/#light-node), as well as proposed improvements to network protocol specifications of [whisper](https://github.com/ethereum/go-ethereum/issues/16013#issuecomment-364639309) and [swarm](https://github.com/ethereum/go-ethereum/pull/2959).
70
+ - **Interface**: includes improvements around language-level standards like method names ( [EIP-6](https://eips.ethereum.org/EIPS/eip-6)) and [contract ABIs](https://docs.soliditylang.org/en/develop/abi-spec.html).
71
+ - **ERC**: application-level standards and conventions, including contract standards such as token standards ( [ERC-20](https://eips.ethereum.org/EIPS/eip-20)), name registries ( [ERC-137](https://eips.ethereum.org/EIPS/eip-137)), URI schemes, library/package formats, and wallet formats.
72
+ - A **Meta EIP** describes a process surrounding Ethereum or proposes a change to (or an event in) a process. Process EIPs are like Standards Track EIPs but apply to areas other than the Ethereum protocol itself. They may propose an implementation, but not to Ethereum’s codebase; they often require community consensus; unlike Informational EIPs, they are more than recommendations, and users are typically not free to ignore them. Examples include procedures, guidelines, changes to the decision-making process, and changes to the tools or environment used in Ethereum development. Any meta-EIP is also considered a Process EIP.
73
+
74
+ - An **Informational EIP** describes an Ethereum design issue, or provides general guidelines or information to the Ethereum community, but does not propose a new feature. Informational EIPs do not necessarily represent Ethereum community consensus or a recommendation, so users and implementers are free to ignore Informational EIPs or follow their advice.
75
+
76
+ It is highly recommended that a single EIP contain a single key proposal or new idea. The more focused the EIP, the more successful it tends to be. A change to one client doesn’t require an EIP; a change that affects multiple clients, or defines a standard for multiple apps to use, does.
77
+
78
+ An EIP must meet certain minimum criteria. It must be a clear and complete description of the proposed enhancement. The enhancement must represent a net improvement. The proposed implementation, if applicable, must be solid and must not complicate the protocol unduly.
79
+
80
+ ### Special requirements for Core EIPs
81
+
82
+ If a **Core** EIP mentions or proposes changes to the EVM (Ethereum Virtual Machine), it should refer to the instructions by their mnemonics and define the opcodes of those mnemonics at least once. A preferred way is the following:
83
+
84
+ ```
85
+ REVERT (0xfe)
86
+
87
+ ```
88
+
89
+ ## EIP Work Flow
90
+
91
+ ### Shepherding an EIP
92
+
93
+ Parties involved in the process are you, the champion or _EIP author_, the [_EIP editors_](https://eips.ethereum.org/EIPS/eip-1#eip-editors), and the [_Ethereum Core Developers_](https://github.com/ethereum/pm).
94
+
95
+ Before you begin writing a formal EIP, you should vet your idea. Ask the Ethereum community first if an idea is original to avoid wasting time on something that will be rejected based on prior research. It is thus recommended to open a discussion thread on [the Ethereum Magicians forum](https://ethereum-magicians.org/) to do this.
96
+
97
+ Once the idea has been vetted, your next responsibility will be to present (by means of an EIP) the idea to the reviewers and all interested parties, invite editors, developers, and the community to give feedback on the aforementioned channels. You should try and gauge whether the interest in your EIP is commensurate with both the work involved in implementing it and how many parties will have to conform to it. For example, the work required for implementing a Core EIP will be much greater than for an ERC and the EIP will need sufficient interest from the Ethereum client teams. Negative community feedback will be taken into consideration and may prevent your EIP from moving past the Draft stage.
98
+
99
+ ### Core EIPs
100
+
101
+ For Core EIPs, given that they require client implementations to be considered **Final** (see “EIPs Process” below), you will need to either provide an implementation for clients or convince clients to implement your EIP.
102
+
103
+ The best way to get client implementers to review your EIP is to present it on an AllCoreDevs call. You can request to do so by posting a comment linking your EIP on an [AllCoreDevs agenda GitHub Issue](https://github.com/ethereum/pm/issues).
104
+
105
+ The AllCoreDevs call serves as a way for client implementers to do three things. First, to discuss the technical merits of EIPs. Second, to gauge what other clients will be implementing. Third, to coordinate EIP implementation for network upgrades.
106
+
107
+ These calls generally result in a “rough consensus” around what EIPs should be implemented. This “rough consensus” rests on the assumptions that EIPs are not contentious enough to cause a network split and that they are technically sound.
108
+
109
+ :warning: The EIPs process and AllCoreDevs call were not designed to address contentious non-technical issues, but, due to the lack of other ways to address these, often end up entangled in them. This puts the burden on client implementers to try and gauge community sentiment, which hinders the technical coordination function of EIPs and AllCoreDevs calls. If you are shepherding an EIP, you can make the process of building community consensus easier by making sure that [the Ethereum Magicians forum](https://ethereum-magicians.org/) thread for your EIP includes or links to as much of the community discussion as possible and that various stakeholders are well-represented.
110
+
111
+ _In short, your role as the champion is to write the EIP using the style and format described below, shepherd the discussions in the appropriate forums, and build community consensus around the idea._
112
+
113
+ ### EIP Process
114
+
115
+ The following is the standardization process for all EIPs in all tracks:
116
+
117
+ ![EIP Status Diagram](https://eips.ethereum.org/assets/eip-1/EIP-process-update.jpg)
118
+
119
+ **Idea** \- An idea that is pre-draft. This is not tracked within the EIP Repository.
120
+
121
+ **Draft** \- The first formally tracked stage of an EIP in development. An EIP is merged by an EIP Editor into the EIP repository when properly formatted.
122
+
123
+ **Review** \- An EIP Author marks an EIP as ready for and requesting Peer Review.
124
+
125
+ **Last Call** \- This is the final review window for an EIP before moving to `Final`. An EIP editor will assign `Last Call` status and set a review end date ( `last-call-deadline`), typically 14 days later.
126
+
127
+ If this period results in necessary normative changes it will revert the EIP to `Review`.
128
+
129
+ **Final** \- This EIP represents the final standard. A Final EIP exists in a state of finality and should only be updated to correct errata and add non-normative clarifications.
130
+
131
+ A PR moving an EIP from Last Call to Final SHOULD contain no changes other than the status update. Any content or editorial proposed change SHOULD be separate from this status-updating PR and committed prior to it.
132
+
133
+ **Stagnant** \- Any EIP in `Draft` or `Review` or `Last Call` if inactive for a period of 6 months or greater is moved to `Stagnant`. An EIP may be resurrected from this state by Authors or EIP Editors through moving it back to `Draft` or it’s earlier status. If not resurrected, a proposal may stay forever in this status.
134
+
135
+ > _EIP Authors are notified of any algorithmic change to the status of their EIP_
136
+
137
+ **Withdrawn** \- The EIP Author(s) have withdrawn the proposed EIP. This state has finality and can no longer be resurrected using this EIP number. If the idea is pursued at a later date it is considered a new proposal.
138
+
139
+ **Living** \- A special status for EIPs that are designed to be continually updated and not reach a state of finality. This includes most notably EIP-1.
140
+
141
+ ## What belongs in a successful EIP?
142
+
143
+ Each EIP should have the following parts:
144
+
145
+ - Preamble - RFC 822 style headers containing metadata about the EIP, including the EIP number, a short descriptive title (limited to a maximum of 44 characters), a description (limited to a maximum of 140 characters), and the author details. Irrespective of the category, the title and description should not include EIP number. See [below](https://eips.ethereum.org/EIPS/eip-1#eip-header-preamble) for details.
146
+ - Abstract - Abstract is a multi-sentence (short paragraph) technical summary. This should be a very terse and human-readable version of the specification section. Someone should be able to read only the abstract to get the gist of what this specification does.
147
+ - Motivation _(optional)_ \- A motivation section is critical for EIPs that want to change the Ethereum protocol. It should clearly explain why the existing protocol specification is inadequate to address the problem that the EIP solves. This section may be omitted if the motivation is evident.
148
+ - Specification - The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (besu, erigon, ethereumjs, go-ethereum, nethermind, or others).
149
+ - Rationale - The rationale fleshes out the specification by describing what motivated the design and why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages. The rationale should discuss important objections or concerns raised during discussion around the EIP.
150
+ - Backwards Compatibility _(optional)_ \- All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their consequences. The EIP must explain how the author proposes to deal with these incompatibilities. This section may be omitted if the proposal does not introduce any backwards incompatibilities, but this section must be included if backward incompatibilities exist.
151
+ - Test Cases _(optional)_ \- Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Tests should either be inlined in the EIP as data (such as input/expected output pairs, or included in `../assets/eip-###/<filename>`. This section may be omitted for non-Core proposals.
152
+ - Reference Implementation _(optional)_ \- An optional section that contains a reference/example implementation that people can use to assist in understanding or implementing this specification. This section may be omitted for all EIPs.
153
+ - Security Considerations - All EIPs must contain a section that discusses the security implications/considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life-cycle of the proposal. E.g. include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the “Security Considerations” section will be rejected. An EIP cannot proceed to status “Final” without a Security Considerations discussion deemed sufficient by the reviewers.
154
+ - Copyright Waiver - All EIPs must be in the public domain. The copyright waiver MUST link to the license file and use the following wording: `Copyright and related rights waived via [CC0](/LICENSE).`
155
+
156
+ ## EIP Formats and Templates
157
+
158
+ EIPs should be written in [markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) format. There is a [template](https://github.com/ethereum/EIPs/blob/master/eip-template.md) to follow.
159
+
160
+ ## EIP Header Preamble
161
+
162
+ Each EIP must begin with an [RFC 822](https://www.ietf.org/rfc/rfc822.txt) style header preamble, preceded and followed by three hyphens ( `---`). This header is also termed [“front matter” by Jekyll](https://jekyllrb.com/docs/front-matter/). The headers must appear in the following order.
163
+
164
+ `eip`: _EIP number_
165
+
166
+ `title`: _The EIP title is a few words, not a complete sentence_
167
+
168
+ `description`: _Description is one full (short) sentence_
169
+
170
+ `author`: _The list of the author’s or authors’ name(s) and/or username(s), or name(s) and email(s). Details are below._
171
+
172
+ `discussions-to`: _The url pointing to the official discussion thread_
173
+
174
+ `status`: _Draft, Review, Last Call, Final, Stagnant, Withdrawn, Living_
175
+
176
+ `last-call-deadline`: _The date last call period ends on_ (Optional field, only needed when status is `Last Call`)
177
+
178
+ `type`: _One of `Standards Track`, `Meta`, or `Informational`_
179
+
180
+ `category`: _One of `Core`, `Networking`, `Interface`, or `ERC`_ (Optional field, only needed for `Standards Track` EIPs)
181
+
182
+ `created`: _Date the EIP was created on_
183
+
184
+ `requires`: _EIP number(s)_ (Optional field)
185
+
186
+ `withdrawal-reason`: _A sentence explaining why the EIP was withdrawn._ (Optional field, only needed when status is `Withdrawn`)
187
+
188
+ Headers that permit lists must separate elements with commas.
189
+
190
+ Headers requiring dates will always do so in the format of ISO 8601 (yyyy-mm-dd).
191
+
192
+ ### `author` header
193
+
194
+ The `author` header lists the names, email addresses or usernames of the authors/owners of the EIP. Those who prefer anonymity may use a username only, or a first name and a username. The format of the `author` header value must be:
195
+
196
+ > Random J. User <address@dom.ain>
197
+
198
+ or
199
+
200
+ > Random J. User (@username)
201
+
202
+ or
203
+
204
+ > Random J. User (@username) <address@dom.ain>
205
+
206
+ if the email address and/or GitHub username is included, and
207
+
208
+ > Random J. User
209
+
210
+ if neither the email address nor the GitHub username are given.
211
+
212
+ At least one author must use a GitHub username, in order to get notified on change requests and have the capability to approve or reject them.
213
+
214
+ ### `discussions-to` header
215
+
216
+ While an EIP is a draft, a `discussions-to` header will indicate the URL where the EIP is being discussed.
217
+
218
+ The preferred discussion URL is a topic on [Ethereum Magicians](https://ethereum-magicians.org/). The URL cannot point to Github pull requests, any URL which is ephemeral, and any URL which can get locked over time (i.e. Reddit topics).
219
+
220
+ ### `type` header
221
+
222
+ The `type` header specifies the type of EIP: Standards Track, Meta, or Informational. If the track is Standards please include the subcategory (core, networking, interface, or ERC).
223
+
224
+ ### `category` header
225
+
226
+ The `category` header specifies the EIP’s category. This is required for standards-track EIPs only.
227
+
228
+ ### `created` header
229
+
230
+ The `created` header records the date that the EIP was assigned a number. Both headers should be in yyyy-mm-dd format, e.g. 2001-08-14.
231
+
232
+ ### `requires` header
233
+
234
+ EIPs may have a `requires` header, indicating the EIP numbers that this EIP depends on. If such a dependency exists, this field is required.
235
+
236
+ A `requires` dependency is created when the current EIP cannot be understood or implemented without a concept or technical element from another EIP. Merely mentioning another EIP does not necessarily create such a dependency.
237
+
238
+ ## Linking to External Resources
239
+
240
+ Other than the specific exceptions listed below, links to external resources **SHOULD NOT** be included. External resources may disappear, move, or change unexpectedly.
241
+
242
+ The process governing permitted external resources is described in [EIP-5757](https://eips.ethereum.org/EIPS/eip-5757).
243
+
244
+ ### Execution Client Specifications
245
+
246
+ Links to the Ethereum Execution Client Specifications may be included using normal markdown syntax, such as:
247
+
248
+ ```
249
+ [Ethereum Execution Client Specifications](https://github.com/ethereum/execution-specs/blob/9a1f22311f517401fed6c939a159b55600c454af/README.md)
250
+
251
+ ```
252
+
253
+ Which renders to:
254
+
255
+ [Ethereum Execution Client Specifications](https://github.com/ethereum/execution-specs/blob/9a1f22311f517401fed6c939a159b55600c454af/README.md)
256
+
257
+ Permitted Execution Client Specifications URLs must anchor to a specific commit, and so must match this regular expression:
258
+
259
+ ```regex
260
+ ^(https://github.com/ethereum/execution-specs/(blob|commit)/[0-9a-f]{40}/.*|https://github.com/ethereum/execution-specs/tree/[0-9a-f]{40}/.*)$
261
+
262
+ ```
263
+
264
+ ### Consensus Layer Specifications
265
+
266
+ Links to specific commits of files within the Ethereum Consensus Layer Specifications may be included using normal markdown syntax, such as:
267
+
268
+ ```
269
+ [Beacon Chain](https://github.com/ethereum/consensus-specs/blob/26695a9fdb747ecbe4f0bb9812fedbc402e5e18c/specs/sharding/beacon-chain.md)
270
+
271
+ ```
272
+
273
+ Which renders to:
274
+
275
+ [Beacon Chain](https://github.com/ethereum/consensus-specs/blob/26695a9fdb747ecbe4f0bb9812fedbc402e5e18c/specs/sharding/beacon-chain.md)
276
+
277
+ Permitted Consensus Layer Specifications URLs must anchor to a specific commit, and so must match this regular expression:
278
+
279
+ ```regex
280
+ ^https://github.com/ethereum/consensus-specs/(blob|commit)/[0-9a-f]{40}/.*$
281
+
282
+ ```
283
+
284
+ ### Networking Specifications
285
+
286
+ Links to specific commits of files within the Ethereum Networking Specifications may be included using normal markdown syntax, such as:
287
+
288
+ ```
289
+ [Ethereum Wire Protocol](https://github.com/ethereum/devp2p/blob/40ab248bf7e017e83cc9812a4e048446709623e8/caps/eth.md)
290
+
291
+ ```
292
+
293
+ Which renders as:
294
+
295
+ [Ethereum Wire Protocol](https://github.com/ethereum/devp2p/blob/40ab248bf7e017e83cc9812a4e048446709623e8/caps/eth.md)
296
+
297
+ Permitted Networking Specifications URLs must anchor to a specific commit, and so must match this regular expression:
298
+
299
+ ```regex
300
+ ^https://github.com/ethereum/devp2p/(blob|commit)/[0-9a-f]{40}/.*$
301
+
302
+ ```
303
+
304
+ ### World Wide Web Consortium (W3C)
305
+
306
+ Links to a W3C “Recommendation” status specification may be included using normal markdown syntax. For example, the following link would be allowed:
307
+
308
+ ```
309
+ [Secure Contexts](https://www.w3.org/TR/2021/CRD-secure-contexts-20210918/)
310
+
311
+ ```
312
+
313
+ Which renders as:
314
+
315
+ [Secure Contexts](https://www.w3.org/TR/2021/CRD-secure-contexts-20210918/)
316
+
317
+ Permitted W3C recommendation URLs MUST anchor to a specification in the technical reports namespace with a date, and so MUST match this regular expression:
318
+
319
+ ```regex
320
+ ^https://www\.w3\.org/TR/[0-9][0-9][0-9][0-9]/.*$
321
+
322
+ ```
323
+
324
+ ### Web Hypertext Application Technology Working Group (WHATWG)
325
+
326
+ Links to WHATWG specifications may be included using normal markdown syntax, such as:
327
+
328
+ ```
329
+ [HTML](https://html.spec.whatwg.org/commit-snapshots/578def68a9735a1e36610a6789245ddfc13d24e0/)
330
+
331
+ ```
332
+
333
+ Which renders as:
334
+
335
+ [HTML](https://html.spec.whatwg.org/commit-snapshots/578def68a9735a1e36610a6789245ddfc13d24e0/)
336
+
337
+ Permitted WHATWG specification URLs must anchor to a specification defined in the `spec` subdomain (idea specifications are not allowed) and to a commit snapshot, and so must match this regular expression:
338
+
339
+ ```regex
340
+ ^https:\/\/[a-z]*\.spec\.whatwg\.org/commit-snapshots/[0-9a-f]{40}/$
341
+
342
+ ```
343
+
344
+ Although not recommended by WHATWG, EIPs must anchor to a particular commit so that future readers can refer to the exact version of the living standard that existed at the time the EIP was finalized. This gives readers sufficient information to maintain compatibility, if they so choose, with the version referenced by the EIP and the current living standard.
345
+
346
+ ### Internet Engineering Task Force (IETF)
347
+
348
+ Links to an IETF Request For Comment (RFC) specification may be included using normal markdown syntax, such as:
349
+
350
+ ```
351
+ [RFC 8446](https://www.rfc-editor.org/rfc/rfc8446)
352
+
353
+ ```
354
+
355
+ Which renders as:
356
+
357
+ [RFC 8446](https://www.rfc-editor.org/rfc/rfc8446)
358
+
359
+ Permitted IETF specification URLs MUST anchor to a specification with an assigned RFC number (meaning cannot reference internet drafts), and so MUST match this regular expression:
360
+
361
+ ```regex
362
+ ^https:\/\/www.rfc-editor.org\/rfc\/.*$
363
+
364
+ ```
365
+
366
+ ### Bitcoin Improvement Proposal
367
+
368
+ Links to Bitcoin Improvement Proposals may be included using normal markdown syntax, such as:
369
+
370
+ ```
371
+ [BIP 38](https://github.com/bitcoin/bips/blob/3db736243cd01389a4dfd98738204df1856dc5b9/bip-0038.mediawiki)
372
+
373
+ ```
374
+
375
+ Which renders to:
376
+
377
+ [BIP 38](https://github.com/bitcoin/bips/blob/3db736243cd01389a4dfd98738204df1856dc5b9/bip-0038.mediawiki)
378
+
379
+ Permitted Bitcoin Improvement Proposal URLs must anchor to a specific commit, and so must match this regular expression:
380
+
381
+ ```regex
382
+ ^(https://github.com/bitcoin/bips/blob/[0-9a-f]{40}/bip-[0-9]+\.mediawiki)$
383
+
384
+ ```
385
+
386
+ ### National Vulnerability Database (NVD)
387
+
388
+ Links to the Common Vulnerabilities and Exposures (CVE) system as published by the National Institute of Standards and Technology (NIST) may be included, provided they are qualified by the date of the most recent change, using the following syntax:
389
+
390
+ ```
391
+ [CVE-2023-29638 (2023-10-17T10:14:15)](https://nvd.nist.gov/vuln/detail/CVE-2023-29638)
392
+
393
+ ```
394
+
395
+ Which renders to:
396
+
397
+ [CVE-2023-29638 (2023-10-17T10:14:15)](https://nvd.nist.gov/vuln/detail/CVE-2023-29638)
398
+
399
+ ### Digital Object Identifier System
400
+
401
+ Links qualified with a Digital Object Identifier (DOI) may be included using the following syntax:
402
+
403
+ ````
404
+ This is a sentence with a footnote.[^1]
405
+
406
+ [^1]:
407
+ ```csl-json
408
+ {
409
+ "type": "article",
410
+ "id": 1,
411
+ "author": [\
412
+ {\
413
+ "family": "Jameson",\
414
+ "given": "Hudson"\
415
+ }\
416
+ ],
417
+ "DOI": "00.0000/a00000-000-0000-y",
418
+ "title": "An Interesting Article",
419
+ "original-date": {
420
+ "date-parts": [\
421
+ [2022, 12, 31]\
422
+ ]
423
+ },
424
+ "URL": "https://sly-hub.invalid/00.0000/a00000-000-0000-y",
425
+ "custom": {
426
+ "additional-urls": [\
427
+ "https://example.com/an-interesting-article.pdf"\
428
+ ]
429
+ }
430
+ }
431
+ ```
432
+
433
+ ````
434
+
435
+ Which renders to:
436
+
437
+ This is a sentence with a footnote.[1](https://eips.ethereum.org/EIPS/eip-1#fn:1)
438
+
439
+ See the [Citation Style Language Schema](https://resource.citationstyles.org/schema/v1.0/input/json/csl-data.json) for the supported fields. In addition to passing validation against that schema, references must include a DOI and at least one URL.
440
+
441
+ The top-level URL field must resolve to a copy of the referenced document which can be viewed at zero cost. Values under `additional-urls` must also resolve to a copy of the referenced document, but may charge a fee.
442
+
443
+ ## Linking to other EIPs
444
+
445
+ References to other EIPs should follow the format `EIP-N` where `N` is the EIP number you are referring to. Each EIP that is referenced in an EIP **MUST** be accompanied by a relative markdown link the first time it is referenced, and **MAY** be accompanied by a link on subsequent references. The link **MUST** always be done via relative paths so that the links work in this GitHub repository, forks of this repository, the main EIPs site, mirrors of the main EIP site, etc. For example, you would link to this EIP as `./eip-1.md`.
446
+
447
+ ## Auxiliary Files
448
+
449
+ Images, diagrams and auxiliary files should be included in a subdirectory of the `assets` folder for that EIP as follows: `assets/eip-N` (where **N** is to be replaced with the EIP number). When linking to an image in the EIP, use relative links such as `../assets/eip-1/image.png`.
450
+
451
+ ## Transferring EIP Ownership
452
+
453
+ It occasionally becomes necessary to transfer ownership of EIPs to a new champion. In general, we’d like to retain the original author as a co-author of the transferred EIP, but that’s really up to the original author. A good reason to transfer ownership is because the original author no longer has the time or interest in updating it or following through with the EIP process, or has fallen off the face of the ‘net (i.e. is unreachable or isn’t responding to email). A bad reason to transfer ownership is because you don’t agree with the direction of the EIP. We try to build consensus around an EIP, but if that’s not possible, you can always submit a competing EIP.
454
+
455
+ If you are interested in assuming ownership of an EIP, send a message asking to take over, addressed to both the original author and the EIP editor. If the original author doesn’t respond to the email in a timely manner, the EIP editor will make a unilateral decision (it’s not like such decisions can’t be reversed :)).
456
+
457
+ ## EIP Editors
458
+
459
+ The current EIP editors are
460
+
461
+ - Matt Garnett (@lightclient)
462
+ - Sam Wilson (@SamWilsn)
463
+ - Zainan Victor Zhou (@xinbenlv)
464
+ - Gajinder Singh (@g11tech)
465
+
466
+ Emeritus EIP editors are
467
+
468
+ - Alex Beregszaszi (@axic)
469
+ - Casey Detrio (@cdetrio)
470
+ - Gavin John (@Pandapip1)
471
+ - Greg Colvin (@gcolvin)
472
+ - Hudson Jameson (@Souptacular)
473
+ - Martin Becze (@wanderer)
474
+ - Micah Zoltu (@MicahZoltu)
475
+ - Nick Johnson (@arachnid)
476
+ - Nick Savers (@nicksavers)
477
+ - Vitalik Buterin (@vbuterin)
478
+
479
+ If you would like to become an EIP editor, please check [EIP-5069](https://eips.ethereum.org/EIPS/eip-5069).
480
+
481
+ ## EIP Editor Responsibilities
482
+
483
+ For each new EIP that comes in, an editor does the following:
484
+
485
+ - Read the EIP to check if it is ready: sound and complete. The ideas must make technical sense, even if they don’t seem likely to get to final status.
486
+ - The title should accurately describe the content.
487
+ - Check the EIP for language (spelling, grammar, sentence structure, etc.), markup (GitHub flavored Markdown), code style
488
+
489
+ If the EIP isn’t ready, the editor will send it back to the author for revision, with specific instructions.
490
+
491
+ Once the EIP is ready for the repository, the EIP editor will:
492
+
493
+ - Assign an EIP number (generally incremental; editors can reassign if number sniping is suspected)
494
+ - Merge the corresponding [pull request](https://github.com/ethereum/EIPs/pulls)
495
+ - Send a message back to the EIP author with the next step.
496
+
497
+ Many EIPs are written and maintained by developers with write access to the Ethereum codebase. The EIP editors monitor EIP changes, and correct any structure, grammar, spelling, or markup mistakes we see.
498
+
499
+ The editors don’t pass judgment on EIPs. We merely do the administrative & editorial part.
500
+
501
+ ## Style Guide
502
+
503
+ ### Titles
504
+
505
+ The `title` field in the preamble:
506
+
507
+ - Should not include the word “standard” or any variation thereof; and
508
+ - Should not include the EIP’s number.
509
+
510
+ ### Descriptions
511
+
512
+ The `description` field in the preamble:
513
+
514
+ - Should not include the word “standard” or any variation thereof; and
515
+ - Should not include the EIP’s number.
516
+
517
+ ### EIP numbers
518
+
519
+ When referring to an EIP with a `category` of `ERC`, it must be written in the hyphenated form `ERC-X` where `X` is that EIP’s assigned number. When referring to EIPs with any other `category`, it must be written in the hyphenated form `EIP-X` where `X` is that EIP’s assigned number.
520
+
521
+ ### RFC 2119 and RFC 8174
522
+
523
+ EIPs are encouraged to follow [RFC 2119](https://www.ietf.org/rfc/rfc2119.html) and [RFC 8174](https://www.ietf.org/rfc/rfc8174.html) for terminology and to insert the following at the beginning of the Specification section:
524
+
525
+ > The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.
526
+
527
+ ## History
528
+
529
+ This document was derived heavily from [Bitcoin’s BIP-0001](https://github.com/bitcoin/bips) written by Amir Taaki which in turn was derived from [Python’s PEP-0001](https://peps.python.org/). In many places text was simply copied and modified. Although the PEP-0001 text was written by Barry Warsaw, Jeremy Hylton, and David Goodger, they are not responsible for its use in the Ethereum Improvement Process, and should not be bothered with technical questions specific to Ethereum or the EIP. Please direct all comments to the EIP editors.
530
+
531
+ ## Copyright
532
+
533
+ Copyright and related rights waived via [CC0](https://eips.ethereum.org/LICENSE).
534
+
535
+ 1. Jameson, H. (n.d.). _An Interesting Article_. https://doi.org/00.0000/a00000-000-0000-y (Original work published 2022)
536
+
537
+
538
+
539
+ [↩](https://eips.ethereum.org/EIPS/eip-1#fnref:1)
540
+
541
+
542
+ ## Citation
543
+
544
+ Please cite this document as:
545
+
546
+ Martin Becze < [mb@ethereum.org](mailto:mb@ethereum.org) >, Hudson Jameson < [hudson@ethereum.org](mailto:hudson@ethereum.org) >, et al., "EIP-1: EIP Purpose and Guidelines," _Ethereum Improvement Proposals_, no. 1, October 2015. \[Online serial\]. Available: https://eips.ethereum.org/EIPS/eip-1.
eips_ethereum_org_EIPS_eip_2.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AlertSourceDiscuss
2
+
3
+ [Standards Track: Core](https://eips.ethereum.org/core)
4
+
5
+ # EIP-2: Homestead Hard-fork Changes
6
+
7
+ | Authors | Vitalik Buterin ( [@vbuterin](https://github.com/vbuterin)) |
8
+ | Created | 2015-11-15 |
9
+
10
+ ## Table of Contents
11
+
12
+ - [Meta reference](https://eips.ethereum.org/EIPS/eip-2#meta-reference)
13
+ - [Parameters](https://eips.ethereum.org/EIPS/eip-2#parameters)
14
+
15
+ ### Meta reference
16
+
17
+ [Homestead](https://eips.ethereum.org/EIPS/eip-606).
18
+
19
+ ### Parameters
20
+
21
+ | FORK\_BLKNUM | CHAIN\_NAME |
22
+ | --- | --- |
23
+ | 1,150,000 | Main net |
24
+ | 494,000 | Morden |
25
+ | 0 | Future testnets |
26
+
27
+ # Specification
28
+
29
+ If `block.number >= HOMESTEAD_FORK_BLKNUM`, do the following:
30
+
31
+ 1. The gas cost _for creating contracts via a transaction_ is increased from 21,000 to 53,000, i.e. if you send a transaction and the to address is the empty string, the initial gas subtracted is 53,000 plus the gas cost of the tx data, rather than 21,000 as is currently the case. Contract creation from a contract using the `CREATE` opcode is unaffected.
32
+ 2. All transaction signatures whose s-value is greater than `secp256k1n/2` are now considered invalid. The ECDSA recover precompiled contract remains unchanged and will keep accepting high s-values; this is useful e.g. if a contract recovers old Bitcoin signatures.
33
+ 3. If contract creation does not have enough gas to pay for the final gas fee for adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) rather than leaving an empty contract.
34
+ 4. Change the difficulty adjustment algorithm from the current formula: `block_diff = parent_diff + parent_diff // 2048 * (1 if block_timestamp - parent_timestamp < 13 else -1) + int(2**((block.number // 100000) - 2))` (where the `int(2**((block.number // 100000) - 2))` represents the exponential difficulty adjustment component) to `block_diff = parent_diff + parent_diff // 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99) + int(2**((block.number // 100000) - 2))`, where `//` is the integer division operator, eg. `6 // 2 = 3`, `7 // 2 = 3`, `8 // 2 = 4`. The `minDifficulty` still defines the minimum difficulty allowed and no adjustment may take it below this.
35
+
36
+ # Rationale
37
+
38
+ Currently, there is an excess incentive to create contracts via transactions, where the cost is 21,000, rather than contracts, where the cost is 32,000. Additionally, with the help of suicide refunds, it is currently possible to make a simple ether value transfer using only 11,664 gas; the code for doing this is as follows:
39
+
40
+ ```
41
+ from ethereum import tester as t
42
+ > from ethereum import utils
43
+ > s = t.state()
44
+ > c = s.abi_contract('def init():\n suicide(0x47e25df8822538a8596b28c637896b4d143c351e)', endowment=10**15)
45
+ > s.block.get_receipts()[-1].gas_used
46
+ 11664
47
+ > s.block.get_balance(utils.normalize_address(0x47e25df8822538a8596b28c637896b4d143c351e))
48
+ 1000000000000000
49
+
50
+ ```
51
+
52
+ This is not a particularly serious problem, but it is nevertheless arguably a bug.
53
+
54
+ Allowing transactions with any s value with `0 < s < secp256k1n`, as is currently the case, opens a transaction malleability concern, as one can take any transaction, flip the s value from `s` to `secp256k1n - s`, flip the v value ( `27 -> 28`, `28 -> 27`), and the resulting signature would still be valid. This is not a serious security flaw, especially since Ethereum uses addresses and not transaction hashes as the input to an ether value transfer or other transaction, but it nevertheless creates a UI inconvenience as an attacker can cause the transaction that gets confirmed in a block to have a different hash from the transaction that any user sends, interfering with user interfaces that use transaction hashes as tracking IDs. Preventing high s values removes this problem.
55
+
56
+ Making contract creation go out-of-gas if there is not enough gas to pay for the final gas fee has the benefits that:
57
+
58
+ - (i) it creates a more intuitive “success or fail” distinction in the result of a contract creation process, rather than the current “success, fail, or empty contract” trichotomy;
59
+ - (ii) makes failures more easily detectable, as unless contract creation fully succeeds then no contract account will be created at all; and
60
+ - (iii) makes contract creation safer in the case where there is an endowment, as there is a guarantee that either the entire initiation process happens or the transaction fails and the endowment is refunded.
61
+
62
+ The difficulty adjustment change conclusively solves a problem that the Ethereum protocol saw two months ago where an excessive number of miners were mining blocks that contain a timestamp equal to `parent_timestamp + 1`; this skewed the block time distribution, and so the current block time algorithm, which targets a _median_ of 13 seconds, continued to target the same median but the mean started increasing. If 51% of miners had started mining blocks in this way, the mean would have increased to infinity. The proposed new formula is roughly based on targeting the mean; one can prove that with the formula in use, an average block time longer than 24 seconds is mathematically impossible in the long term.
63
+
64
+ The use of `(block_timestamp - parent_timestamp) // 10` as the main input variable rather than the time difference directly serves to maintain the coarse-grained nature of the algorithm, preventing an excessive incentive to set the timestamp difference to exactly 1 in order to create a block that has slightly higher difficulty and that will thus be guaranteed to beat out any possible forks. The cap of -99 simply serves to ensure that the difficulty does not fall extremely far if two blocks happen to be very far apart in time due to a client security bug or other black-swan issue.
65
+
66
+ # Implementation
67
+
68
+ This is implemented in Python here:
69
+
70
+ 1. https://github.com/ethereum/pyethereum/blob/d117c8f3fd93359fc641fd850fa799436f7c43b5/ethereum/processblock.py#L130
71
+ 2. https://github.com/ethereum/pyethereum/blob/d117c8f3fd93359fc641fd850fa799436f7c43b5/ethereum/processblock.py#L129
72
+ 3. https://github.com/ethereum/pyethereum/blob/d117c8f3fd93359fc641fd850fa799436f7c43b5/ethereum/processblock.py#L304
73
+ 4. https://github.com/ethereum/pyethereum/blob/d117c8f3fd93359fc641fd850fa799436f7c43b5/ethereum/blocks.py#L42
74
+
75
+ ## Citation
76
+
77
+ Please cite this document as:
78
+
79
+ Vitalik Buterin ( [@vbuterin](https://github.com/vbuterin)), "EIP-2: Homestead Hard-fork Changes," _Ethereum Improvement Proposals_, no. 2, November 2015. \[Online serial\]. Available: https://eips.ethereum.org/EIPS/eip-2.
eips_ethereum_org_EIPS_eip_4.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AlertSourceDiscuss
2
+
3
+ [Meta](https://eips.ethereum.org/meta)
4
+
5
+ # EIP-4: EIP Classification
6
+
7
+ | Authors | Joseph Chow ( [@ethers](https://github.com/ethers)) |
8
+ | Created | 2015-11-17 |
9
+
10
+ ## Table of Contents
11
+
12
+ - [Abstract](https://eips.ethereum.org/EIPS/eip-4#abstract)
13
+ - [Motivation](https://eips.ethereum.org/EIPS/eip-4#motivation)
14
+ - [Specification](https://eips.ethereum.org/EIPS/eip-4#specification)
15
+ - [1\. Consensus Layer](https://eips.ethereum.org/EIPS/eip-4#1-consensus-layer)
16
+ - [Soft Forks](https://eips.ethereum.org/EIPS/eip-4#soft-forks)
17
+ - [Hard Forks](https://eips.ethereum.org/EIPS/eip-4#hard-forks)
18
+ - [2\. Networking Layer](https://eips.ethereum.org/EIPS/eip-4#2-networking-layer)
19
+ - [3\. API/RPC Layer](https://eips.ethereum.org/EIPS/eip-4#3-apirpc-layer)
20
+ - [4\. Applications Layer](https://eips.ethereum.org/EIPS/eip-4#4-applications-layer)
21
+
22
+ # Abstract
23
+
24
+ This document describes a classification scheme for EIPs, adapted from [BIP 123](https://github.com/bitcoin/bips/blob/master/bip-0123.mediawiki).
25
+
26
+ EIPs are classified by system layers with lower numbered layers involving more intricate interoperability requirements.
27
+
28
+ The specification defines the layers and sets forth specific criteria for deciding to which layer a particular standards EIP belongs.
29
+
30
+ # Motivation
31
+
32
+ Ethereum is a system involving a number of different standards. Some standards are absolute requirements for interoperability while others can be considered optional, giving implementors a choice of whether to support them.
33
+
34
+ In order to have a EIP process which more closely reflects the interoperability requirements, it is necessary to categorize EIPs accordingly. Lower layers present considerably greater challenges in getting standards accepted and deployed.
35
+
36
+ # Specification
37
+
38
+ Standards EIPs are placed in one of four layers:
39
+
40
+ 1. Consensus
41
+ 2. Networking
42
+ 3. API/RPC
43
+ 4. Applications
44
+
45
+ # 1\. Consensus Layer
46
+
47
+ The consensus layer defines cryptographic commitment structures. Its purpose is ensuring that anyone can locally evaluate whether a particular state and history is valid, providing settlement guarantees, and assuring eventual convergence.
48
+
49
+ The consensus layer is not concerned with how messages are propagated on a network.
50
+
51
+ Disagreements over the consensus layer can result in network partitioning, or forks, where different nodes might end up accepting different incompatible histories. We further subdivide consensus layer changes into soft forks and hard forks.
52
+
53
+ ## Soft Forks
54
+
55
+ In a soft fork, some structures that were valid under the old rules are no longer valid under the new rules. Structures that were invalid under the old rules continue to be invalid under the new rules.
56
+
57
+ ## Hard Forks
58
+
59
+ In a hard fork, structures that were invalid under the old rules become valid under the new rules.
60
+
61
+ # 2\. Networking Layer
62
+
63
+ The networking layer specifies the Ethereum wire protocol (eth) and the Light Ethereum Subprotocol (les). RLPx is excluded and tracked in the \[https://github.com/ethereum/devp2p devp2p repository\].
64
+
65
+ Only a subset of subprotocols are required for basic node interoperability. Nodes can support further optional extensions.
66
+
67
+ It is always possible to add new subprotocols without breaking compatibility with existing protocols, then gradually deprecate older protocols. In this manner, the entire network can be upgraded without serious risks of service disruption.
68
+
69
+ # 3\. API/RPC Layer
70
+
71
+ The API/RPC layer specifies higher level calls accessible to applications. Support for these EIPs is not required for basic network interoperability but might be expected by some client applications.
72
+
73
+ There’s room at this layer to allow for competing standards without breaking basic network interoperability.
74
+
75
+ # 4\. Applications Layer
76
+
77
+ The applications layer specifies high level structures, abstractions, and conventions that allow different applications to support similar features and share data.
78
+
79
+ ## Citation
80
+
81
+ Please cite this document as:
82
+
83
+ Joseph Chow ( [@ethers](https://github.com/ethers)), "EIP-4: EIP Classification," _Ethereum Improvement Proposals_, no. 4, November 2015. \[Online serial\]. Available: https://eips.ethereum.org/EIPS/eip-4.
eips_ethereum_org_EIPS_eip_5.md ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AlertSourceDiscuss
2
+
3
+ [Standards Track: Core](https://eips.ethereum.org/core)
4
+
5
+ # EIP-5: Gas Usage for \`RETURN\` and \`CALL\*\`
6
+
7
+ | Authors | Christian Reitwiessner < [c@ethdev.com](mailto:c@ethdev.com) > |
8
+ | Created | 2015-11-22 |
9
+
10
+ ## Table of Contents
11
+
12
+ - [Abstract](https://eips.ethereum.org/EIPS/eip-5#abstract)
13
+ - [Specification](https://eips.ethereum.org/EIPS/eip-5#specification)
14
+ - [Motivation](https://eips.ethereum.org/EIPS/eip-5#motivation)
15
+ - [Rationale](https://eips.ethereum.org/EIPS/eip-5#rationale)
16
+ - [Backwards Compatibility](https://eips.ethereum.org/EIPS/eip-5#backwards-compatibility)
17
+ - [Implementation](https://eips.ethereum.org/EIPS/eip-5#implementation)
18
+
19
+ ### Abstract
20
+
21
+ This EIP makes it possible to call functions that return strings and other dynamically-sized arrays.
22
+ Currently, when another contract / function is called from inside the Ethereum Virtual Machine,
23
+ the size of the output has to be specified in advance. It is of course possible to give a larger
24
+ size, but gas also has to be paid for memory that is not written to, which makes returning
25
+ dynamically-sized data both costly and inflexible to the extent that it is actually unusable.
26
+
27
+ The solution proposed in this EIP is to charge gas only for memory that is actually written to at
28
+ the time the `CALL` returns.
29
+
30
+ ### Specification
31
+
32
+ The gas and memory semantics for `CALL`, `CALLCODE` and `DELEGATECALL` (called later as `CALL*`)
33
+ are changed in the following way ( `CREATE` does not write to memory and is thus unaffected):
34
+
35
+ Suppose the arguments to `CALL*` are `gas, address, value, input_start, input_size, output_start, output_size`,
36
+ then, at the beginning of the opcode, gas for growing memory is only charged for `input_start + input_size`, but not
37
+ for `output_start + output_size`.
38
+
39
+ If the called contract returns data of size `n`, the memory of the calling contract is grown to
40
+ `output_start + min(output_size, n)` (and the calling contract is charged gas for that) and the
41
+ output is written to the area `[output_start, output_start + min(n, output_size))`.\
42
+ \
43
+ The calling contract can run out of gas both at the beginning of the opcode and at the end\
44
+ of the opcode.\
45
+ \
46
+ After the call, the `MSIZE` opcode should return the size the memory was actually grown to.\
47
+ \
48
+ ### Motivation\
49
+ \
50
+ In general, it is good practise to reserve a certain memory area for the output of a call,\
51
+ because letting a subroutine write to arbitrary areas in memory might be dangerous. On the\
52
+ other hand, it is often hard to know the output size of a call prior to performing the call:\
53
+ The data could be in the storage of another contract which is generally inaccessible and\
54
+ determining its size would require another call to that contract.\
55
+ \
56
+ Furthermore, charging gas for areas of memory that are not actually written to is unnecessary.\
57
+ \
58
+ This proposal tries to solve both problems: A caller can choose to provide a gigantic area of\
59
+ memory at the end of their memory area. The callee can “write” to it by returning and the\
60
+ caller is only charged for the memory area that is actually written.\
61
+ \
62
+ This makes it possible to return dynamic data like strings and dynamically-sized arrays\
63
+ in a very flexible way. It is even possible to determine the size of the returned data:\
64
+ If the caller uses `output_start = MSIZE` and `output_size = 2**256-1`, the area of\
65
+ memory that was actually written to is `(output_start, MSIZE)` (here, `MSIZE` as evaluated\
66
+ after the call). This is important because it allows “proxy” contracts\
67
+ which call other contracts whose interface they do not know and just return their output,\
68
+ i.e. they both forward the input and the output. For this, it is important that the caller\
69
+ (1) does not need to know the size of the output in advance and (2) can determine the\
70
+ size of the output after the call.\
71
+ \
72
+ ### Rationale\
73
+ \
74
+ This way of dealing with the problem requires a minimal change to the Ethereum Virtual Machine.\
75
+ Other means of achieving a similar goal would have changed the opcodes themselves or\
76
+ the number of their arguments. Another possibility would have been to only change the\
77
+ gas mechanics if `output_size` is equal to `2**256-1`. Since the main difficulty in the\
78
+ implementation is that memory has to be enlarged at two points in the code around `CALL`,\
79
+ this would not have been a simplification.\
80
+ \
81
+ At an earlier stage, it was proposed to also add the size of the returned data on the stack,\
82
+ but the `MSIZE` mechanism described above should be sufficient and is much better\
83
+ backwards compatible.\
84
+ \
85
+ Some comments are available at https://github.com/ethereum/EIPs/issues/8\
86
+ \
87
+ ### Backwards Compatibility\
88
+ \
89
+ This proposal changes the semantics of contracts because contracts can access the gas counter\
90
+ and the size of memory.\
91
+ \
92
+ On the other hand, it is unlikely that existing contracts will suffer from this change due to\
93
+ the following reasons:\
94
+ \
95
+ Gas:\
96
+ \
97
+ The VM will not charge more gas than before. Usually, contracts are written in a way such\
98
+ that their semantics do not change if they use up less gas. If more gas were used, contracts\
99
+ might go out-of-gas if they perform a tight estimation for gas needed by sub-calls. Here,\
100
+ contracts might only return more gas to their callers.\
101
+ \
102
+ Memory size:\
103
+ \
104
+ The `MSIZE` opcode is typically used to allocate memory at a previously unused spot.\
105
+ The change in semantics affects existing contracts in two ways:\
106
+ \
107
+ 1. Overlaps in allocated memory. By using `CALL`, a contract might have wanted to allocate\
108
+ a certain slice of memory, even if that is not written to by the called contract.\
109
+ Subsequent uses of `MSIZE` to allocate memory might overlap with this slice that is\
110
+ now smaller than before the change. It is though unlikely that such contracts exist.\
111
+ \
112
+ 2. Memory addresses change. Rather general, if memory is allocated using `MSIZE`, the\
113
+ addresses of objects in memory will be different after the change. Contract should\
114
+ all be written in a way, though, such that objects in memory are _relocatable_,\
115
+ i.e. their absolute position in memory and their relative position to other\
116
+ objects does not matter. This is of course not the case for arrays, but they\
117
+ are allocated in a single allocation and not with an intermediate `CALL`.\
118
+ \
119
+ \
120
+ ### Implementation\
121
+ \
122
+ VM implementers should take care not to grow the memory until the end of the call and after a check that sufficient\
123
+ gas is still available. Typical uses of the EIP include “reserving” `2**256-1` bytes of memory for the output.\
124
+ \
125
+ Python implementation:\
126
+ \
127
+ old: http://vitalik.ca/files/old.py\
128
+ new: http://vitalik.ca/files/new.py\
129
+ \
130
+ ## Citation\
131
+ \
132
+ Please cite this document as:\
133
+ \
134
+ Christian Reitwiessner < [c@ethdev.com](mailto:c@ethdev.com) >, "EIP-5: Gas Usage for \`RETURN\` and \`CALL\*\`," _Ethereum Improvement Proposals_, no. 5, November 2015. \[Online serial\]. Available: https://eips.ethereum.org/EIPS/eip-5.