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.
3. After compile finishing you must go to the run tab:
4. Make sure you have a MetaMask installed (if not use MetaMask install it from here https://metamask.io/) and run on a live network.
5. Make sure you have funds in your current MetaMask account they are needed to pay the gas price for uploading the contract to the live network.
6. 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.
7. 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.
8. 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 constructor param.
It is as simple as that, if you have questions ask them in the comments.