13

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?
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.
11

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.

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.