A simple dummy token. Based on the HardHat Tutorial.
- Run
npm install
to install dependencies - Run
npx hardhat test
to test the code - Start a local development ethereum node on a new terminal using
npx hardhat node --hostname 0.0.0.0
- Run
npx hardhat --network localhost run scripts/deploy.js
to deploy the Dummy Token contract, keep note of theToken Address
that will output in the terminal. - Run
npx hardhat --network localhost faucet <token-address> <your-address>
, where<token-address>
is the address of the Dummy Token contract deployed in the previous step, and<your-address>
is your Ethereum address (i.e., your MetaMask account). This will fund your Ethereum account with ETH and mint DUMMY tokens. - Connect your MetaMask extension to the
localhost
network. You should have 1 ETH in your balance. - Add the Dummy Token to MetaMask:
- Click on
Add Token
- Click on
Custom Token
- Paste on
Token Contract Address
the Dummy Token contract address (from step 4) - You should see
100 DUMMY
tokens in your wallet
- Click on
To add a development network to MetaMask, follow the instructions in the MetaMask documentation.
- Open MetaMask and click on the network dropdown at the top.
- Select "Add Network".
- Fill in the network details:
- Network Name: Localhost
- New RPC URL: http://0.0.0.0:8545
- Chain ID: 1337
- Currency Symbol: ETH
- Click "Save"
To ensure you always get the same account, define the account mnemonic in the hardhat.config.js
file.
...
networks: {
hardhat: {
accounts: {
mnemonic: "test test test test test test test test test test test junk",
},
chainId: 1337,
},
},
...