Using Remix IDE
In this tutorial, we provide guidelines on how to create, compile, and deploy a simple Hello World smart contract on MELD using the Remix IDE.
Last updated
In this tutorial, we provide guidelines on how to create, compile, and deploy a simple Hello World smart contract on MELD using the Remix IDE.
Last updated
There is no need for any local environment settings for deploying solidity smart contracts on MELD using the Remix IDE.
All you require is a browser-based Web3 wallet (e.g. MetaMask) to interact with the MELD network or Kanazawa testnet and deployed contracts. If you are already using MetaMask, it is recommended to create a new account for testing with Replit. You can do this from the account menu, which appears when you click on the account avatar in the top right corner of MetaMask interface.
You must set up all of the following Pre-requisites to be able to deploy your solidity smart contract on MELD:
Download Metamask wallet
Configure MELD or Kanazawa Testnet on Metamask
Get gMELD tokens (for testnet, use https://faucet.meld.com/)
Remix is an online IDE to develop smart contracts. You need to choose Solidity Compiler, Choose the appropriate compiler version. We used 0.8.15 for this tutorial.
Create a new file, name it HelloWorld.sol, and copy the contract code given below
The first line, pragma solidity ^0.8.18 specifies that the source code is for a Solidity version greater than 0.8.15. Pragmas are common instructions for compilers about how to treat the source code (e.g., pragma once).
A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. Learn more about the constructor and memory in the docs.
Step 1: Click button to switch to compile page.
Step 2: Select the appropriate compiler version, 0.8.18 in our case.
Step 3: Enable "Auto compile"
Step 4: Open Advanced Configurations,
Step 5: Enable "Optimization"
Step 6: Select "HelloWorld" from the contract drop-down menu.
Step 7: Click "ABI" to copy the contract ABI and save it.
Follow the following steps to deploy the HelloWorld smart contract on the MELD block explorer Testnet.
Step 1: Navigate to the Deployment Page.
Step 2: Select Injected Provider in the Environment dropdown
Step 2a: Confirm the Connection Request on the MetaMask notification. Metamask might want to switch back to Ethereum mainnet, accept that and then go back into Metamask and switch to Kanazawa. The change will appear in Remix immediately.
Step 3: Select your HelloWorld.sol contract
Step 4: Deploy your smart contract.
Ensure Metamask is connected to Remix, click on the "Deploy" button which would generate another metamask popup that requires transaction confirmation.
Congratulations! You have successfully deployed a simple Smart Contract on the Kanazawa Testnet. Now you can interact with the Smart Contract.
This tutorial guided you through the basics of creating and deploying a simple smart contract using the Remix IDE and MetaMask Web Wallet. It also provides step-by-step guide on how to verify and publish your deployed smart contract. This tutorial uses testnet, however, the exact same instructions and sequence will work on the mainnet as well.