OCCE3004-Blockchain and Its Applications 22CE086
Practical 2
Metamask (Wallet) 1)
Go to the MetaMask website:
• Navigate to https://metamask.io/.
2) Download the Extension:
• Choose your browser (Chrome, Firefox, or Edge) and install the
MetaMask extension.
3) Set up MetaMask:
• After installation, click the MetaMask icon in your browser's
extension area.
• Click “Get Started”.
• If you’re new, click “Create a Wallet”. Otherwise, click “Import
Wallet” to import an existing wallet.
• Set up a secure password and follow the steps to save your
recovery phrase.
4) Add testnets:
• Click on the network dropdown in the top center of the
MetaMask extension (it will say "Ethereum Mainnet" by default).
• Scroll down to “Show/Hide test networks” and enable them.
• You’ll now see options like Ropsten, Rinkeby, Goerli, etc.,
available for testing.
OCCE3004-Blockchain and Its Applications 22CE086
Ganache Local Private Blockchain Network 1)
Download Ganache:
• Go to Ganache's website and download the appropriate version
for your operating system.
2) Install Ganache:
• After downloading the file, follow the installation steps for your
OS (Windows, Mac, or Linux).
3) Launch Ganache:
• Once installed, open Ganache. It will automatically generate a
private blockchain with pre-funded accounts (Ether). You will see
a list of accounts, their balances, and details about the blockchain
(like gas price, block time, etc.).
OCCE3004-Blockchain and Its Applications 22CE086
4) Configure MetaMask to connect to Ganache:
• In MetaMask, click on the network dropdown and select Custom
RPC.
• Enter the following details:
o Network Name: Ganache o New RPC
URL: http://127.0.0.1:7545 o Chain ID: 1337 o
Currency Symbol: ETH o Block Explorer URL:
Leave blank 5) Connect to Ganache:
• Now, you should be able to interact with the Ganache blockchain
through MetaMask.
• You can copy an account address from Ganache and import it into
MetaMask using the Import Account feature.
OCCE3004-Blockchain and Its Applications 22CE086
OCCE3004-Blockchain and Its Applications 22CE086
Go-Ethereum (Geth) Client
1) Download Geth:
• Visit https://geth.ethereum.org/downloads/.
• Choose your operating system and download the appropriate file.
OCCE3004-Blockchain and Its Applications 22CE086
2) Install Geth:
• Follow the installation instructions for your OS.
3) Start Geth Node
Truffle framework
1) Install Node.js:
• Truffle requires Node.js. Download and install it from
https://nodejs.org/.
2) Install Truffle:
• Once Node.js is installed, open a terminal and run:
npm install -g truffle
3) Create a New Truffle Project:
• After installation, create a new directory for your project and
navigate into it.
• Run the following command to initialize a new Truffle project:
Truffle init
OCCE3004-Blockchain and Its Applications 22CE086
4) Configure Truffle for Ganache:
• In truffle-config.js, configure the development network as follows:
networks: { development: { host: "127.0.0.1", port: 7545,
network_id: "*", // Match any network id
},
},
Hardhat framework Study and configure all testnets available
in Metamask and also setup custom network using Ganache.
1) Install Hardhat:
• In your project directory, initialize a new Node.js project if you
haven’t already:
OCCE3004-Blockchain and Its Applications 22CE086
npm init -y
• Install Hardhat by running:
npm install --save-dev hardhat 2)
Create a Hardhat project:
• Run the following command to create a new Hardhat project: npx
hardhat
• Follow the prompts to set up your project.
3) Configure Hardhat:
• In hardhat.config.js, configure the network for Ganache (similar to
Truffle): module.exports = { solidity: "0.8.0", networks: { hardhat:
{}, ganache: {
url: "http://127.0.0.1:7545",
accounts: ["0x..."], // private key here },
},
};
OCCE3004-Blockchain and Its Applications 22CE086