1

I did this command on parity

parity --chain mainnet account new

I got the address but, How can I export or see the private key?

bbnn
  • 236
  • 1
  • 3
  • 9

1 Answers1

0

There should be a keystore folder created somewhere on your file system.

Find the path of this folder, set it in the following script and run this script via Node.js:

const fs         = require("fs");
const keythereum = require("keythereum");

const KEYSTORE_DIR  = "The full path of your keystore folder";
const PASSWORD_FILE = "The full path of your password file";

for (const file of fs.readdirSync(KEYSTORE_DIR)) {
    const keyObject  = JSON.parse(fs.readFileSync(KEYSTORE_DIR + "/" + file, "utf8"));
    const publicAddr = keyObject.address;
    const privateKey = keythereum.recover(fs.readFileSync(PASSWORD_FILE), keyObject).toString("hex");
    console.log(`0x${publicAddr}: 0x${privateKey}`);
}
goodvibration
  • 26,003
  • 5
  • 46
  • 86