15

I am trying to find a library for creating Ethereum wallets in a web environment (PHP, JS). I found Keytheremjs lib, but if use it in a browser, this tool is very slow. But I found a lot of simple PHP libs for generating keys for a Bitcoin.

Questions:

  • What is the difference in encrypting Bitcoin and Ethereum private/public keys and address?
  • Can I use Bitcoin keys for the Ethereum?
Roman Frolov
  • 3,177
  • 2
  • 11
  • 29
vellmur
  • 265
  • 2
  • 6

2 Answers2

20

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 bitcoin wiki). And the private key's corresponding public key is essentially the x and y coordinates of a point on an elliptic curve. Bitcoin and Ethereum both use the same elliptic curve (secp256k1), thus the same private/public key pair can be used in both Bitcoin and Ethereum. However, the steps for converting a public key to an address are different for Bitcoin and Ethereum.
Linmao Song
  • 2,357
  • 1
  • 13
  • 35
13

Just to add to the very good accepted answer:

Coin     | Address size        | Address encoding | Address creation
---------+---------------------+------------------+------------------ 
Bitcoin  | 160 bits (20 bytes) | Base58Check      | RIPEMD160(SHA256(<public_key>)
Ethereum | 160 bits (20 bytes) | HEX*             | KECCAK256(<public_key>)**
  • *Optional EIP-55 checksum.
  • **Use the last 20 bytes.
Richard Horrocks
  • 37,835
  • 13
  • 87
  • 144