CryptoZombies is still the most functional, self-contained solid Solidity course, for free, on the internet.
I’ve paid for courses that taught me less and did not work as advertised, requiring extra downloads and changes to install software, for example.
Before I go any further, as I’m writing this the
next buttons at the CryptoZombies site seem to not be working. I’ve been changing pages in the address bar.
The lessons are the names of the bigger chunks of course; this one is “Building the zombie factory”.
Each lesson is a group of chapters, which vary in difficulty, which is nice.
Chapter 1 introduces the zombies and shows the math behind the sliders used to select the zombies’ features. I could actually look at that again.
Chapter 2 introduces
pragma and basic contract form.
As far as I know
pragma is just the magic word we type before we type the version and
Now I’m going to have to look it up.
I found this very old article, which basically says the same thing, I think?
Chapter 3 is about declaring variables and uint’s.
Chapter 4 is about coding the DNA.
For this we use
modulo, designated by
Modulo gives the remainder of a division problem, so
9 % 3 = 0 and
12 % 10 = 2.
We can use this to skin extra digits off when we only want a certain number of digits.
n % 10^x gives x digits.
3421675 % 10^3 = 3421675 %1000 = 675. I don’t know how to explain it better.
My best advice is to try it on numbers until the light goes on.
Chapter 5 creating the zombie struct.
Not gonna lie.
I love structs.
Chapter 6 Arrays. So, I’m very vague on what this means, but I remember it’s important and that it didn’t always happen (I don’t think). Solidity automatically creates a
getter function for public arrays.
I haven’t really internalized this syntax, but I’ll add to this bit soon.
Chapter 7 difference
Hopefully I have this straight, that
storage is written to the blockchain and therefore costs to interact with, whereas
memory is a local value and only lasts as long as the transaction.
Arrays, structs, mappings, and strings need to distinguish which to use.
Function parameter variables should start with an
Chapter 8 Pushing structs to the array.
My notes say to be careful and keep track of what’s what.
Each struct is a zombie.
As zombies are created that zombie is pushed to and stored in an array.
Chapter 9 This can’t have been everything.
When making a function private denote with an
_ at the beginning of the function name.
Chapter 10 Return declarations, function modifiers.
pure, which doesn’t read any data outside of function parameters, and
view, which is looking at but not modifying data. The compiler should catch errors using these two modifiers.
Chapter 11 Typecasting.
How to simulate generating a random integer using Solidity.
Chapter 12 This one is picky and wants
uint randDna = … and not the other way around.
Chapter 13 Events. Events are how a smart contract communicates with the front end that something has happened on the blockchain.
Events are capitalized.
Chapter 14 talks about web3 and JS.
Chapter 15 is congratulations.
As I said, I’ll come back and edit this, do my best to keep it up-to-date as people have questions and issues.