Get My Account Info
This script queries the account balance of a specified account on the Hedera network using the Hedera JavaScript SDK.
Prerequisites
Step 1 : Imports and Environment Setup
const {
Client,
AccountBalanceQuery,
PrivateKey
} = require("@hashgraph/sdk");
require('dotenv').config({ path: 'Account/.env' });Step 2 : Environment Variables Retrieval
const myAccountId = process.env.MY_ACCOUNT_ID;
const myPrivateKey = PrivateKey.fromString(process.env.MY_PRIVATE_KEY);Step 3 : Main Function
Step 4 : Execute
Step 5 : To execute the code
Last updated