0

I created an account on metamask, and downloaded the json of my wallet.

It's on rinkeby.

The structure of the json is

{
    "version":3,"
    id":"...",
    "address":"....",
    "crypto":
        {
            "ciphertext":"....",
            "cipherparams":{ "iv":"..." },
            "cipher":"aes-128-ctr",
            "kdf":"scrypt",
            "kdfparams":
                {
                    "dklen":...,
                    "salt":"...",
                    "n":...,
                    "r":...,
                    "p":...
                },
            "mac":"..."
        }
}

My question is related to web3.js, where signing transaction requires a private key.

What is this private key? Is part of the json above?

1

You can also obtain it programmatically:

const keythereum = require("keythereum");
console.log(keythereum.recover(yourPassword, yourJsonObject).toString("hex"));
0

Found my answer.

On metamask, I can export private key of selected account

enter image description here

Click on the threedots

enter image description here

Click on Account details

enter image description here

Click on export private key.

It now ask you a password: it's the Metamask password. It's specific to metamask.

Then it will show you the private key.

Keep it absolutely private, do not share, do not save on cloud!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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