Upgradeable Proxy Contract

Indirection is an established and fundamental tool used in building software.

In computer programming, indirection (also known as “dereferencing”) is the ability to reference something using a name, reference, or container, instead of the value itself. The most common form of indirection is the act of manipulating a value through its memory address. One example of indirection is the domain name system, which enables names such as “en.wikipedia.org” to be used in place of network address such as “208.80.154.224.”

The Ethereum blockchain network and proxy contracts both use indirection, to facilitate building software on the Ethereum blockchain network.

A proxy contract is a type of smart contract that acts as an intermediary smart contract that delegates calls to another smart contract known as the “implementation contract”. In cases where a proxy contract is used, interaction with the underlying implementation contract must be done through the proxy contract.

The proxy contract stores the address of the implementation contract so when a user interacts with the proxy contract, the proxy contract delegates the call to the implementation contract, which then executes the requested function and returns the result to the proxy contract, which in turn, returns the result to the user.

The above diagram shows the first version where the Upgradeable Proxy Contract directs to Implementation Contract A.

The above diagram shows the second version where the Upgradeable Proxy Contract now directs to Implementation Contract B.

Some of the benefits of using proxy contracts include the ability:

  1. to upgrade the implementation contract without changing the proxy contract blockchain address, which allows rollback to previous versions of implementation contracts, and implementation contract upgrades could be executed without users having to change the smart contract blockchain address they intend to interact with, because the proxy contract would still have the same blockchain address; and

  2. to deploy a new implementation contract which uses less gas instead of deploying an entirely new implementation contract, minimizing the need to update references to the implementation contract’s blockchain address in decentralized applications.

Open Zeppelin is a good concrete example to start with.

Last updated