Easiest way to deploy your Ethereum Smart Contract
Tags: blockchain, solidity, ethereum, smartcontract
Published: 2022-01-09 19:29:08

So you've written your Ethereum smart contract, and now you may be wondering how to deploy it. I recommend first deploying the contract to a Test Network (testnet), such as Rinkeby, before deploying it to Ethereum Main Network (mainnet). You can deploy to both testnet and mainnet by using the Remix web app.

## Why deploy to a testnet
Testnets behave similarly to the Ethereum Main Network, but the ETH required to transact with them is free to get from a "faucet." Faucets are apps where you can input your testnet wallet address and receive testnet assets like ETH. (I like [Chainlink's Faucet](https://faucets.chain.link) and refer to it in the instructions below.) Testnet ETH enables you to pay the gas to deploy your smart contract to testnet and make test transactions.

## Deploy the easiest way
Paste your contract code into the [Remix IDE](http://remix.ethereum.org) and deploy it from the Remix web app. Step by step instructions below:

**Set up a test account on your crypto wallet**, such as MetaMask. Make sure to select the Testnet of your choice from the Networks dropdown.

![MetaMask test account with Rinkeby network selected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/awerukuaeq90dtuw6sxi.png)


**Get ETH on Testnet from a [faucet](https://faucets.chain.link/rinkeby)** by entering the address from your test account above. You will need this in the next step to pay the gas fee for deploying your contract.

![Chainlink Faucet with Rinkeby network and 0.1 ETH selected](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ji7jf7kvqei9acdugx0p.png)


**Load [Remix](http://remix.ethereum.org)** with http rather than https to allow interaction with the wallet. Create a file in the `contracts` folder and paste in your smart contract.

![Ballot contract file in Remix IDE](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ki7ttlygex5i2jhqgpa8.png) 

Then compile the contract in the Compile tab.

![Compile Ballot contract in Remix](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bcatmv7ytartlpilgxm4.png) 


_Note: for more information on the Compiler configuration options, please read the [Remix documentation](https://remix-ide.readthedocs.io/en/latest/compile.html). The default configuration is fine for testing._

Then go to the Deploy tab when it's compiled. In the Deploy tab, use the Environment selector to select "Injected Web3." Confirm the correct Network, account and contract are selected.

![Deploy Ballot contract on Rinkeby Network in Remix](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o209r8rvxnrdqcencolx.png) 


_Note: if your `constructor` function requires any parameters, specify them in the input next to the "Deploy" button. For more on deploy configuration, see the [Remix documentation](https://remix-ide.readthedocs.io/en/latest/run.html)._

Your wallet will confirm the transaction in a pop-up window, including a gas fee. You should still have plenty left for testing transactions.

![MetaMask transaction](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p39kyy26nmtiobokqn1q.png)


_Note: if you load Remix with https, you may get this message "You are using an `https` connection. Please switch to `http` if you are using Remix against an `http Web3 provider` or allow Mixed Content in your browser." This will prevent you from connecting to your wallet, so make sure to use "http" in the URL._

**Optionally deploy to mainnet in the same Deploy tab** by selecting "Ethereum Mainnet" from the MetaMask Network selector. This will also prompt the wallet to confirm the transaction, including a gas fee.

Congrats, you've deployed your contract! Now you can interact with it on Etherscan (on [Rinkeby](https://rinkeby.etherscan.io) or [Mainnet](https://etherscan.io)) or in your very own Web3 app.