Remix IDE and Ganache: A Beginner’s Guide to Smart Contract Deployment
Description
After I shared a tutorial on deploying smart contracts with Truffle and Ganache, I’m back with another approach! Today, we’ll explore how to deploy smart contracts using Remix IDE and Ganache. Many beginners find Remix IDE to be a more user-friendly option compared to Truffle. Here, I’m assuming you’re already familiar with Ganache and Remix IDE, so we’ll jump right into the technical execution. Let’s dive in!
Information of the device used
In this article, I am using Ubuntu 22.04.3 LTS for my OS, if you are using another linux distro, or using windows or mac, I think there is no problem but you have to adjust for installation prerequisites
Prerequisites
- NodeJS (in this article, I am using node version 16.20.2)
- Npm (in this article, I am using node version 8.19.4)
The steps are as follows:
Installing ganache
In the ganache installation documentation, To install ganache, make sure you have installed Nodejs >= v16.0.0 and npm >= 7.10.0.
If you have met the requirements for npm and nodeJS, install ganache with open your terminal and execute command below
npm install ganache --global
to make sure ganache is installed, you can execute the command below to check the ganache version
ganache --version
if your terminal returns information for the ganache version, it indicates you successfully installed ganache
Go to REMIX IDE
now, we will go to REMIX IDE, you can open this link http://remix.ethereum.org/
At the start, you will be given information about the REMIX IDE
In the file explorer of REMIX IDE, expand contracts folder
For example, we will use the default smart contract provided by the REMIX IDE with the name 1_Storage.sol, click the smart contract with name 1_Storage.sol
click solidity compiler (under the search icon) and click “Compile 1_Storage.sol”
once the smart contract is successfully compiled, you can see a check mark on the solidity compiler icon.
after finishing compiling, now open the terminal again and type “ganache” to run the ganache server
The next step is to deploy the smart contract to the ganache server. reopen remix ideas in the browser then click the “run and deploy transaction” icon under the solidity compiler icon.
click on the environment dropdown, by default the environment used is “Remix VM (Shanghai)”
change the environment to “Dev-Ganache Provider”, and use the default hostname with port “http://127.0.0.1:8545”, then clik OK
if you have successfully connected to the ganache server, then click the deploy button
yass, now we successfully deployed the smart contract, look at the bottom of menu deploy & run transaction and terminal on the REMIX IDE, there is a description of the smart contract successfully deployed
You can also see in the terminal where the ganache server is running, there is also a statement that the smart contract has been created.
Conclusion
In this guide, we explored deploying smart contracts using Remix IDE and Ganache. We learned that Remix IDE offers a beginner-friendly alternative for smart contract deployment. We covered installing Ganache, connecting Remix IDE to the Ganache server, and finally deploying a sample smart contract provided by REMIX IDE. With these steps, you’re ready to deploy your own smart contracts on a local blockchain network!
In my opinion, deploying smart contracts with Remix IDE and Ganache is generally considered a simpler and easier process compared to using Truffle. This is because Remix IDE provides a user-friendly interface and eliminates the need for additional configuration and setup steps required with Truffle.
Happy Explore!