Skip to content

11. Cyfrin Updraft: Solidity Simple Storage

This segment lives on Cyfrin Updraft, an external platform, so the teaching happens there rather than embedded here. It reinforces the Solidity fundamentals from lesson 09 by having you build a first contract from an empty file. Working through the same basics in a second toolchain is intentional — the repetition is what makes the syntax stick.

A minimal SimpleStorage contract: a single state variable that holds a number, a function to set it, and a function to read it back. It is the “hello world” of Solidity, and every larger contract is a variation on this loop of store data → expose functions to change and read it.

  • State variables persist in contract storage between transactions; local variables do not.
  • Setter vs. getter — writing state needs a transaction and gas; a view getter can be read for free off-chain.
  • Types and visibility — declaring a variable public auto-generates a getter, a small convenience you will see constantly.

You should leave able to write, compile, and deploy a contract that stores and returns a value, and to explain which calls cost gas and which don’t. That is the base pattern lesson 12’s factory builds directly on.

  • Which of your two functions costs gas to call, and why?
  • What does declaring a state variable public give you for free?
  • What would happen to the stored value if it were a local variable instead of a state variable?

Cyfrin Updraft: Solidity

Assignment: complete the Simple Storage chapter.

Open Solidity course on Updraft

Module 2: Solidity & Token Standards.