Replies: 1 comment
const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config(); // Ensure .env variables are loaded
async function main() {
const provider = new ethers.providers.JsonRpcProvider("http://127.0.0.1:7545");
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new Error("PRIVATE_KEY is not defined in .env file");
}
console.log("Private Key:", privateKey);
const wallet = new ethers.Wallet(privateKey, provider);
console.log("Wallet Address:", wallet.address);
}
main().catch((error) => {
console.error(error);
});Summary of Fixes |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
All reactions