Objectives
By the end of this lesson you should be able to:- Deploy and test the Storage.sol demo contract in Remix
Deploy the Storage
Contract
Deploying a contract is easy, but remember that if the contract doesn’t compile, the deploy button will instead deploy the last good compiled version of your contract. Verify that you see a green checkmark on the icon for the Compiler contract on the left side of the editor, then select the Deploy & Run Transactions plugin.
If you’ve already deployed any contracts, press the trash can button to the right of the Deployed Contracts label. Then, press the orange button to deploy the Storage
contract.

Contract Addresses
After your contract deploys, it will appear in the Deployed contracts section as STORAGE AT followed by an address. Addresses are used for both contracts and wallets in EVM-compatible blockchains and serve a similar purpose to an IP address. You can copy the address to see what it looks like. It’s 20 characters of hexadecimal, similar to0xd8b934580fcE35a11B58C6D73aDeE468a2833fa8
.
The address is what you will use to find your contract with tools such as Etherscan, or to connect to it with a front end.
However, when you deploy using the Remix VM simulation, it will only exist in your browser.
Deployments and Test Accounts
The result of any transactions, including deployments, will appear in the Remix terminal. Click the chevron next to the blue Debug button to expand the log.
Interacting with the Contract
Click the chevron to expand your contract in the Deployed Contracts section of the left panel. You’ll see two buttons, one for eachpublic
function in the Storage
contract. Notice how the Store button also has a field to pass a uint256, matching the parameter for uint256 num
.

number
variable was instantiated without a value, what do you think the return will be?
Go ahead and click – the result will appear below the button as:

uint256
of 0. Were you expecting undefined
or an error?
Unlike many languages, variables in Solidity have a default value if not assigned. For uint
and int
, that value is 0.
You can also review the results of your transaction in the console.

Storing and Retrieving a Value
Use the input to store and retrieve a value. Which costs more gas? Storing or retrieving? This isn’t a trick question, but it is a bit nuanced. Both cost about 23500 gas, but there is only a gas cost for the retrieve function if it is called by another contract. Calling it from the web is free, because you’re only reading data that is on the blockchain and are not asking the EVM to perform a computational task.Disabling Artifact Generation
Return to the File Explorer by clicking the double document icon in the upper left. You should now see a folder called artifacts that has been added to your project. This folder contains a number of build artifacts, such as the ABI for your contract, that will be useful to you later, but currently just cause clutter. You can disable artifact generation by clicking the settings gear in the bottom left corner, then deselecting the first checkbox to Generate contract metadata…