How to create smart contracts on the Ethereum blockchain

In this guide, we are going to learn how to create smart contracts on the Ethereum blockchain and other EVM chains (blockchains based on Ethereum).

In this guide, we are going to learn how to create smart contracts on the Ethereum blockchain and other EVM chains (blockchains based on Ethereum).

The programming language

On the Ethereum blockchain, smart contracts are developed using the Solidity programming language. It's a programming language that was created specifically to create smart contracts.

It's an object-oriented programming language and every smart contract works like a class on other programming languages. If you're familiar with object-oriented programming, it should be pretty straightforward for you to learn Solidity.

You can also choose to use Vyper but it is less popular at the time of writing this and most smart contracts are made with Solidity. It will be easier for you to start with Solidity.

The Development Environment

You are going to need 3 things in your environment:

  • A local node to run your smart contract on (like a local blockchain on your computer that only you are using)
  • A way to run unit tests on your contract and scripts (like a deployment script)
  • A compiler for your smart contract

You don't need to build all of that yourself, you have solutions that build that for you.

If you want to use JavaScript, you can use Hardhat. Hardhat will create a development environment for you.

You'll able to debug and compile your smart contracts, create scripts in JavaScript that interact with your smart contracts and the blockchain using Ethers and create unit tests on your smart contracts in JavaScript.

If you want to use Python instead, you can use Brownie. It does all the things that Hardhat does but the programming language you will use for scripts and tests is going to be Python.

However, Brownie doesn't provide local nodes, for that you'll need to use Ganache. With Ganache, you can run local nodes to test deploying and interacting with your smart contracts locally. You won't need it with Hardhat, it already comes with a way to create local nodes.

Ganache is part of the Truffle Suite which is an organisation that builds great tools in the Ethereum ecosystem. They have a ton of other tools, feel free to check it out!

Personally, I prefer to use Hardhat but that's just a personal preference. In my eyes there is no environment that's better than the other.

And that's it! Thanks for reading this article, feel free to download the Web3 JS Cheat Sheet below to learn how to make dApps for free!