Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interoperability with other tools #28

Closed
petre-c opened this issue Jun 21, 2024 · 12 comments
Closed

Interoperability with other tools #28

petre-c opened this issue Jun 21, 2024 · 12 comments

Comments

@petre-c
Copy link

petre-c commented Jun 21, 2024

I tried and failed to recover the BIP39 seed from SLIP39 shards generated by https://github.com/pjkundert/python-slip39 with this tool.

I also failed to recover the BIP39 seed from the SLIP39 shards generated by current tool with https://github.com/pjkundert/python-slip39.

Are the two supposed to be compatible / interoperable.

My goal is to have a number of tools that can recover SLIP39 shards I generate to store my BIP39 seed phrase in a distributed way.

@petre-c
Copy link
Author

petre-c commented Jun 21, 2024

@ilap
Copy link
Owner

ilap commented Jun 21, 2024

Hi,

The problem is that SLIP-39 and BIP-39 use different method for generating their master seeds.

Though, you can make them compatible by using BIP39 entropy as SLIP39's masterkey.
Example: BIP39 entropy as masterkey -> SLIP39 shards <-> BIP39 entropy <-> BIP39 mnemonic.

@petre-c
Copy link
Author

petre-c commented Jun 21, 2024

Thanks for that, @ilap

So I'm still failing while attempting to do the roundtrip with different tools:

  • Generating entropy on https://iancoleman.io/bip39/ for seed seven replace great luggage fox rent general tower guess inside smile sing results in c4b6d998c265c56c983731676ea732e4
  • Setting c4b6d998c265c56c983731676ea732e4 as masterSecret in main.js, setting passphrase to ""
  • Execute main.js gets me (only the 2-member-shares) 👇🏾
   * Shares used by Alice alone for restoring the master secret (total of 2 member-shares):
main.js:74
	1) spew biology acrobat romp alto shaped primary body smear dough revenue duke regular column focus oral ceiling mountain blue salt grin elite prune tofu dryer away finger theory process artwork edge drink paper
main.js:16
	2) spew biology beard romp alcohol evening problem domain tackle else fumes toxic ancient recall domain mountain elite easy steady animal research smith column purple deliver holiday muscle muscle equation vocal alcohol system profile
main.js:16
	Master secret: c4b6d998c265c56c983731676ea732e4
main.js:10
	Recovered one: c4b6d998c265c56c983731676ea732e4

When I try to recover with iancoleman.io/slip39 or python-slip39 tools, both fail:

slip39-recovery --using-bip39 -m "adult scandal acrobat romp afraid pulse promise diminish elevator scatter devote quiet regular crazy fishing device shaft percent false society buyer adequate decorate jerky that example dough python switch syndrome briefing wealthy emperor" -m "adult scandal beard romp alpha guest moment orbit elder justice moisture equation should random legs ugly likely spend prevent steady glad fortune discuss shrimp scout random response goat graduate flexible both chest domain"
glimpse perfect mirror silent near order mimic egg cube boost eternal shoe near book system great curtain rifle off second industry odor network only

@ilap
Copy link
Owner

ilap commented Jun 21, 2024

pjkundert/python-slip39#22

Oooh, I see. They're compatible and interoperable, but it seems that the issue is with the iancoleman's website.

@petre-c
Copy link
Author

petre-c commented Jun 21, 2024

pjkundert/python-slip39#22

Oooh, I see. They're compatible and interoperable, but it seems that the issue is with the iancoleman's website.

Shouldn't I be able to recover the entropy I generate with slip39-js using python-slip39, then?

@ilap
Copy link
Owner

ilap commented Jun 21, 2024

So I'm still failing while attempting to do the roundtrip with different tools:

You should use List<int> or similar instead of hex string. Meaning:
Do not use: "c4b6d998c265c56c983731676ea732e4", as it uses as string, meaning 32 length string (256-bit entropy)
only use [196, 182, 217, 152, 194, 101, 197, 108, 152, 55, 49, 103, 110, 167, 50, 228] 16-length array meaning 128-bit entropy

As SLIP39's 20-length mnemonic means 128-bit entropy, while 33-length mnemonic is 256-bit entropy.

@petre-c
Copy link
Author

petre-c commented Jun 21, 2024

So then what would be the input to slip39EncodeHex() method in main.js?
image

I could not translate your code snippet to make it work within main.js

Please bear with me and pardon my ignorance.

@ilap
Copy link
Owner

ilap commented Jun 21, 2024

So then what would be the input to slip39EncodeHex() method in main.js?

Please bear with me and pardon my ignorance.

This one would do I think:
const masterSecret = [].toByteArray("c4b6d998c265c56c983731676ea732e4");

@petre-c
Copy link
Author

petre-c commented Jun 21, 2024

So then what would be the input to slip39EncodeHex() method in main.js?
Please bear with me and pardon my ignorance.

This one would do I think: const masterSecret = [].toByteArray("c4b6d998c265c56c983731676ea732e4");

YES! That worked. Thank you, @ilap

Maybe interoperability with other tools could be addressed in the docs.

@petre-c petre-c closed this as completed Jun 21, 2024
@ilap
Copy link
Owner

ilap commented Jun 21, 2024

pjkundert/python-slip39#22

Oooh, I see. They're compatible and interoperable, but it seems that the issue is with the iancoleman's website.

I created a PR for iancoelman's website to resolve the issue caused by my slip39-js v0.1.7.

@petre-c
Copy link
Author

petre-c commented Jun 21, 2024

Great, thank you, @ilap

iancoleman does not seem to be active, there are PRs sitting unmerged from 2022.

I saw you forked his repo. Would you be willing to host it somewhere for easy access?

Referencing your PR iancoleman/slip39#35

@petre-c
Copy link
Author

petre-c commented Jun 29, 2024

Hosted here -> https://3rditeration.github.io/slip39/src/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants