'Is it possible to get a metamask private key?
I'm beginner to blockchain development, and I have a question in the polygon documentation in order to make a deployment using hradhat, you need to pass account: process.env.PRIVATE_KEY, but how do I get the user's private key when logging in to the metamask on the site?
require('dotenv').config();
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-etherscan");
module.exports = {
defaultNetwork: "matic",
networks: {
hardhat: {
},
matic: {
url: "https://rpc-mumbai.maticvigil.com",
accounts: [process.env.PRIVATE_KEY]
}
},
etherscan: {
apiKey: process.env.POLYGONSCAN_API_KEY
},
solidity: {
version: "0.7.0",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
}
Solution 1:[1]
In MetaMask's "Account details" there is an "export private key" option
Solution 2:[2]
Yes, you can get the MetaMask Private key through Google Chrome Extension.
- Go to Account Details
- Export Private Key
- Enter your Password
- Private Key Reveal to you
Make sure you do not share this with anyone this address have a all your assets stored.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Uriel Chami |
| Solution 2 | MrBlockchainer |
