I'm currently using the lightwallet.js for ethereum and it seems to only accept a mnemonic seed to generate an ethereum address. I want to be able to use my Bitcoin private key to generate an ethereum address. I'm able to generate a bitcoin private key using bitcoinjs library, but I can't seem to figure out how I can do this with ethereum using a bitcoin private key. Is there a specific library I need to use?
-
1Related: ethereum.stackexchange.com/questions/3542/… – eth♦ Jul 26 '17 at 3:39
-
I thinks is not a good decision use your private key for this, cause this will be a security hole in the future, if some one can revert the process he can obtain your bitcoin private key and this is very dangerous if you have money inside... – Gawey Jul 27 '17 at 15:02
-
@Gawey Your public key is already exposed in bitcoin, though..no? – JamesTheAwesomeDude Dec 11 '17 at 21:09
-
@JamesTheAwesomeDude yes ofc, but the public key not the private key... there is the problem here, he want use the private key. – Gawey Dec 12 '17 at 8:45
A private key in both bitcoin and ethereum is simply a random 256 bit number (actually a number between 0 and the order of the secp256k1 curve, but that's not really important).
If you can get your raw bitcoin public key, i.e.something like a random hex string of length 64, then it can be used directly as a raw ETH private key in any library or client.
For example, to import it into geth just use
geth account import <(my_privkey)
for parity see How to import a plain private key into Parity?
To simply derive an address from the key in JS, you can use the keythereum library or ethereumjs-util
You can even use openssl, see https://kobl.one/blog/create-full-ethereum-keypair-and-address/
Putting a bitcoin private key into my ether wallet as a private key will open an Ethereum wallet
I’m not sure how this works
This also makes a few valid Ethereum addresses