How to write upgradable smart contract on Ethereum

People know once contract was published, it is impossible to change its logic. After one contract attracted huge users and accumulated plenty of data on blockchain, what will happen if some serious security hole or some business logic are founded in the contract, the teams have to publish a new contract (need much effort and spend additional Ethers) and they should notice their users.

Here is a three tiers architecture of solution to this problem in some degree.

1 The first layer of contract is a public interface, it just forward calls come from outside (users or outer contracts) to second layer of contract. This interface contains address of second layer of contract (creator of contract can modify this address, so logic contained in second layer can be replaced)

2 Second layer of contract is workhorse of the business logic, but it does not contain any business related on-blockchain data.

3 Third layer of contract just contains on-blockchain data and provide access interface to those data.

So if logic contained in the second layer contact got serious error, team just need to replace this contract.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center