Using Remix

Using Remix

Deploys a GCN20 smart contract with a message, and renders it in the front-end. You can interact with the smart contract easily!

This dapp implements a "Hello World" style application that echoes a message passed to the contract to the front end. This tutorial is intended to be followed using the online IDE available at Remix IDE.

Setting up Remix IDE

  • Remix is an online IDE to develop smart contracts.
  • You need to choose Solidity Compiler and Deploy and Run Transactions.
  • Go to File Explorers, And Create a new file, Name it MegaCoin.sol

  • Copy/Paste the Smart contract below into the newly created file MegaCoin.sol

The smart contract

  • Create new contract GCN20Token.sol and copy contract code from the bep20 token template here

  • Modify “name”, “symbol”, “decimals” and “totalSupply” according to your requirements.

img

The first line, pragma solidity ^0.5.16 specifies that the source code is for a Solidity version greater than 0.5.16. 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.

Compile Smart Contract

  • Step1: Click button to switch to compile page

  • Step2: Select “GCN20Token” contract

  • Step3: Enable “Auto compile” and “optimization”

  • Step4: Click “ABI” to copy the contract abi and save it.

img

Now, We have to deploy our smart contract on GREAT CRYPTO NETWORK (GCN)) Network. For that, we have to connect to web3 world, this can be done my many services like Metamask, Brave, Portis etc. We will be using Metamask. Please follow this tutorial to setup a Metamask Account.

  • Open Metamask and select Custom RPC from the networks dropdown

  • Go to setting page

img

  • Add a new network

img

  • Testnet * RPC URLs * ChainID: 11512 * Symbol: GREAT CRYPTO NETWORK * Block Explorer: https://testnet-explorer.gcnscan.com

  • Mainnet * RPC URLs * ChainID: 11513 * Symbol: GREAT CRYPTO NETWORK * Block Explorer: https://gcnscan.io/

  • Go ahead and click save

  • Copy your address from Metamask

  • Head over to Faucet and request test GREAT CRYPTO NETWORK

  • Now, let's Deploy the Smart Contract on GREAT CRYPTO NETWORK (GCN)) Testnet

  • Select Injected Web3 in the Environment dropdown and your contract

img

  • Accept the Connection Request!

img

  • Once Metamask is connected to Remix, the ‘Deploy’ transaction would generate another metamask popup that requires transaction confirmation.

img

Congratulations! You have successfully deployed a GCN20 Contract. Now you can interact with the Smart Contract. Check the deployment status here: https://tnexplorer.greatcrypto.network/