53
votes
Accepted
How to import a plain private key into geth or Mist?
Paste the key into a text file, save it to disk and use the path to that file with geth account import. Here are some example Windows instructions that might help:
Open Notepad
Paste key into notepad ...
41
votes
Accepted
Where is the private key for a contract stored?
Contracts do not possess private keys in the same way that your ether wallet does. Instead, they have programming code written in the language of the Ethereum Virtual Machine.
To determine what a ...
26
votes
Accepted
What if I had the private key that had the public address of a contract?
From my reading of the Yellow Paper (YP), Yes you would be able to spend the funds of the contract. But as you note, it is with extremely low probability of being able to find a contract's private ...
eth♦
- 78.8k
25
votes
workflow on signing a string with private key, followed by signature verification with public key
I was having the same problem earlier, so I am going to give an extensive answer to how this works. I assume you are using geth as a client. There is an open issue where the geth client returns v in ...
25
votes
How do I get the raw private key from my Mist keystore file?
You can use MyEtherWallet or MyCrypto(fork of MyEtherWallet) offline only wallet "view wallet details" function to extract private key from wallet json file. Feel free to use its offline version on an ...
25
votes
Accepted
Is each Ethereum address shared by (theoretically) 2 ** 96 private keys?
Your calculations are right, except there aren't exactly 2^256 private keys -- there are "FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141" (this number is named N in the ETH ...
24
votes
How to import a plain private key into geth or Mist?
Use the following command in the geth console
web3.personal.importRawKey("<Private Key>","<New Password>")
23
votes
Accepted
Can I use the same private key for Ethereum and Bitcoin?
Yes, both cryptocoins use the same elliptic curve SECP256K1.
Perhaps a better alternative is to use a BIP32 wallet. You have a master key that is not directly used for transactions, but it is used to ...
22
votes
Accepted
How can I get a mnemonic phrase from a private key?
No, a mnemonic is generated using an hd wallet - a hierarchical deterministic wallet. Private keys are "children" of this mnemonic and there can be millions of them, but there's no way to go back to ...
20
votes
Accepted
What the difference between Bitcoin and Ethereum private/public keys and address?
Yes and no.
No - a Bitcoin address cannot be directly used in Ethereum, and vice versa.
Yes - underneath, a bitcoin private key is essentially a random 256-bit number (in a certain range, see ...
19
votes
Accepted
How to validate a private key?
As mentioned by Peter, a private key is a random 256 bit blob. It is a common oversight that there're no restrictions.
It has to be valid for the secp256k1 curve, which means two conditions:
cannot ...
18
votes
Accepted
Do I need to encrypt the keystore file(s)?
The private key is encrypted and, if you are confident in your password's strength, does not need to be encrypted again. The key is encrypted with 128-bit AES by default if you're using geth, and all ...
18
votes
Accepted
How to properly create a raw transaction and sign it using web3 in browser
Below is working code that calls "increment" on https://programtheblockchain.com/dapps/counter. (More info about that sample here: https://programtheblockchain.com/posts/2017/12/13/building-...
18
votes
How to properly create a raw transaction and sign it using web3 in browser
Using Web3.js 1.0.0
encoded = contractInstance.methods.myMethod(params).encodeABI()
var tx = {
to : myContractAddress,
data : encoded
}
web3.eth.accounts.signTransaction(tx, privateKey)....
17
votes
EthereumJS: How to get public key from private key
ethereumjs-wallet can be used to get public key from private key:
> const hdkey = require('ethereumjs-wallet/hdkey')
> const privateKey = hdkey.fromMasterSeed('random')._hdkey._privateKey
> ...
16
votes
How do I get the raw private key from my Mist keystore file?
If you have node.js, you can do this in node
var keyth=require('keythereum')
//install keythereum by runing "npm install keythereum"
var keyobj=keyth.importFromFile('0x...your..ether..address..','./...
14
votes
Accepted
How can I get my accounts into metamask or vice versa?
You can now import single/"loose"(as we call) keys into MetaMask if you click the menu in the top right corner. It will drop down with the option "Import account", you can click that and it will take ...
14
votes
Accepted
How to generate a keystore (UTC) file from the raw private key?
geth-compatible keystore file can be created in Node using ethereumjs-wallet library:
> var Wallet = require('ethereumjs-wallet');
> var key = Buffer.from('...
13
votes
How can I get my accounts into metamask or vice versa?
Edit: the following info is outdated. It still works, but see the verified answer to import directly.
Currently I don't believe you can import into Metamask, so I did it the other way around. Here is ...
13
votes
How do I get the raw private key from my Mist keystore file?
I will try to provide an alternative solution that is more "hands-on" than using a particular application, or JavaScript. It seems to me lacking "hands-on" details might be one of the reasons why ...
13
votes
How to change the password to an account?
Simply use geth as indicated in the github wiki:
Account update
$ geth account update a94f5374fce5edbc8e2a8697c15331677e6ebf0b
Unlocking account a94f5374fce5edbc8e2a8697c15331677e6ebf0b | Attempt ...
13
votes
Accepted
Does knowing half private key provide any useful information?
For a numbers of 64 hexadecimal digits, there are 16 ^ 64 = 115792089237316195423570985008687907853269984665640564039457584007913129639936 possibilities.
For a numbers of 32 hexadecimal digits, there ...
13
votes
What the difference between Bitcoin and Ethereum private/public keys and address?
Just to add to the very good accepted answer:
Coin | Address size | Address encoding | Address creation
---------+---------------------+------------------+------------------
Bitcoin | ...
13
votes
Accepted
How to get private keys on Truffle from Ganache accounts
You can start ganache with a mnemonic as a parameter ( -m 'jar boss sister abuse equal ....'). Doing this, you'll:
be guaranteed to have the same addresses generated with each run
be able to derive ...
13
votes
Accepted
How can I get a private key from a mnemonic phrase?
Here are two options:
Using ethers.js - the example below uses a mnemonic
ethers wallet documentation
const ethers = require('ethers');
let mnemonic = "YOUR MNEMONIC";
let mnemonicWallet = ...
12
votes
How to import a plain private key into geth or Mist?
Mist has no way to import via GUI, so you need to import using command line (geth). It will show up in your Mist immediately.
For Mac:
Open TextEdit
Paste key into TextEdit without any extra ...
11
votes
workflow on signing a string with private key, followed by signature verification with public key
Here's a working example I tested out using truffle:
Example.sol
pragma solidity ^0.4.0;
contract Example {
function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) returns (address) {
...
11
votes
Accepted
Getting private keys of geth accounts
For test net, the folder you are looking for is ~/.ethereum/testnet/keystore/.
11
votes
Accepted
Location of public and private keys of Ethereum account
Some of the links in the comments helped me get the answers to my questions. I have collected all that information combined with my own (recently acquired) knowledge of cryptography from the Coursera ...
11
votes
What is the difference between a private key, password, brain wallet, recovery passphrase, and wallet?
(I've left this as an answer, rather than a wiki, to encourage multiple answers since there may be other explanations that resonate better with people)
For brevity, this answer assumes that the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
private-key × 415public-key × 74
wallets × 71
go-ethereum × 50
addresses × 46
web3js × 38
security × 38
keystore × 34
metamask × 29
transactions × 28
encryption × 27
signature × 26
myetherwallet × 25
accounts × 24
ether × 23
cryptography × 18
blockchain × 17
import × 15
ethereum-wallet-dapp × 13
mnemonic × 13
javascript × 11
hd-wallets × 11
recovery × 11
openethereum × 11
keymanagement × 11