Post
Topic
Board Wallet software
Merits 1 from 1 user
Re: Is it possible to convert WIF to seed phrases (BIP39)?
by
JohanM
on 17/03/2024, 13:56:46 UTC
⭐ Merited by Saint-loup (1)
If you just want to backup a single WIF key using the word list, that is perfectly possible:

So let's take an example WIF key:
5JphUWRuWJwZktUdGBUmtsazoc1GGuRXFBxoTkJWZGpXjUzXXa7

We recalculate to the hex SEED using base58CheckDecode, this gives us the 32 bytes seed:
84A1A9C49C1257DE2D4FF2EEC4F6CF109E6BE3DF6E075EFB9AD895EFEAB20201

In binary this gives:
1000010010100001101010011100010010011100000100100101011111011110001011010100111 1111100101110111011000100111101101100111100010000100111100110101111100011110111 1101101110000001110101111011111011100110101101100010010101111011111110101010110 0100000001000000001

The SHA-256 checksum of this is:
45F4FD103DAAB39409C60F715E9A4B66D32322C7926ED2364169F232998D5808 or in binary
0100010111110100111111010001000000111101101010101011001110010100000010011100011 0000011110111000101011110100110100100101101100110110100110010001100100010110001 1110010010011011101101001000110110010000010110100111110010001100101001100110001 1010101100000001000

We take the first 8 bits of this hash to add at the end of the first binary bits:
So we add 01000101
and it becomes:
1000010010100001101010011100010010011100000100100101011111011110001011010100111 1111100101110111011000100111101101100111100010000100111100110101111100011110111 1101101110000001110101111011111011100110101101100010010101111011111110101010110 010000000100000000101000101
This is 264 bits length (which is divisible by 11 = 24 words)

Translating this to the BIP wordlist gives us:
lucky ask illness deal century upper release wrestle uphold chicken record cancel trade vehicle laundry science galaxy system renew cloth wrong flip amount chunk

This wordlist can be retranslated to the WIF at any time. It also contains an 8 bit checksum so you know. There is only a 0.4% chance that replacing one word will give you a correct checksum (1 in 256).