DEV Community

Martin Tonev
Martin Tonev

Posted on

How to deploy Ethereum Smart Contract via remix IDE to the live network.

If you want to deploy your smart contract into the live Ethereum network without the pain of sync the whole blockchain with ‘geth’ (around 40GB before I stop the process) which run for a week without full sync. You can deploy your contract via the Ethereum online IDE remix http://remix.ethereum.org/ .

The steps are very easy:

You need to flatten your contracts into single contract sol file, the best tool to use for this “truffle-flattener” https://www.npmjs.com/package/truffle-flattener
Copy and paste the code into the remix online IDE editor like on the screenshot:

Auto compile will compile your code and show you if there are warnings or errors.

  1. After compile finishing you must go to the run tab:

  2. Make sure you have a MetaMask installed (if not use MetaMask install it from here https://metamask.io/) and run on live network.

  3. Make sure you have funds in your current MetaMask account they are needed for pay the gas price for uploading the contract to the live network.

  4. From the select in the run tab select the contract you want to deploy

In my example, I want to deploy the contract “Crowdsale” this contract have a constructor params in my case rate, wallet and token address you want in your Crowdsale campaign to be sold.

  1. Enter the values and click the green button upload, a MetaMask will open a small window in order to confirm your transactions. After you click to confirm you will see in the IDE console logs of your actions and your contract begin deployed.

  2. You will wait a while until you can get your contact address. And that is your contract is deployed to the live Ethereum network.

  • As you can see we use a Token Contract address in our constructor deployment. This is because we use Open-Zeppelin framework they contract Crowdsale accept Token contract address which will be distributed to investors.

In this case, you must first deploy your token contract ‘TokenContractName” by selecting it from the drop-down menu as we select our Crowdsale contract. After you successfully deploy your token contract you will receive the address in the Ethereum network where your token contract is live.

You then get this address and provide it to our Crowdsale contract as a constructor param.

It is as simple as that, if you have questions ask them in the comments.

Martin Tonev: CEO at https://entro.solutions/

Top comments (1)

Collapse
 
sloan profile image
Sloan the DEV Moderator

Heyo!

This is an awesome post! 🔥

In fact, the topic of your post would also work really well in the Meta Punk Community too!

Metapunk Web3 Community 🦙

We’re a community where blockchain builders and makers, web3 devs, and nft creators can connect, learn and share 🦙

favicon metapunk.to

Meta Punk is a really cool international NFT and web3 community where artists, web3 developers, and traders can connect, learn, and share exciting discoveries and ideas. 🦙

Would you consider posting this article there too? Because Meta Punk is built on the same platform as DEV (Forem) you can fairly easily copy the Markdown and post your article there as well.

Really hope that you'll share your post with the community there and consider browsing the other Forem communities out there!