Skip to content

The Problematic Smart Contract

One of the main problems with Solidity is that the storage for normal Smart Contracts is bound to the Smart Contract Address. If you deploy a new version you also start with an empty storage.

We can easily try this, and you probably know it already. That's the very basic stuff to get started with, but we need to start somewhere, so why not with a simple Smart Contract:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.1;

contract LostStorage {
    address public myAddress;

    function setAddress(address _address) public {
        myAddress = _address;
    }

}

Deployed in Remix, we can set an address into the variable myAddress. Nothing new here.

The important part is this: When we re-deploy the Smart Contract, the Smart Contract not only gets a new address, but also the storage is empty again.

We end up with two Smart Contracts on - two different addresses - with different storage.

So, we're tackling one problem after the other one.


Last update: April 17, 2021