11. Cyfrin Updraft: Solidity Simple Storage
Overview
Section titled “Overview”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.
What you’ll build
Section titled “What you’ll build”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.
Concepts to lock in
Section titled “Concepts to lock in”- State variables persist in contract storage between transactions; local variables do not.
- Setter vs. getter — writing state needs a transaction and gas; a
viewgetter can be read for free off-chain. - Types and visibility — declaring a variable
publicauto-generates a getter, a small convenience you will see constantly.
What to bring back
Section titled “What to bring back”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.
Check yourself
Section titled “Check yourself”- Which of your two functions costs gas to call, and why?
- What does declaring a state variable
publicgive you for free? - What would happen to the stored value if it were a local variable instead of a state variable?
Open Course Segment
Section titled “Open Course Segment”Cyfrin Updraft: Solidity
Assignment: complete the Simple Storage chapter.
