Ethereum’s Constantinople and St. Petersberg Upgrade

Ethereum’s Constantinople and St. Petersburg Upgrade

Constantinople & St. Petersburg  are network upgrades on the Ethereum blockchain. This much awaited upgrade was postponed due to security vulnerability issues found in Ethereum Improvement Proposal (EIP) 1283. Smart contract audit firm Chain Security founded that if  EIP1283 was implemented, this could provide an opportunity for attackers to steal users funds with help of loopholes in the code.

Thus Ethereum developers agreed to delay the hard fork to solve this issue. Finally, on FEB 28th long anticipated Ethereum upgrade kicked in at block number -7,280,000. These two protocol upgrades occurred on the same block number in order to fix various scalability issues on the Ethereum network. The overview of EIPs rolled out are provided below.

What are EIPS (Ethereum improvement proposals)?

Ethereum Improvement Proposals (EIPs) describe standards for the Ethereum platform, including core protocol specifications, client APIs, and contract standards. Each EIP has a different number.

The following EIPs (Ethereum improvement proposals) EIP- 145, EIP-1014, EIP1052, EIP1234 and EIP- 1283 are implemented through Constantinople and St.Petersburg upgrade. Below, we briefly summarize these EPI changes.

EIP- 145 ‚ÄďBitwise shifting instructions in Etheruem Virtual Machine.

  • The Ethereum Virtual Machine¬† (EVM) is lacking in bitwise shifting operators. Eip145 provides native bitwise shifting with cost on par with other arithmetic operations. In EVM shifting operators can be implemented via arithmetic¬†operators but that has a higher cost and requires more processing time. (For example, a right shift by 1 bit will mean a division by 2, etc.. a Left shift will mean multiplication by 2, etc..) Each time such an operation needs to be done the cost of performing the operation is higher because we have a multiplication effect.
  • The following opcodes new instructions are introduced by EIP145:¬†0x1b SHL(Shift Left),¬†0x1c SHR (Logical Shift Right),¬†0x1d SAR (Arithmetic Shift Right). Using these arithmetic operators will reduce the cost for each operation in a smart contract, from 35 gas to 3 gas. This also adds native functionality to protocol so that it is cheaper and easier to do certain processes on chain that need bit shifting.

EIP 1014 – Skinny CREATE2

  • This EIP 1014 adds new opcodes at 0xf5 for CREATE2 which takes 4 stack arguments namely: endowment, memory_start, memory_length, salt. CREATE2 behaves similar to CREATE which create a new account with associated code, instruction except for address of new contract being created. It uses keccak256 (0xff ++ address ++ salt ++ keccak256(init_code))[12:]to create the address. keccak256 is an encoding function in solidity program.
  • This EIP 1014¬† instruction will allows to interact with addresses does not exist yet on chain.


  • Its new opcode at 0x3F which return the keccak256 hash of a contract’s code. The EXTCODEHASH takes one argument from the stack and sets the first 96 bits to zero and pushes to the stack the keccak256¬† is hash of the code of the account and remaining 160 bits will be the address of the account.
  • This instruction allows a smart contract to verify other contract bytecode by pulling just the hash of the other smart contract instead of the whole code. The contract presently does these things with help of EXTCODECOPY opcode but it is expensive for large contracts(i.e. high gas price). This EIP will make this process easier and cheaper with less gas price.

EIP 1234 ‚Äď Constantinople Difficulty Bomb Delay and Block Reward Adjustment.

  • This EIP 1234 implements two changes related to block creation and block rewards.The difficult bomb delay is an algorithm to increase the difficulty of mining and also increase the block mining time. This EIP proposes to delay the difficulty bomb by approximately 12 months and reduces the block rewards for miners from 3 ETH/block to 2 ETH/block. This EIP implementation will slow down the production of blocks in the Ethereum blockchain.

EIP- 145, EIP-1014, EIP1052, EIP1234 come under Constantinople upgrade and EIP 1283 will be a St. Petersberg network upgrade. Before Ethereum main network upgrades kick in, the test network(Ropsten) is upgraded to test all changes of platform.

The St. Petersburg fix was a smaller fix rolled out on then network to fix security issues with respect to the original Constantinople roll out.

Disclaimer: The authors of this post are long on Ethereum.