Decentralized Programmer Part 5 Deployment of your contract with Remix IDE!

in #solidity6 years ago (edited)

Deploying contracts on main or test net is very simple. At first you need to make sure you tested thoroughly your Dapp and contracts. Then decide if you want to deploy your contract on main or other type of network. It can be done with Metamask, by clicking on an dropdown in the top left corner:

Now open Remix IDE at http://remix.ethereum.org/ Make sure your contract is opened, and compiled. Then in the 'Run 'tab: ![]
()

Important details are:

  • Environment: If Injected Web3 is selected, the Remix IDE will be using Metamask to connect to Ethereum blockchain
  • Account: that account will be an owner of a smart contract. Make sure you have some Ethereum there to cover costs of deployment. Make sure the right account is selected! This is the only account that will be able to interact with special functions of your contract like a kill function:
  function kill() public {
     if(msg.sender == owner) selfdestruct(owner);
  }

Finally when all the information is correct click on the Deploy button.

That will show you a confirmation window similar to:

Tap on OK. Now you should be able to see Metamask's window. The most important part of it is Max total which is $5.46 That's the maximum cost of deployment on Ethereum's network. Not bad.

Check the Remix IDE's console: It should show information similar to:

Confirmation

If you click on the link from the console you will be able to see details of the transaction in the etherscan.io: https://etherscan.io/tx/0x0c062e888f05fd5d1ef596490b475cd08d7625b4d87d6fdf9f9334fe3bb40c19

Over here you should see address of the contract:
https://etherscan.io/address/0x0a2b0224e39c99cb0c8f4b3122142d90dfa26118

If you see similar screen:
sc.png

It means you successfully deployed your first contract!

Congratulations!