Prerequisites
Ethereum Testnets
Ethereum smart contracts are programs that are installed on the Ethereum blockchain. Installing a smart contract is also called deployment. Deploying smart contracts on Ethereum costs ether. The amount of ether required depends on the size of the smart contract.
Using real ether for learning smart contract development is not feasible. Fortunately, the Ethereum ecosystem operates testnets. These are versions of the Ethereum blockchain that are used for testing purposes. The main Ethereum blockchain is called mainnet. Unlike mainnet ether, testnet ether has no value. It is available for free from websites called faucets.
In this guide, we will be using the Goerli testnet (https://goerli.etherscan.io/) for Ethereum smart contract development. The domain name in the previous URL corresponds to Etherscan, a blockchain explorer which allows users to explore blockchain data in a browser. The blocks on Ethereum mainnet can be explored at https://etherscan.io/.
Node Providers
To deploy contracts to Ethereum, we need access to an Ethereum node. The node software continually downloads blocks and tracks the tip of the Ethereum blockchain. While it is possible to run an Ethereum node on our own computers, it will consume bandwidth, disk space, and CPU cycles.
It is more convenient to connect to a remote node operated by a node provider like Alchemy, Infura, or QuickNode. These are Infrastructure-as-a-Service (IaaS) companies that offer access to Ethereum nodes for a fee. All of them offer a free tier account that is sufficient for learning purposes.
See this article for more information about node providers: Alchemy Blog: What is a Blockchain Node Provider
Prerequisites for Smart Contract Development
Before beginning smart contract development, you need to complete the following steps:
- Install an Ethereum wallet and create an address to store testnet ether
- Request testnet ether from a faucet into your address
- Create an account with a node provider and generate an API key
The details of how to complete these steps are described in the next sections. Keep reading!
Note: In this guide, we will be using two different workflows for smart contract development. One will use the Remix online IDE and the other will use Hardhat.
The Remix workflow does not require a node provider API key (step 3 in the above list can be skipped). Remix will use the node provider of the Metamask wallet (which is installed as a browser plugin). The Hardhat workflow does require the API key.
While the Remix workflow is easier to setup, the Hardhat workflow is more convenient for testing and deploying smart contracts.