Wrong Electrum private keys when using BIP-84?

1

1

I'm running pre-release version d8dad7 of Electrum that supports BIP-84 HD derivations.

When exporting private keys, I'm getting WIF keys that are different from the expected output generated by bx or iancoleman.io/bip39.

Example

Create a new Electrum wallet by importing the mnemonic tumble mistake gift ill hungry chunk suggest limit artwork filter peanut exhaust with path m/84'/0'/0'.

The first pubkey (m/84'/0'/0'/0/0) is correctly generated: 0300e0d90c8cb3e1bb7b7a82bd1a118c615d97c03dd3c5f607636e9305a22bbd3e

bx shows the same key:

mnemonic="tumble mistake gift ill hungry chunk suggest limit artwork filter peanut exhaust"
echo $mnemonic | bx mnemonic-to-seed | bx hd-new | bx hd-private -i 84 -d | bx hd-private -i 0 -d | bx hd-private -i 0 -d | bx hd-private -i 0 | bx hd-private -i 0 |bx hd-to-public | bx hd-to-ec

In Electrum, the corresponding private key (Wallet -> Private keys -> export) is displayed as LEF3hMKjm4E1MVsGZLpPb5Bjza8p7qqRYn4GzjyCK8Uo1CX8w3z2.

But bx ...

 echo $mnemonic | bx mnemonic-to-seed | bx hd-new | bx hd-private -i 84 -d | bx hd-private -i 0 -d | bx hd-private -i 0 -d | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-wif

... (like iancoleman.io/bip39) gives another result: L5fR8BxqauJsNyrW1GRVnu6Fk8wAHRZhPLS9SHd6pej5isKt3qJH

Is this a bug in Electrum or an export scheme that differs from the regular WIF?

This discrepancy in private keys doesn't appear when using m/44'/0'/0' as the derivation path in Electrum.

Gustav Almgren

Posted 2018-02-09T22:32:13.023

Reputation: 41

Welcome to Bitcoin.SE! You can help by marking your answer as accepted unless you are doubtful that it is entirely correct so that the question does not remain "unanswered".Willtech 2018-02-11T04:28:21.460

Answers

3

Electrum uses a modified WIF that encodes the address type:

Release notes

Source

Gustav Almgren

Posted 2018-02-09T22:32:13.023

Reputation: 41

You can convert between private key types using this script

Abdussamad 2018-02-10T13:50:47.597

0

I wrote a code that follows the bip84 and I advise to generate electrum addresses using ZPub.

Anderson Juhasc

Posted 2018-02-09T22:32:13.023

Reputation: 51