[Ethereum] Deriving Ethereum address from Bitcoin address

addressesbitcoinprivate-keysecp256k1

As far as I know Ethereum private keys are compatible with Bitcoin private keys, as described in Can I use the same private key for Ethereum and Bitcoin? .

HOWEVER

Can I derive an Ethereum public address from a Bitcoin public address? Without access to the private key. So that the same Bitcoin private key behind the address could be also used in Ethereum network.

Best Answer

A Bitcoin address is made by:

private key -> public key -> hash

An Ethereum address is made by:

private key -> public key -> hash -> throw some of it away and keep the rest

This means that the address alone is not enough to give you the address from the other system, but if you have the public key, you can create both the Bitcoin address and the Ethereum address.

The problem is getting the public key.

The public key cannot be deduced from the address in either Bitcoin or Ethereum. However, in both Bitcoin and Ethereum, making a transaction has the effect of publishing the public key on the network you are transacting with: In Ethereum, it is recoverable from the signature. In bitcoin, although it is recoverable from the signature, it is also explicitly sent as part of the transaction spending. (Bitcoin transactions are bigger than they need to be; Satoshi was probably not that big on cryptography.) So once a user has sent a transaction from an address on either the Bitcoin network or the Ethereum network, you can retrieve the public key from their spending transaction and use that to derive the address for the other network.

If the goal is to send the owner of a Bitcoin address assets on the Ethereum network, you also have another option: You can make a contract that is able to verify ownership of the Bitcoin address, once the owner gives it their public key. That way rather than needing the public key to send the user assets on the Ethereum network, you can defer the need to get hold of the public key until the user tries to spend the assets. Effectively, you are making a contract so that you can use a Bitcoin address on the Ethereum network. However, retrieving the funds will require the recipient to do non-standard things like sending this special contract their public key, at which point the contract will verify first that the public key supplied matches the specified bitcoin address, and then that the spender is able to provide a correct signature for that public key.

Related Topic