3c/doc/01_environment.md
2025-02-10 18:37:19 +01:00

1.8 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.

  1. Go to MetaMask
  2. Install the browser extension
  3. Go to Advanced settings, click "Show Test Networks"
  4. Click this button and select "Sepolia" from the dropdown (should be at the bottom)

the button

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 symbol TTN.
  • 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.


  1. Decentralized applications (lmao) ↩︎