How to write upgradable smart contract on Ethereum

in #smart6 years ago

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.

Sort:  

Congratulations @smile-kevin! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 60986.03
ETH 2921.26
USDT 1.00
SBD 3.57