Unblocking the Blockchain Pt.2 – Developing with Ethereum and Solidity
This article will focus on development with Ethereum and Solidity to create and execute smart contracts. The content in this post focuses on getting development tools installed and configured for both a private blockchain and for committing work to the public Ethereum network. There is also a set of curated links to key resources for Ethereum developers.
Tools for Ethereum and Solidity Developers
- Etherscan: tracking of transactions, accounts, etc.
- Metamask: Browser based wallet and transaction manager
- Remix – Remix docs: https://remix-ide.readthedocs.io/en/latest/
- Web3.js: Javascript libraries for all things Ethereum
- Infura.io: Connect to Ethereum networks via APIs
- Ganache: Host a local Ethereum blockchain and go crazy with code!
- Truffle Suite: A set of tools that streamlines contract development
- Truffle for VS Code: Truffle capabilities integrated into VS Code
- Geth: without all that candy, bare bones local blockchain and CLI interface
- IPFS: Distributed file system to support combining data storage with blockchains
- Ethstats: all the statistics a person could want on the Ethereum network
- Solidity: Reference docs for the contract language
- ETH converter – super helpful with all those zeroes
In terms of IDE, I’ve been using Remix and VS Code. Remix has an online IDE and a locally installed version as well. VS Code has Solidity plugins and then there is the Truffle Suite Extension. The issue with VS Code is that it does not work with globally installed Node packages. This means every project will need a complete Node configuration that has to be configured within the workspace. That’s a lot of extra installations unless you are going to do all of your development work from within a single workspace.
Because of that I’ve moved over to the Remix desktop IDE. There’s a few quirks, but in general this seems like the best approach for now. If I start making greater use of the full Truffle Suite, I may move back to VSC.
What’s up with “the merge” and Solidity?
The merge is basically “Ethereum 2.0” a huge multi-year migration from “Proof of Work” (POW) to “Proof of Stake” (POS) as the consensus algorithm. This is a critical upgrade for many reasons – first of all it removes 99.7% of the energy demands of consensus mining. There are many other benefits as well. The main impact on developers is the deprecation of Ropsten, Rinkeby and Kovan test networks. Migration to Goerli is required. Goerli will migrate to POS this year. The merge completed successfully in September 2022
Some places to read up:
Getting Ether for Testing Smart Contracts
In can be a pain to get test ether, but you need it – difficult to write Solidity smart contracts without it. It just seems unreliable for how to get test ether. These sites will work sometimes and not the next time. Even when it says “successful” sometimes the coins never arrive, which is not very reassuring. Here’s some places to try:
- https://ethdrop.dev/
- https://faucet.rinkeby.io/
- https://faucet.metamask.io/
- https://goerlifaucet.com – hosted by Alchemy
Creating Contracts with Solidity
The primary language used to create contracts is Solidity. What is a contract? A contract is a definition of events, data, and functions (business logic). You can think of a contract as a class. When you deploy a contract to the Ethereum network it is similar to when a class instance is instantiated. Each time you deploy the contract, a new instance is created. In code, contracts look similar to classes in languages like Javascript – not identical, but familiar.
Data is broken up into storage, memory, and call data. Variables defined outside a function are state and are included in storage. Memory is fairly constrained so it will be interesting to better understand what level of complexity is achievable.
Putting a Hold on Further Work
I decided to put a hold on further work while the Merge took place becasue things were changing and test networks generally did not seem to be working reliably enough to keep working. However, I still wanted to publish some of the things I learned. Eventually I will come back to blockchain development and pick it up again. In the meantime, I have Python work to do so I will focus on that for now. See you in my next post.