Gauss Docs
  • 🌐Getting Started
    • Welcome to Gauss
    • Whitepaper
      • Blockchain Providers Need to Do Better
        • Solving a Lack of Token Adoption
          • An Evolving Space With Untapped Potential
        • Security & Reliability
          • Curation & Vetting
            • Important Note For Brands
        • Token Creation
      • WHY BUILD WITH GAUSS?
      • Use Cases
        • Use Cases (Chart)
      • Roadmap
      • Technical Background and Blockchain Development
        • Why Another Blockchain?
        • Gauss 1.0: Built With Efficiency and a Strong Infrastructure to Launch Rapidly
        • Gauss 2.0: Added Functionality For a Better User Experiance
          • Noble Swap 2.0
          • NFTs in Gauss 2.0
          • Token Development Kit (TDK)
          • Gaming DAO
          • Omnipool
      • Token Economics
        • Gang Token Economics: Designed to Ensure Trust and Transparency
        • Token Locking Schedule
        • Reflections: Rewarding the Gauss Community
        • Charitable Allocations: Grants, Scholarships, & Financial Assistance
      • The Gauss Team
      • Important Definitions
      • DISCLAIMER
        • PURCHASER WARNING
        • PROMINENT STATEMENTS
        • FUTURE STATEMENTS
        • VALUE RISKS
        • NOT A SECURITY
    • How To Connect
      • Create Metamask Wallet
    • Links
  • ⚡Launching with Gauss
    • Benefits of Building with Gauss
      • Fostering an Environment for Success
      • Gauss Growth Grant Program
      • Gauss Liquidity Program
      • Ecosystem Integrity Fund
      • Client Referral Program
    • A Guide to Curation
      • Core Principles and Curation Guidelines
      • Curation Stages and Processing Fees
    • Building on Gauss
  • 🖥️Gauss Ecosystem
    • Gauss Chain
      • Polygon-Edge Overview
      • Architecture
      • Consensus
      • Client Modules
        • Blockchain
        • Minimal
        • Networking
        • State
        • TxPool
        • JSON RPC
        • Consensus
        • Storage
        • Types
        • Syncer
        • Sealer
        • Other Modules
      • Polygon-Edge Performance Reports
      • For Developers
        • Operate a Node
          • Local Install
          • Genesis Contract
          • Server Config
          • CLI Commands
          • Key Management
        • Run a Validator
          • Validator FAQ
        • Smart Contract Deployment Permissioning
        • Deploying Contracts
          • Remix
          • Truffle
          • Hardhat
          • Replit
    • Gauss Explorer
      • Features
      • Navigating the Explorer
        • Menus
        • Blocks
        • Transactions
      • Verifying a Smart Contract
        • Hardhat Plugin
        • Sourcify Plugin
        • OpenZeppelin Plugin
      • Interacting With Smart Contracts
      • Exporting Transactions
      • FAQ
      • For Developers
        • Gauss Explorer Dependencies
        • Deployment Guide
          • Smart Contract Verification
          • Cleaning an instance from the previous deployment
          • ENV Variables
          • Testing
        • APIs
          • Requests & Limits
          • GraphQL
          • ETH RPC
    • Noble Swap
      • Liquidity Boost Program
    • Tokens
    • Gauss NFTs
      • Ferro Cards
      • F.E.R.R.E.T. NFTs
    • Contests & Giveaways
    • Gauss Faucet
      • For Developers
    • Address List
  • 💡Additional Resources
    • Partnerships & Affiliates
    • Discord Channel
    • Contact Us
    • Learning Materials
      • Web3 Glossary
    • Media Kit
Powered by GitBook
On this page
  • Overview
  • What you will do
  • Getting started with Remix IDE
  • Smart Contract
  • Compile Smart Contract
  • Deploying to the Gauss Induction Labs Testnet
  • Remix Deployment
  • Verifying your Contract
  1. Gauss Ecosystem
  2. Gauss Chain
  3. For Developers
  4. Deploying Contracts

Remix

PreviousDeploying ContractsNextTruffle

Last updated 2 years ago

Overview

This tutorial guides you to implement a Hello World dApp which echoes a message passed to the contract on to the frontend. You will also be able to change the message using the interactive panel.

We recommend you to follow this tutorial using the online IDE available at . Remix IDE is an easy-to-use platform that does not require any downloads, creating accounts, or logins.

What you will do

  • Create a file on Remix

  • Upload a pre-built smart contract into the IDE

  • Compile the smart contract

  • Connect the application to the Gauss Induction Labs Testnet via Metamask

  • Deploy the smart contract

  • Verify the smart contract

Getting started with

Remix is a Ethereum-focused IDE: an online platform to develop and deploy smart contracts. To start building a smart contract, click on New File and name it HelloWorld.sol.

<img src={useBaseUrl("img/remix/new-file.png")} />

Smart Contract

Copy and paste the Smart Contract code provided below into the newly created HelloWorld.sol file.

// Specifies that the source code is for a version
// of Solidity greater than 0.5.10
pragma solidity ^0.5.10;

// A contract is a collection of functions and data (its state)
// that resides at a specific address on the Ethereum blockchain.
contract HelloWorld {

    // The keyword "public" makes variables accessible from outside a contract
    // and creates a function that other contracts or SDKs can call to access the value
    string public message;

    // A special function only run during the creation of the contract
    constructor(string memory initMessage) public {
        // Takes a string value and stores the value in the memory data storage area,
        // setting `message` to that value
        message = initMessage;
    }

    // A publicly accessible function that takes a string as a parameter
    // and updates `message`
    function update(string memory newMessage) public {
        message = newMessage;
    }
}

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. The line string public message declares a public state variable called message of type string. You can think of it as a single slot in a database that you can query and alter by calling functions of the code that manages the database. The keyword public automatically generates a function that allows you to access the current value of the state variable from outside of the contract. Without this keyword, other contracts have no way to access the variable.

The update function is another public function that is similar to the constructor, taking a string as a parameter, and updating the message variable.

Compile Smart Contract

  • Go to the Solidity Compiler tab (below the search button)

  • Select compiler version to 0.5.10

  • Now, compile HelloWorld.sol

  • After successful compilation, it will show a green tick mark on the Compiler tab button

Deploying to the Gauss Induction Labs Testnet

Now, we have to deploy our smart contract on G.I.L., Gauss Chain's Testnet. Not only do we require projects go through our Curration process to deploy a smart contract on Gauss Mainnet, but the contracts are immutable and can't be changed once deployed. Therefore, it's best to first deploy your smart contract to the Testnet first.

  • Open Metamask. Click on the network dropdown menu (set to Ethereum Mainnet by default) and click on the Add Network button. Enter the following details below:

    • Network Name: Gauss Induction Labs

    • RPC URL: https://rpc.giltestnet.com

    • Chain ID: 1452

    • Symbol: GANG

    • Block Explorer: https://explorer.giltestnet.com

  • Go ahead and click Save

  • Copy your wallet address from MetaMask by clicking over your account name

  • Finally, to deploy to G.I.L. Testnet, refer to the instructions in the "Remix deployment" section below

Remix Deployment

The below step will use the connect MetaMask API keys you set up in the previous steps.

  • Select Injected Provider MetaMask in the Environment dropdown and your contract

  • Accept the Connect request received in MetaMask. If the popup doesn't open by default, you can also try manually launching the MetaMask extension

  • Once MetaMask is connected to Remix, the Deploy transaction would generate another MetaMask popup that requires transaction confirmation. Simply confirm the transaction

Verifying your Contract

Flatten your Smart Contract

After installation, flatten the contract using below command (we have demonstrated using sol-merger).

sol-merger \"./contracts/*.sol\" ./build

Verifying on G.I.L. Explorer

  • Navigate to your contract's G.I.L. Explorer page and click on Code and then Verify and Publish

  • Select Solidity (Single File) in compiler type

  • Select appropriate compiler version

  • Choose the license type of your contract

In the next section, paste your flattened samrt contract here. If you had enabled optimization, then adjust the optimization section accordingly.

Constructor arguments should have been filled in automatically. If not, they can be retrieved from the trailing bytes of the deployment transaction (example: 000000000000000000000000a6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa).

The first line pragma solidity ^0.5.10 specifies that the source code is for a Solidity version greater than 0.5.10. are common instructions for compilers about how to treat the source code (e.g., pragma once).

The is a special function run during the creation of the contract and cannot be called afterward. In this case, it takes a string value initMessage, stores the value in the data storage area, and sets message to that value.

To deploy to the G.I.L. Testnet, we have to connect to the Web3 world which can be accomplished by using any of the services like Metamask, Brave, Portis, etc. We will be using MetaMask in this tutorial. Please follow this .

Head over to and request test GANG to use as gas when deploying the contract

**Congratulations! You have successfully deployed the HelloWorld Smart Contract to the G.I.L. Testnet You can start interacting with your Smart Contract. Check the deployment status at .

The first and foremost step is to flatten the solidity smart contract into a single file. In order to do that, install or .

🖥️
Remix IDE
Remix IDE
Pragmas
constructor
memory
guide to set up a MetaMask Account
Faucet
https://explorer.giltestnet.com
truffle-flattener
sol-merger