2.2 KiB
Prerequisites
- Node.js and npm
Installation
npm init -y
npm install --save-dev hardhat
npx hardhat
What's Hardhat?
It's a development environment to compile, deploy, test, and debug your Ethereum software. It helps developers manage and automate the recurring tasks that are inherent to the process of building smart contracts and dApps1.
Getting a test Ethereum wallet
Important
In order to do this you need to have 0.0001 ETH in your Mainnet wallet (for some fucking reason) which is ~25 real cents. Everything else is free.
- Go to MetaMask
- Install the browser extension
- Go to Advanced settings, click "Show Test Networks"
- Click this button and select "Sepolia" from the dropdown (should be at the bottom)
Getting free money 😎
The google faucet is the easiest way to go. Unfortunately you only get 0.05 Sepolia ETH which is not enough to deploy a contract. You can also "mine" it here, but you need to go through a verification process.
Writing the contract
Create a new file in the contracts
directory called CoinCoinCoin.sol
(or whatever) and paste the following code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TheTokenName is ERC20 {
constructor(uint256 initialSupply) ERC20("TheTokenName", "TTN") {
_mint(msg.sender, initialSupply * 10 ** decimals()); // This is the initial supply of the token
}
}
- This code creates a new ERC20 token with the name
TheTokenName
and the symbolTTN
. - It uses OpenZeppelin's
ERC20
contract to do so.
You're ready to deploy the contract! I don't want to add the fucking emojis but this is where you'd do the 🚀✨ and whatnot.
-
Decentralized applications (lmao) ↩︎