Deploy with Remix

Remix is a Ethereum-focused IDE: an online platform to develop and deploy smart contracts.

Getting started with Remix IDE

To start building a smart contract, click on New File and name it HelloWorld.sol.

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;
}
}

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

Network configuration

To deploy to the Solaris mainnet or Nebulas testnet with Remix, 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 guide to set up a MetaMask Account.

Solaris Mainnet

  • Open Metamask. Click on the network dropdown menu (set to Ethereum Mainnet by default) and click on the Add Network button and fill in network info:
  • Go ahead and click Save
  • Copy your wallet address from MetaMask by clicking over your account name
  • Make sure you have enough U2U token on Solaris mainnet. You can head over to U2OTC.com to buy some U2U token.
  • Finally, to deploy to Solaris, refer to the instructions in the "Remix deployment" section below.

Nebulas Testnet

  • Open Metamask. Click on the network dropdown menu (set to Ethereum Mainnet by default) and click on the Add Network button and fill in network info:
  • Go ahead and click Save
  • Copy your wallet address from MetaMask by clicking over your account name
  • Head over to Faucet and request test U2U - you will need this to pay for gas on the U2U network. Select U2U Nebulas Testnet as the network and U2U Token as the token in the faucet.
  • Finally, to deploy to Nebulas, refer to the instructions in the "Remix deployment" section below.

Remix Deployment

In both Testnet and Mainnet, you do the below to deploy your smart contract using Remix. 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!
  • Voila!!! Your contract has been deployed.