Recovering-Your-Keys-Without-the-MMGen-Software: indentation
parent
407f6cb7a2
commit
3ca19d15ae
1 changed files with 61 additions and 61 deletions
|
|
@ -73,58 +73,58 @@ into Bitcoin Core or some other wallet.
|
|||
We’ll solve this task using standard command-line utilities available on any
|
||||
Linux or other Unix-like system.
|
||||
|
||||
> #### <a name='a_ss'>Convert the seed to binary (legacy uncompressed addresses)</a>
|
||||
#### <a name='a_ss'>Convert the seed to binary (legacy uncompressed addresses)</a>
|
||||
|
||||
> For the legacy addresses, we begin by converting the seed to binary form and
|
||||
> storing it in a file. For that we use `xxd`, a handy tool for converting binary
|
||||
> to hex and vice versa. Don’t forget to omit the checksum from the seed and
|
||||
> remove the spaces:
|
||||
For the legacy addresses, we begin by converting the seed to binary form and
|
||||
storing it in a file. For that we use `xxd`, a handy tool for converting binary
|
||||
to hex and vice versa. Don’t forget to omit the checksum from the seed and
|
||||
remove the spaces:
|
||||
|
||||
$ echo 456d7f5f1c4bfe3bc916b87560ae6a3e | xxd -r -p > myseed.bin
|
||||
|
||||
> #### <a name='a_cs'>Scramble the seed and save to binary (non-legacy and altcoin addresses and passwords)</a>
|
||||
#### <a name='a_cs'>Scramble the seed and save to binary (non-legacy and altcoin addresses and passwords)</a>
|
||||
|
||||
> Other address types and passwords are generated by first “scrambling” the
|
||||
> seed with a unique identifier, or “scramble string”, using the HMAC-SHA256
|
||||
> algorithm. The scrambled seed is then given ten rounds of SHA256 to create the
|
||||
> base seed used to generate our keys.
|
||||
Other address types and passwords are generated by first “scrambling” the
|
||||
seed with a unique identifier, or “scramble string”, using the HMAC-SHA256
|
||||
algorithm. The scrambled seed is then given ten rounds of SHA256 to create the
|
||||
base seed used to generate our keys.
|
||||
|
||||
> Our first task then is to find out the correct scramble string for our coin
|
||||
> and address type (or password). For BTC and BTC fork coins, the string will
|
||||
> be simply the address type, e.g. `compressed` or `segwit`. For Bitcoin-based
|
||||
> altcoins, the string is the coin symbol and address type separated by a colon,
|
||||
> e.g. `ltc:legacy`. The strings for non-Bitcoin-derived altcoins are irregular
|
||||
> and are listed in the table below. For passwords, the string is the password
|
||||
> format, e.g. `b58`; the password length, e.g. `20`; and the password ID
|
||||
> string, e.g. `alice@fubar.io`, all separated by colons:
|
||||
Our first task then is to find out the correct scramble string for our coin
|
||||
and address type (or password). For BTC and BTC fork coins, the string will
|
||||
be simply the address type, e.g. `compressed` or `segwit`. For Bitcoin-based
|
||||
altcoins, the string is the coin symbol and address type separated by a colon,
|
||||
e.g. `ltc:legacy`. The strings for non-Bitcoin-derived altcoins are irregular
|
||||
and are listed in the table below. For passwords, the string is the password
|
||||
format, e.g. `b58`; the password length, e.g. `20`; and the password ID
|
||||
string, e.g. `alice@fubar.io`, all separated by colons:
|
||||
|
||||
> | Coin + Address type | Scramble String |
|
||||
> |:-----------------------------------------|:-------------------------|
|
||||
> | BTC/BCH compressed | `compressed` |
|
||||
> | BTC Segwit-P2SH | `segwit` |
|
||||
> | BTC native Segwit (Bech32) | `bech32` |
|
||||
> | LTC legacy | `ltc:legacy` |
|
||||
> | LTC compressed | `ltc:compressed` |
|
||||
> | LTC Segwit | `ltc:segwit` |
|
||||
> | LTC Bech32 | `ltc:bech32` |
|
||||
> | DASH legacy | `dash:legacy` |
|
||||
> | DASH compressed | `dash:compressed` |
|
||||
> | ETH | `eth` |
|
||||
> | ETC | `etc` |
|
||||
> | XMR | `xmr:monero` |
|
||||
> | ZEC-T | `zec:legacy` |
|
||||
> | ZEC-Z | `zec:zcash_z` |
|
||||
| Coin + Address type | Scramble String |
|
||||
|:-----------------------------------------|:-------------------------|
|
||||
| BTC/BCH compressed | `compressed` |
|
||||
| BTC Segwit-P2SH | `segwit` |
|
||||
| BTC native Segwit (Bech32) | `bech32` |
|
||||
| LTC legacy | `ltc:legacy` |
|
||||
| LTC compressed | `ltc:compressed` |
|
||||
| LTC Segwit | `ltc:segwit` |
|
||||
| LTC Bech32 | `ltc:bech32` |
|
||||
| DASH legacy | `dash:legacy` |
|
||||
| DASH compressed | `dash:compressed` |
|
||||
| ETH | `eth` |
|
||||
| ETC | `etc` |
|
||||
| XMR | `xmr:monero` |
|
||||
| ZEC-T | `zec:legacy` |
|
||||
| ZEC-Z | `zec:zcash_z` |
|
||||
|
||||
> | Password type | Scramble String |
|
||||
> |:-----------------------------------------|:-------------------------|
|
||||
> | Base58 passwords for Alice’s email acct. | `b58:20:alice@fubar.io` |
|
||||
> | Same as above, half-length passwords | `b58:10:alice@fubar.io` |
|
||||
> | Same as above, default Base32 passwords | `b32:24:alice@fubar.io` |
|
||||
> | 32-byte hex seed for Alice’s PGP key | `hex:64:alice@gnupg` |
|
||||
| Password type | Scramble String |
|
||||
|:-----------------------------------------|:-------------------------|
|
||||
| Base58 passwords for Alice’s email acct. | `b58:20:alice@fubar.io` |
|
||||
| Same as above, half-length passwords | `b58:10:alice@fubar.io` |
|
||||
| Same as above, default Base32 passwords | `b32:24:alice@fubar.io` |
|
||||
| 32-byte hex seed for Alice’s PGP key | `hex:64:alice@gnupg` |
|
||||
|
||||
> Once we’ve determined the correct string, we scramble our seed with it as
|
||||
> follows using the `openssl` utility available by default on any Unix-based
|
||||
> system:
|
||||
Once we’ve determined the correct string, we scramble our seed with it as
|
||||
follows using the `openssl` utility available by default on any Unix-based
|
||||
system:
|
||||
|
||||
# E.g. for LTC Segwit addresses:
|
||||
$ scramble_str='ltc:segwit'
|
||||
|
|
@ -134,7 +134,7 @@ Linux or other Unix-like system.
|
|||
|
||||
$ echo -n "$scramble_str" | openssl dgst -r -sha256 -mac hmac -macopt hexkey:456d7f5f1c4bfe3bc916b87560ae6a3e | xxd -r -p > scrambled-round0.bin
|
||||
|
||||
> Now add the ten rounds of sha256:
|
||||
Now add the ten rounds of sha256:
|
||||
|
||||
$ for i in 0 1 2 3 4 5 6 7 8 9; do
|
||||
openssl dgst -sha256 -binary scrambled-round${i}.bin > scrambled-round$((i+1)).bin
|
||||
|
|
@ -161,10 +161,10 @@ A double SHA-256 hash of the first link gives us the key of our first address:
|
|||
# or, for the password example:
|
||||
bd60b8ba034bbb40498667ee600bc0cc0b99eb19164e8d412a48f16da4e00d6b
|
||||
|
||||
> #### <a name='a_cr'>Checking the result (optional, address example)</a>
|
||||
#### <a name='a_cr'>Checking the result (optional, address example)</a>
|
||||
|
||||
> With `mmgen-tool`, we can easily generate the WIF key and address from this
|
||||
> hexadecimal key and see that it’s correct:
|
||||
With `mmgen-tool`, we can easily generate the WIF key and address from this
|
||||
hexadecimal key and see that it’s correct:
|
||||
|
||||
$ mmgen-tool hex2wif 05d7219524b983290138a60ada101370007f59a625c43a46f0f8d92950955e36
|
||||
5HrrmMdQbELyW7iCns5kvSbN9GCPTqEfG7iP1PZiYk49yDDivTi
|
||||
|
|
@ -172,7 +172,7 @@ A double SHA-256 hash of the first link gives us the key of our first address:
|
|||
$ mmgen-tool wif2addr 5HrrmMdQbELyW7iCns5kvSbN9GCPTqEfG7iP1PZiYk49yDDivTi
|
||||
1JVi3qcNcjMM7cTR7y9ihKUG1yDLpKRJfL # matches FE3C6545:L:1 above
|
||||
|
||||
> Or, for the Segwit example:
|
||||
Or, for the Segwit example:
|
||||
|
||||
$ mmgen-tool hex2wif b8e58ded53e9ba5a9f4e279a956c061a7da5487bde6a95f1ede0722d287881a0 compressed=1
|
||||
L3R8Fn21PsY3PWgT8BMggFwXswA2EZntwEGFS5mfDJpSiLq29a9F
|
||||
|
|
@ -181,11 +181,11 @@ A double SHA-256 hash of the first link gives us the key of our first address:
|
|||
$ mmgen-tool wif2addr L3R8Fn21PsY3PWgT8BMggFwXswA2EZntwEGFS5mfDJpSiLq29a9F segwit=1
|
||||
3LpkKqtGkcCukRrgEFWyCajSApioiEWeTw # matches FE3C6545:S:1 above
|
||||
|
||||
> But since we’re trying to do this without the MMGen software, we need to find
|
||||
> some other way to do the hex-to-WIF conversion. We could use one of many
|
||||
> key-manipulation tools available on the Internet, such as [this one][01], or
|
||||
> [this one][02]. Or we can do it ourselves: that will be covered in the next
|
||||
> section.
|
||||
But since we’re trying to do this without the MMGen software, we need to find
|
||||
some other way to do the hex-to-WIF conversion. We could use one of many
|
||||
key-manipulation tools available on the Internet, such as [this one][01], or
|
||||
[this one][02]. Or we can do it ourselves: that will be covered in the next
|
||||
section.
|
||||
|
||||
Meanwhile, let’s finish generating hex keys for the rest of our addresses (or
|
||||
passwords). To get the next key, we generate the next link in the chain from
|
||||
|
|
@ -304,10 +304,10 @@ clearer:
|
|||
|
||||
result = numtob58(num)
|
||||
|
||||
> #### <a name='a_bcu'>Base-conversion utility</a>
|
||||
#### <a name='a_bcu'>Base-conversion utility</a>
|
||||
|
||||
> Adapting our code a bit and putting it in a file gives us have a handy
|
||||
> conversion utility we can use for any key:
|
||||
Adapting our code a bit and putting it in a file gives us have a handy
|
||||
conversion utility we can use for any key:
|
||||
|
||||
$ cat hex2b58.py
|
||||
#!/usr/bin/env python
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue