# EIP-1884: Repricing for Trie-Size-Dependent Opcodes ## What is an EIP? **Definition**: EIPs (Ethereum Improvement Proposals) are formal proposals for changes to the Ethereum platform, covering protocol specifications, APIs, and contract standards. **Purpose**: EIPs standardize suggestions and improvements, ensuring community consensus and transparency. ### Types of EIPs - **Standards Track**: Changes to Ethereum’s core (e.g protocol updates). - **Informational**: Optional guidelines or information. - **Meta**: Off-chain processes (e.g. governance). **Key Point**: EIPs evolve Ethereum through community driven proposals. ## EIP Creation Process ### Stages 1. **Idea**: Discussed in forums like Ethereum Magicians. 2. **Draft**: Submitted to the EIP repository with proper format. 3. **Review**: Community peer review. 4. **Last Call**: Final 14-day review period. 5. **Final**: Accepted and implemented (may require a hard fork). ### Other Statuses - **Stagnant**: Inactive for 6+ months. - **Withdrawn**: Author pulls the proposal. - **Living**: Continuously updated e.g EIP-1. **Key Point**: A rigorous process ensures technical and community alignment. ## EIP-1884 Overview **Title**: Repricing for Trie-Size-Dependent Opcodes **Proposed**: March 28, 2019 **Category**: Standards Track (Core) **Status**: Final (Istanbul hard fork, December 2019) **Authors**: Martin Holst Swende, Peter Szilagyi **Summary**: Reprices opcodes (SLOAD, BALANCE, EXTCODEHASH) to match resource use and introduces the SELFBALANCE opcode. **Key Point**: Addresses gas pricing issues due to Ethereum’s growing state size. ## Why EIP-1884 Was Proposed **Problem**: Growth in Ethereum’s state size made opcodes like SLOAD and BALANCE resource intensive, leading to: - **Attacks**: Underpriced opcodes enabled block-filling exploits. - **Gas Limit Issues**: Inconsistent block processing times. - **Need**: Fair gas costs to prevent abuse and stabilize the network. **Context**: Extends EIP-150 (2016), which repriced SLOAD (50 to 200 gas) and BALANCE (20 to 400 gas). **Key Point**: Aligns costs with current network demands. ## EIP-1884 Technical Details ### Opcode Repricing - **SLOAD**: Increased from 200 to 800 gas (reflects higher trie lookup costs). - **BALANCE (EXTBALANCE)**: Increased from 400 to 700 gas (aligned with EXTCODESIZE/EXTCODEHASH). - **EXTCODEHASH**: Increased from 400 to 700 gas (consistent with BALANCE). ### New Opcode - **SELFBALANCE**: Added at 0x47, costing 5 gas (GasFastStep) for efficient balance queries. **Implementation**: Deployed via the Istanbul hard fork; validated with state tests. **Key Point**: Repricing reflects resource use; SELFBALANCE improves efficiency. ## How EIP-1884 Works - **Cost Balancing**: Higher gas costs for SLOAD, BALANCE, and EXTCODEHASH deter abuse and stabilize gas limits. - **SELFBALANCE Efficiency**: Low-cost (5 gas) alternative for contracts to check their own balance. - **Compatibility**: Minimal impact; some contracts may require gas optimization. - **Outcome**: Reduces attack risks, ensures fair pricing, and improves performance. **Key Point**: Enhances Ethereum’s scalability and security. ## Impact and Context - **Related EIPs**: Builds on EIP-150 (repricing) and EIP-1052 (EXTCODEHASH), addressing state growth. - **Implementation**: Deployed in the Istanbul hard fork (December 2019). - **Consensus**: Validated via Ethereum Magicians, GitHub, and IstanbulTests. - **Broader Impact**: Improves efficiency, scalability, and sets a precedent for future repricing. **Key Point**: Critical for Ethereum’s performance and security. ## Conclusion **EIP-1884** strengthens Ethereum by addressing inefficiencies in gas pricing caused by state growth. By repricing key opcodes and introducing **SELFBALANCE**, it enhances network security, stabilizes gas usage, and improves contract efficiency. Implemented in the Istanbul hard fork, it remains a pivotal step in Ethereum’s evolution toward scalability and resilience.