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?

1 Answer 1

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}`);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.