News

Ethereum Hard Fork Occured: Constantinople and St. Petersburg update
SUMMARY
March 01  |  7 min read

Constantinople And St. Petersburg Ethereum Forks: A Crash Course

COIN360 Editorial Team

On February 28, the Ethereum community received the hard fork it had awaited since a security bug delayed its implementation in mid January: Constantinople. But what is Constantinople exactly, and what does St. Petersburg have to do with it?

Below we discuss upgrades, Constantinople’s security issues, EIPs, St. Petersburg’s arrival, the “Difficulty Bomb,” and the reason behind it all; Ethererum’s quest to transition from proof-of-work to proof-of-stake.

What are Constantinople and St. Petersburg?

Constantinople and St. Petersburg are network upgrades – though it has been contested by some that “upgrade” is an unlikable euphemism for a hard fork (see the comments Vitalik Buterin has received about this) – that were successfully implemented on February 28, at 19:57 (UTC), at block number 7,280,000. St. Petersburg was implemented to undo one of Constantinople’s Ethereum Improvement Proposals (EIPs), which contained a security vulnerability.

What is an upgrade?

Simply a change in the Ethereum protocol: new rules that will hopefully improve the blockchain, and that require developers and the community to coordinate a smooth transition. This transition is necessary because the upgrade is, in fact, a hard fork: the chain will split into two, with the new branch living on, and the old, outdated one dying.

ethereum constantinople hard fork

A diagram by MyCrypto explaining what Constantinople would do to the Ethereum chain

Before we go any further, do I need to worry about anything?

If I hold ETH?

People who own ETH coin do not need to take any special measures unless the exchange, web, mobile, or hard wallet they use tells them to do something. As Vitalik Buterin explained, there’s no need to “dump your non-Constantinople coins”.

If I mine or run an Ethereum node?

When an upgrade happens, certain changes to the Ethereum protocol are written into the various Ethereum clients; if you run a node or mine ETH coins, you need to make sure you update your client, in order to sync with these changes. If you fail to update, your client will sync to the pre-network upgrade blockchain; you will be connected to an incompatible chain, unable to send or receive ETH. This list of links was provided by the official Ethereum blog:

Why deploy two upgrades at once?

As you may remember, the Ethereum Constantinople upgrade was due to launch back on January 16, and was delayed because of security issues. In order to fix these issues on the Ethereum test networks, St. Petersburg was deployed at the same block height. Let us explain what happened with Constantinople in January before diving into St. Petersburg and the current situation:

About the Constantinople fork: EIPs, the bug, and the delay

Constantinople, like the hard forks that came before it (Homestead in 2016 and Byzantium in 2017) was meant to introduce a new, upgraded branch to the blockchain, with an improved protocol. It would usher in five specific implementations, called the Ethereum Improvement Proposals (EIPs).

What are Ethereum Improvement Proposals?

EIPs are documents that describe standards for Ethereum, including core protocol specifications, client APIs, and contract standards. The changes that Constantinople was to implement were defined in five EIPs. The first four — EIP 145, EIP 1014, EIP 1052 and EIP 1234 — define technical improvements that make Ethereum “a bit more efficient, cheaper to use and pave the way for future upgrades,” explains Stan Schroeder for Mashable.com. These four were implemented on February 28. Very briefly:

  • EIP145 provides Bitwise shifting instructions in the EVM at a low cost. It adds native functionality, making it cheaper and easier to do certain things on chain. Read details here.
  • EIP 1014 is a scaling solution: it makes it possible to interact with Ethereum addresses that haven't yet been created (to be used for state channels). Read details here.
  • EIP 1052 also alleviates costs, specifically for contracts to check another contract’s bytecode without seeing the bytecode itself. Read details here.
  • EIP 1234 delays the “difficulty bomb” (read more on this below) for approximately 12 months, and reduces the block rewards from 3 ETH to 2 ETH to adjust for this. Read details here.

The fifth one, EIP 1283, was set to introduce cheaper gas costs for SSTORE operations; and here’s where the bug was found.

The security issue

Hours before the estimated time of the fork, the security firm ChainSecurity reported that Constantinople would make some smart contracts vulnerable to reentrancy attacks when using address.transfer(...) or address.send(...), as a side-effect of the EIP-1283’s introduction of cheaper gas cost for SSTORE operations.

You can read in depth about the error in the original ChainSecurity report, here.

The Constantinople delay

As soon as the Ethereum bug bounty program was informed, members of the community (security researchers, stakeholders, client developers, smart contract owners and developers, wallets, nodes, dapps developers, media, and others) decided to postpone Ethereum’s upgrade until further notice.

Read the original post announcing the delay here.

Constantinople fork – ETH difficulty bomb

Ethereum announces Constantinople postponement. Source: Twitter @peter_szilagyi

What is the Difficulty Bomb?

A set of code that, like a timer, makes block production increasingly more difficult for miners. It was designed to make ETH mining less lucrative, a scenario referred to as the Ethereum Ice Age, which will encourage the transition away from proof-of-work, and towards proof-of-stake.

Constantinople’s EIP 1234 delays the difficulty bomb, giving the blockchain more time to transition. Read more on this below, in the section “The reason for the upgrades: switching to PoS.”

Why is EIP 1234 crucial? Switching to PoS

As of now, Ethereum uses a proof-of-work consensus mechanism: transactions are confirmed by miners who earn a reward for putting their computing power towards the network. However, Ethereum’s plan was always to transition to a proof-of-stake mechanism – where there’s no mining, but ether holders can stake their coins for a chance to verify the next block – with an upgrade coming in 2019, called Casper.

Why must EIP 1234 delay the ETH difficulty bomb? Because Casper isn't ready yet. EIP 1234 also does something else: it reduces the block mining rewards from 3 ETH to 2 ETH. This is because the community has known about the difficulty bomb for a while, and its effects have been calculated into miner profits.

Why was St. Petersburg necessary?

Test networks are always upgraded before the mainnet, as a precaution. Ropsten is one such test network. The original Constantinople changes were applied to test networks before the delay, and “require a 2nd network upgrade to reverse the original changes,” explains the Ethereum blog. This second upgrade would be St. Petersburg. It occurred at the same time as Constantinople on February 28th, and all it did was simply to remove the buggy EIP 1283. You can check details for this here.

Final thoughts

The implementation of Constantinople and St. Petersburg transpired smoothly, successfully deploying four Ethereum Improvement Proposals. You can monitor the transition of users from the old to the new chain on ForkMonitor. There were no major predictions for an effect that this might have on the price of Ethereum; and sure enough, at press time, ETH coin is trading at $137.37, just a 0.88% increase in the last 24 hours.

Casper, which will finally make the transition into PoS, is set to be a much more meaningful upgrade – and when it happens, we will be monitoring the price of Ethereum closely.

Until then, keep reading.

The Coin360 Editorial Team