iancoleman / bip39

A web tool for converting BIP39 mnemonic codes
https://iancoleman.io/bip39/
MIT License
3.57k stars 1.45k forks source link

XLM Stellar Lumens #287

Closed sui77 closed 5 years ago

sui77 commented 5 years ago

Ok, with its official stellar-base and other dependencies the resulting .js got pretty big (1M) and I know that's not really appealing. Anyways, here it is...

Specs => https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md (Main difference is, path usually only contains purpose, coin and account#)

Live => http://bip39.sui.li/src/ Worked with the example from specs and a mnemonic from my ledger.

iancoleman commented 5 years ago

Thanks for this.

Not sure why there's some json files, can you please help me understand why they're included?

Also what process should be used audit the stellar-util.js file?

sui77 commented 5 years ago

Sure. libs/stellar-util/stellar-util.js is the actual source which contains nothing than deriving the key and converting it to a stellar keypair. It uses the ed25519-hd-key (implements stellar key derivation, don't know much about the lib but lgtm) and stellar-base (part of "official" js-sdk from stellar dev foundation) libraries. Those dependencies as well as the build command are defined in the package.json. You can build the resulting browserified+compressed src/stellar-util.js on your own as stated in libs/stellar-util/readme.md:

rm src/js/stellar-util.js
cd libs/stellar-util
npm install

# (will run `browserify stellar-util.js | uglifyjs -c -m > ../../src/js/stellar-util.js`)
npm run build
iancoleman commented 5 years ago

Thanks for clarifying.

bitcoinjs-lib, ethereumjs-util etc are not minified / uglified (actually all libraries should not be but some seem to have slipped through!)

Can you please update with the unminified version?

Sorry to keep pushing work back to you but I am not able to directly do work supporting non-bitcoin code because it would become too much.

heri16 commented 5 years ago

Shouldn't the HDNode.MASTER_SECRET be "ed25519 seed" instead of "Bitcoin seed" for Stellar according to here? https://galactictalk.org/d/549-secret-key-seed-from-bip39/15

EDIT: Found it here: https://github.com/alepop/ed25519-hd-key/blob/d8071c734adab35a02a2d8ca05ab5afa2bf6d956/src/index.ts#L19

sui77 commented 5 years ago

Shouldn't the HDNode.MASTER_SECRET be "ed25519 seed" instead of "Bitcoin seed" for Stellar according to here? https://galactictalk.org/d/549-secret-key-seed-from-bip39/15

@heri16 Yeah, but most params somehow don't apply to stellar, I'm actually not even using that at all since key derivation is completely done in stellar-util.js. Now I've set a dummy entry to not break things.

@iancoleman Removed uglify.