Post
Topic
Board Mycelium
Re: Mycelium Bitcoin Wallet
by
cetus
on 10/11/2015, 00:18:42 UTC
Alternative tool for spending from a 2 of 3 Mycelium Entropy Shamir's Secret Sharing paper wallet?

…
In my own googleing I found this tool:

http://passguardian.com/
…

This tool works, but requires share format conversion.  It's not very easy, but doable.

Let's take this 2-of-3 example from the spec:
Code:
Private key: 5KG12Hn1g33JEFwdFsbjW4Hzi2fqdsEKZTtcJ3q9L6QFLvL1UJS
Secret: 80be1583452771c1def6789be9ab5086bf3c18dd47aa99d785056ba330bcda7aaf
2 of 3 encoding; share set ID 20ba; share length 60
  Share  1: SSS-5CJkUwdiUPZi2R8RJJzkUFvs1TWC22JAQD2T3QMyhuAvDgzrXKuhT5at
  Share  2: SSS-5CJkUyu8LAq7Newbgpc58SKsuNXvQyxAtnYzVjU1bRhF5hFYyvYaKToq
  Share  3: SSS-5CJkVAkE319sk7FZVnoUgaqge6vmK1bLXwN2mm9d3VgM5hzm6qdh5TrX
Like most things Bitcoin, Entropy shares are encoded in base-58, so let's decode the first two to hexadecimal:
Code:
$ base58 -d | hexdump -e '99/1 "%02x" "\n"'
5CJkUwdiUPZi2R8RJJzkUFvs1TWC22JAQD2T3QMyhuAvDgzrXKuhT5at
1320ba10c4d8212c98fd91b223a44db3faf5f9dafad9766ed42cf9807fc00c44f03b5aa14c178805cd                                                                                                                   
$ base58 -d | hexdump -e '99/1 "%02x" "\n"'
5CJkUyu8LAq7Newbgpc58SKsuNXvQyxAtnYzVjU1bRhF5hFYyvYaKToq
1320ba1108727dc0e28eac27395212cbcf171f3e35ebc4a67cbb59796c92a570adafc7d1740f5746c4
Any online base-58 decoding tool can be used, just remember to remove the SSS- prefix.

Divide the first share into constituent parts according to the spec:
Code:
13 20ba 1 0
c4d8212c98fd91b223a44db3faf5f9dafad9766ed42cf9807fc00c44f03b5aa14c
178805cd
The 8th digit (0) is x-1, so this share's number x = 1.
After discarding the first 8 digits (metadata) and last 8 digits (check sum), what's left is the encoded secret.  Prepend it with 80x according to secret.js's format (where x is the share's number):
Code:
801c4d8212c98fd91b223a44db3faf5f9dafad9766ed42cf9807fc00c44f03b5aa14c
and paste it into passguardian.com.

Do the same with the second share:
Code:
80208727dc0e28eac27395212cbcf171f3e35ebc4a67cbb59796c92a570adafc7d174

In 'Advanced', choose Hexadecimal secret type, then use Reconstruct.  The reconstructed secret will be
Code:
00be1583452771c1def6789be9ab5086bf3c18dd47aa99d785056ba330bcda7aaf
Note that secrets.js discards the most significant '1' bit, turning the leading 8 to 0.  Otherwise the secret is exactly what is expected.  After changing the first 0 back to 8 and converting the result with Base58Check, we get the private key in its usual form.

The spec also has a reference implementation in Python.