Deploying a Simple Solidity Contract

This article explains how to deploy a simple counter contract. Note that you will need testnet $ETH to deploy a contract on your network of choice. These PoW faucets are useful starting points and you may need to bridge from Ethereum testnet to the EVM-compatible network you will be using to deploy a contract:

Sepolia: sepolia-faucet.pk910.de

Holesky: holesky-faucet.pk910.de

You can also find faucets on alchemy.com or infura.io

Follow these steps to deploy a contract:

1. Go to https://remix.ethereum.org

2. Click on “Create new file” then name your file with a .sol file type. In the image here, I have named the file TEST.sol.

Create your file.
Create your file.

3. Go to my github (star the repository and follow me while you are there) and paste the simple counter code into remix where noted in the image above.

When you paste in the code you will get a warning. Agree to proceed. It is important to note here that you can be scammed by malicious code so be careful if you start pasting code you find elsewhere on the internet.

3a. IMPORTANT: The code provided is using a current version of the solidity compiler (v0.8.21) at the time of this writing. If you get an error you may need to change to a different version.

4. Next click on the Solidity Compiler on the menu to the far left and compile your file.

Time to compile.
Time to compile.

4a. IMPORTANT: The EVM version can be found under Advanced Configurations (right above the Compile button in the image above). You may need to change that if the default is not correct for the network where you will deploy your contract.

5. Next click on Deploy & Run Transactions on the menu to the far left. In Metamask, or whatever wallet you are using, select the network you intend to deploy your contract. Then, back on Remix, change the dropdown at the top to “Injected Provider - MetaMask” (or WalletConnect if you are using a different wallet) and then click the “Deploy” button. Your wallet should prompt you to confirm the contract deployment transaction.

Deploy your contract.
Deploy your contract.

That’s it. If you want to deploy the same contract to another network, change to the new network in your wallet and hit deploy again. You will again be prompted to confirm your transaction but on the new network you selected (or you may get an error, in which case, see the bolded notes above as first steps to try to fix).

If you found this helpful, give me a follow at one or more of the places I’ve linked to here:

Subscribe to bp
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.