Lesson 5: Encrypted Private Key Password issue while deploying deploy.js @7:47:26 #324
-
//deploy.js
const ethers = require("ethers");
const fs = require("fs");
require("dotenv").config();
async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_URL);
const encryptedJson = fs.readFileSync("./.encryptedKey.json", "utf-8");
let wallet = new ethers.Wallet.fromEncryptedJsonSync(
encryptedJson,
process.env.PRIVATE_KEY_PASSWORD
);
wallet = await wallet.connect(provider); //encryptKey.js
const ethers = require("ethers");
const fs = require("fs");
require("dotenv").config();
async function main() {
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
const encryptedJsonKey = await wallet.encrypt(
process.env.PRIVATE_KEY_PASSWORD,
process.env.PRIVATE_KEY
);
console.log(encryptedJsonKey);
fs.writeFileSync("./.encryptedKey.json", encryptedJsonKey);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
}); I am getting the issue below, in the terminal when I deploy deploy.js with the private password:
|
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Jun 14, 2022
Replies: 1 comment 4 replies
-
@magphis Can you please show me the result after typing pwd And ls where you write this password command. |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
magphis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@magphis Can you please show me the result after typing
pwd
And
where you write this password command.