Skip to content

Instantly share code, notes, and snippets.

Last active July 16, 2023 11:55
Show Gist options
  • Save RubenSomsen/4c148e5fe1338269666718ad45345b42 to your computer and use it in GitHub Desktop.
Save RubenSomsen/4c148e5fe1338269666718ad45345b42 to your computer and use it in GitHub Desktop.

A practical method of splitting up a 24 word seed into 3 shards of 12 words, where any 2 shards recover the full seed. No hardware required.

WARNING: you reduce the security of your 24 word seed to that of a 12 word seed (generally considered the minimum).

We make use of the fact that you can use a so-called "xor" operation to store two possible words inside of one word. This simple operation can be achieved with simple math by hand.

A simplified example with two words:

1st word = word 1155 (motion)

2nd word = word 2021 (wish)

We add the two together:

1155 + 2021 = 3176

Because the number is higher than 2048 (the total number of words), we subtract 2048:

3176 - 2048 = 1128

This gives us a third word:

3rd word = word 1128 (mind)

We now have three words, but any combination of two words, can give us the third.

1st and 2nd word = repeat the steps from above

3rd and 1st word = 1128 - 1155 + 2048 = 2021

3rd and 2nd word = 1128 - 2021 + 2048 = 1155

So in other words, by adding the 1st and 2nd word, we have created a 3rd word, and by subtracting either the 1st or 2nd word from the 3rd word, we can recover either the 2nd or the 1st word respectively.

Using the same trick as above, we can create shard for a six-word seed as follows:

Shard A: 1st word, 2nd word, 3rd + 6th word

Shard B: 3rd word, 4th word, 2nd + 5th word

Shard C: 5th word, 6th word, 1st + 4th word

If you have e.g. shard A and B, you'd have the first four words, and are missing the 5th and 6th words, which you can recover as follows:

2nd + 5th word - 2nd word = 5th word

3rd + 6th word - 3rd word = 6th word

By repeating the exact same protocol as the six-word seed above four times, we have successfully split up 24 words into 3 shards of 12 words each.

WARNING 2: Don't forget that remembering that you used this scheme becomes part of your backup recovery procedure. Since this scheme is not (yet?) widely used, be sure to take this into account when considering using it. When in doubt, I advice against using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment