If you’re like me, and you’re getting started with developing on Ethereum, you’re likely struggling to define a learning path. I recently saw someone put it this way:
I have found it very challenging to even know what questions to ask.
I have found developing on Ethereum, and blockchain in general, so new and different, that I have had to invest a significant amount of time just getting acquainted with terminology and understanding the big picture.
After several weeks I am now beginning to feel a little less lost; I have a basic understanding of what it means to develop on Ethereum, as well as what tools and resources are available to me. I’ve put together a brief outline of what I’ve done so far, and hopefully this will help you get started, as well.
Starting with the Basics
The first step is to gain a basic understanding of the following:
- What is a blockchain?
- What is Bitcoin?
- What is Ethereum?
- How are Bitcoin and Ethereum different?
- What is a decentralized application, or DApp?
This isn’t hard to do; there are numerous videos detailing the above.
The specifics of the development workflow is where I got stuck.
The Big Picture - How to Develop on Ethereum
DApps running on the Ethereum network can be composed of the following parts:
- Smart Contracts - Blockchain code that runs in the Ethereum Virtual Machine
- Front End UI - HTML/CSS/JS + web3.js
- Backend Code running in the traditional way (optional)
Smart Contracts are the programs that run on the Ethereum network, in the Ethereum Virtual Machine. It is with Smart Contracts that you can query and make transactions / save data on the blockchain.
You write Smart Contracts with a language like Solidity or Vyper. These are statically typed languages compiled into bytecode that can be understood by the Ethereum Virtual Machine.
I am most familiar with C-style languages, so I got started with Solidity. It is my understanding that Solidity is the most widely used in the industry, so if your goal is a job, you’ll also want to start with Solidity.
Front End and web3.js
The front end code interacts with the Smart Contracts via a library called web3.js. There are other libraries (web3.py, ethers.js), but I understand web3.js is the most used, so that is what I started with.
web3.js gives you the methods needed to query and send data to the Smart Contract. The library understands HOW to talk to the Smart Contracts on the network because of Application Binary Interface files - ABIs.
These ABI files are generated when you use a tool like Truffle -
truffle compile; they are JSON files.
Centralized Backend (optional)
I haven’t quite figured this part out, yet, though I understand a lot of DApps are a mix of Smart Contracts and “traditional” backend code on a centralized server. As I get more familiar with the WHY and WHEN to use a centralized backend, I will share those insights here on the blog.
Step 1 - Learn the Basics with CryptoZombies
I recommend getting started with the CryptoZombies tutorial. It will help you get familiar with the basics of Solidity and Smart Contracts in general.
The lessons are bite-sized enough that you can complete a number of them in a short amount of time, and the scope isn’t so huge that you will get overwhelmed.
While this makes the tutorial easier to get through, it also means you’ll have to do a lot of practice on your own to internalize what you’ve “learned” in the tutorial. The tutorials themselves don’t offer much in the way of repetition or challenges to help you practice.
Step 2 - Build Your Own DApps
I completed the entire CryptoZombies course before I moved onto building my own application. I had to keep the tutorial open in my browser, though, for reference; there’s just too much material to remember it all in one go.
With CryptoZombies you will get familiar with using 3rd-party Smart Contracts to augment your own. OpenZeppelin is a company that has made numerous Smart Contracts / Libraries available for other developers to use. OZ’s “Proxy” contracts are battle-tested and free to use, so once you’re done with CryptoZombies, you should get to work building your own application using OZ’s Proxy Contracts.
I found out about them after asking others on Twitter what they look for in blockchain dev candidates before hiring them. Familiarity with OpenZeppelin’s proxy contracts was on that list.
Local Dev Environment Setup
- Truffle - Solidity Compiler, etc
- Ganache - Local Blockchain
- OpenZeppelin Reusable Contracts
- OpenZeppelin Test Helpers
- Buidler Testing
There are multiple ways to set up a local dev environment. I use the above for the following reasons:
- Truffle is easy to use, and many jobs seem to require familiarity with the Truffle Suite of tools.
- Ganache is a very easy to use local blockchain, so I can get to work quickly.
- OpenZeppelin contracts are widely used and respected.
- OpenZeppelin test helpers really do make testing easier.
- Buidler (no, that is NOT a typo) provides great stack traces for errors and a console.log() function to make debugging A LOT easier.
mkdir my_ethereum_project && cd my_ethereum_project
git init && git add . && git commit -m "init"- always use git.
- in tuffle-config.js uncomment
npm install --save-dev @nomiclabs/buidler @nomiclabs/buidler-truffle5 @nomiclabs/buidler-web3 @openzeppelin/contracts @openzeppelin/test-helpers truffle
- In the root of the project create a file
buidler.config.jsand paste this in:
- Go to
./contracts/and create a contract, eg:
and paste the following in the file:
- Create a new directory in the root of your project
- Create a new file, eg:
- In the root of your project
npx buidler testand watch the magic happen.
That should give you a decent framework to start writing your own Smart Contracts and writing tests for them.
You can get very far with your application before you have to start thinking of building a UI.
I will draw out my UI on paper to help me plan out my backend code, but after that I prefer to write the backend and use tests to verify everything works as expected. In general, I can work A LOT faster this way, and I have way more fun.
If this write up has helped you at all, I would like to hear about it on Twitter.