Setup Environment

Prerequisites

To start building your Dapp you will need to install some programs:

  • Install Node.js & npm (“Node.js Package Manager”)

  • Install Git

To check that Node is installed properly, open a console (admin PowerShell on Windows) and type node -v. This should print a version number, like v10.15.0.

To test npm, type npm -v and you should see the version number, like 6.4.1.

Install Node.js

You can skip this section if you already have a working Node.js >=16.0 installation. If not, here's how to install it on Ubuntu, MacOS and Windows.

Linux

For Ubuntu based distro, copy and paste these commands in a terminal:

sudo apt update
sudo apt install curl git
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs

Check out this link for each platform installers.

MacOS

Make sure you have git installed.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install 16
nvm use 16
nvm alias default 16
npm install npm --global # Upgrade npm to the latest version

Windows

If you are using Windows, we strongly recommend you use Windows Subsystem for Linux (also known as WSL 2). You can use Hardhat without it, but it will work better if you use it.

To install Node.js using WSL 2, please read this guide.

Creating a new Hardhat project

We'll install Hardhat using the Node.js package manager (npm), which is both a package manager and an online repository for JavaScript code.

You can use other package managers with Node.js, but we suggest you use npm 7 or higher to follow this guide. You should already have it if you followed the previous section's steps.

Open a new terminal and run these commands to create a new folder:

mkdir hardhat-tutorial
cd hardhat-tutorial
npm init
npm install --save-dev hardhat
npx hardhat init

Select Create an empty hardhat.config.js with your keyboard and hit enter.

$ npx hardhat init
888    888                      888 888               888
888    888                      888 888               888
888    888                      888 888               888
8888888888  8888b.  888d888 .d88888 88888b.   8888b.  888888
888    888     "88b 888P"  d88" 888 888 "88b     "88b 888
888    888 .d888888 888    888  888 888  888 .d888888 888
888    888 888  888 888    Y88b 888 888  888 888  888 Y88b.
888    888 "Y888888 888     "Y88888 888  888 "Y888888  "Y888

👷 Welcome to Hardhat v2.18.1 👷‍

? What do you want to do? …
  Create a JavaScript project
  Create a TypeScript project
❯ Create an empty hardhat.config.js
  Quit

When Hardhat is run, it searches for the closest hardhat.config.js file starting from the current working directory. This file normally lives in the root of your project and an empty hardhat.config.js is enough for Hardhat to work. The entirety of your setup is contained in this file.

Create a VIC Wallet

You will need a wallet address and some tokens. We will show you how to do it on both Viction Testnet and Mainnet.

1. Create a VIC wallet and save your Mnemonic

You can create a new VIC wallet using Viction Wallet mobile app for iOS, or the web version (https://wallet.tomochain.com/#/login). Under Settings go to Advanced Settings, here you can Choose network and select Viction TestNet or Viction [mainnet].

Go to Settings menu, select Backup wallet and then Continue. Here you can see your wallet’s private key and the 12-word recovery phrase. Write down the 12-word recovery phrase.

You can also create a new Viction wallet with MetaMask, MyEtherWallet or TrustWallet. For instance, for mainnet you can go to MyEtherWallet and select VIC (viction.xyz) on the top right corner. Enter a password and then Create a new wallet. Write down your recovery phrase.

For this tutorial, my wallet address (testnet) is:

0xc9b694877acd4e2e100e095788a591249c38b9c5

My recovery phrase (12-word mnemonic) is:

myth ahead spin horn minute tag spirit please gospel infant clog camera

Write them down. This will be needed later. Notice that your wallet address (public key) and your recovery phrase will be different than mine.

Important! Always keep your private key and recovery phrase secret!

2. Get some VIC funds

Tokens are required for different matters, like smart contract deployment or to use in Dapps.

Testnet: Receive 15 free testnet VIC tokens using Viction's Faucet.

Mainnet: You need real VIC tokens from exchanges.

Go to faucet and collect 30 VIC. Now your wallet has enough balance to do everything in this tutorial so… let’s go ahead!

3. The Block Explorer

To check the balance of a wallet address, you can use VicScan.

Mainnet: https://vicscan.xyz/

Testnet: https://scan-ui-testnet.viction.xyz/

Last updated