Introduction

This article elucidates how to get started with Ethereum blockchain development as well as the article provides a complete guide from Solidity extension installation in VS code to Ethereum blockchain setup, smart contract development, and deployment.

In this article, we will learn

  • Solidity programming setup in VScode
  • Remix setup
  • Ethereum Local private network setup
  • Deploy and interact with Ethereum contracts in a private network using Ethereum Remix.

Prerequisites

  • VS Code

The first thing is you need to have VS code. Open the VS code and now we will proceed for Solidity Extension.

Step 1: Install Solidity Extension

Search solidity in the extensions as depicted below.

Select solidity and Click on Install.

Step 2: Create an ERC20 contract

In VScode, add folder sample-Ethereum and then subfolder contracts in your project.

Then add file token.sol under the contracts folder and then type ERC20 in the token.sol file.

ERC20 triggers the code snippet using the Solidity extension and generates a template for the ERC20 token. This template is for Ethereum an ERC20 contract. Up to now, we have ERC20 token code, once we have this, let’s try to run it. Furthermore, we will set up Ethereum private network and deploy this.

Ganache

To test Smart contracts, we need to have Ethereum virtual machine or EVM to host and run contracts. Ganache is software that creates a private Ethereum blockchain. However, you can use public testnet for example Rinkeby, and Ropsten. But to deploy a smart contract and interact in a public testnet you need funds. So, in this article, we will use Ganache and create our own private Ethereum blockchain where we will have our own control.

Install Ganache

To install Ganache, go to the official Ganache website and download it from Truffle Suite.

Once installed, open it and click on Quick Start

Where you will get the Test accounts. Note that these accounts can be imported into popular crypto wallets such as Metamask for end-to-end testing before you deploy to mainnet.

Remix

It is the most popular IDE for solidity developers. It provides an interface for easy testing with buttons to trigger a method with different parameters, as well as helps us to compile and deploy a contract on the Ethereum blockchain. However, VScode only with solidity extension can’t provide these functionalities. But we can install the Ethereum Remix extension in VSCode and get this feature. This Ethereum Remix extension is coded and maintained by the official Ethereum Foundation, so all the features available in Remix are included in this extension too.

Installing and Using Ethereum Remix for Contract Deployment

To download and install this extension, you can simply type Ethereum Remix in the extension bar and install it.

or you can download it from the marketplace and install it.

Follow the below steps to install.

  1. Simply type Ethereum Remix in the extension bar, Click on Remix and then Run & Deploy. After that select Activate.

2. Now go back to the Ganache, and press the setting icon in the top-right icon.

After that go to the Server tab as illustrated below.

3. From the above screen, copy the Hostname and port.

4. Then go To Remix and use that Hostname and port as portrayed below and click on Connect.

5. Then click on Compile to compile your ERC20 token contract. Make sure your code is opened during this step.

6. Once the code compiles then you can deploy it using a custom configuration. Click on deploy as depicted below.

Once it is deployed you can see the address of the contract.

Hence the contract is deployed and now we can test it.

Testing Ethereum Contract

  1. Now, you can test with interactive UI by clicking on Standard_Token in VS code. Here we will simply test the fund transfer method of the ERC20 contract.

The method we are going to test is: Transfer Method.

Provide the address where you want to transfer and value as shown below and then click on Transact.

Once the transfer is successful you can see the output as shown below.

Summary

Hence, the article has described how to set up solidity and remix extension in VSCode as well as how to set up Ethereum private network and create, deploy and interact with the ERC20 token.