Electrum TESTNET public key

0

1

I'm running Electrum in test mode (electrum --testnet) and have therefore created a new wallet for it. I've also successfully received some coins via Faucet. But when checking the public key for the wallet, it starts with xpub, which doesn't make sense as according to this site it should start with tpub. How can I get the right public key, as I need it for some online service (mycelium GEAR) and it's complaining that this is a key for MAINNET.

Jernej Jerin

Posted 2017-11-26T15:00:38.770

Reputation: 103

Answers

3

This looks like a bug in Electrum's software.

What you can do is manually convert the encoding to match Testnet's encoding.

  1. Go to http://lenschulwitz.com/base58 and enter the master public key into the Base58 Decoder
  2. Take the hex and change the first four bytes (first 8 characters) to match the testnet prefix: 043587CF.
  3. Remove the last 4 bytes (last 8 characters) from the hex string.
  4. Copy the modified hex and go to http://www.fileformat.info/tool/hash.htm. Enter the copied hex string into the Hex String field under Binary Hash and click Hash.
  5. Scroll down and copy the SHA256 hash. Enter that copied hash into the Hex String field under Binary Hash and click Hash.
  6. Scroll down and copy the first four bytes (first 8 characters) of the SHA256 hash.
  7. Append the four copied bytes onto the end of the modified hex string from earlier.
  8. Enter the full modified hex string (with changed prefix and changed suffix) into the Base58 encoder on http://lenschulwitz.com/base58 and Encode it. The result will be a tpub which is valid.

Andrew Chow

Posted 2017-11-26T15:00:38.770

Reputation: 40 910

Thank you for detailed steps, I can report that it worked. Before that I actually tried the following JS snippet to generate public key from seed but it failed. Care to take a look why it doesn't generate the right one? Thanks once again.

Jernej Jerin 2017-11-26T18:16:49.113

Unfortunately, Electrum won't accept the "tpub" key to use for deriving other keys. :( Version 3.0.6 of electrum is what I tested with.Vlad 2018-02-09T14:52:14.597