Blockchain Development for Dummies
(The Dummy Being Me)
I’ve had to rapidly upgrade my knowledge of Smart Contract development in the past couple of weeks. After running through the last half of a Blockchain Developer Bootcamp course at 1.75x playback speed over a weekend (I had completed the first half on a 14 hour flight back in December) and putting my Medium subscription to good use, I think I finally cracked i̵t̵.̵ 2% of it. Yes, there is a lot to learn, but this 2% has been enough to change the mental model I hold for the usual software development I do.
The usual mental models we use are request-response (I request/query something, I get an answer or an error), OOP (everything is an object), functional (everything is a function), or reactive (everything is a stream), but for blockchain, the mental model we need is state machine. Once you adopt the thinking that you can only either read the state or update the state, everything becomes simpler, or so it was for me.
In this model, Bitcoin for e.g. is a single purpose state machine. We can read the ledger to see the balance at any address or we can update the state by moving bitcoin from one address to another. Ethereum on the other hand (or the Ethereum Virtual Machine to be specific) is a general purpose state machine. You can establish a contract with the EVM in which you’d define states and the reading and updating of those states. Storage and updating states cost money, but reading is free. Also, all contract code, states and transactions that updated those states will forever be publicly accessible (if you’re developing on a public chain like ethereum). That’s all there is to it! The underlying magic that makes this all happen in a distributed, manipulation resistant manner is interesting but not all that important for dApp development. It’s the equivalent of OS development vs app development.
What’s more important is spotting the opportunities for which a distributed state machine is a good solution.
Some resources that got me started
- Ethereum Blockchain Developer Bootcamp With Solidity (2022). Basics that you could very easily find on Google, but I’d say it’s worth it, if it’s on sale for like $25. Structured learning helps.
- My preferred development toolchain is HardHat, a much simpler, yet equally powerful alternative to Truffle. In particular, the Hardhat’s tutorial for beginners is a great place to start. Another option is Remix. It’s good for fast prototyping, but not suitable for serious development.
- OpenZeppelin has a bunch of audited and trusted contracts that you can use as building blocks. Check out their Contracts Wizard.
- ChainLink Faucet. You will need some fake money to play around with when deploying contracts to test networks. This is the most reliable faucet I’ve found. ChainLink itself is a really cool project that is used for connecting smart contracts with the non-blockchain world.
- Connecting wallets to your dApp using MetaMask, WalletConnect and WalletLink.
- Connecting to the blockchain via a NaaS (Node as a Service — is that a real abbreviation?) provider such as Alchemy or Infura.
- Patrick Collins’s YouTube Channel and Medium Blog.
- Last but not least, RTFM! The Web3.js Documentation was particularly useful to me.