jacogr / substrate-ledger-ed25519

Extract Substrate and Polkadot compatible ed25519 keys from Ledger mnemonic phrases
145 stars 15 forks source link

Doesn't account for 25th word #1

Closed straightforwardgas closed 3 years ago

straightforwardgas commented 3 years ago

Having problems extracting my seed, I added an extra 25th word to my ledger and the program does not like that.

straightforwardgas commented 3 years ago

Sorry for asking, how would I implement this on the current code I cloned to extract my seed key?

jacogr commented 3 years ago

The PR in https://github.com/jacogr/sample-ledger-ed25519/pull/2 should take care of it -

My Ledger is travelling (not with me for another 3 weeks), so have not been able to test the addition of handling the 25th word against the actual device.

Would appreciate a report-back if it does indeed work for you now.

If not, would need a testcase (25 word list + address) to build into the underlying libs as a test and see how to get there. (Or just wait until I'm able to generate that myself again and can then properly test the generation)

straightforwardgas commented 3 years ago

Hey, thanks for the reply! Just tried it, does not work. Throwing a "Error: cannot find module '@polkadot/networks'" and a internal/modules/cjs/loader.js:638 throw err;

jacogr commented 3 years ago

Did you run yarn or npm install? The above points to not finding the package, however it is there in the package.json file so must be installed. My output with a basic invalid test -


$ npm start polkadot "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" 0 0

> sample-ledger-ed25519@1.0.0 start /Users/jaco/Projects/polkadot-js/test/sample-ledger-ed25519
> node ./index.js "polkadot" "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" "0" "0"

     ed25519 seed    0xe8c68348586d53e4e8d1a864b0e4e17c75e4eb06e0c63c1432bef2ba29e69d41

    address (DOT)    12aRjLzT5ycoWGHwoHLoXxd5QBa6bxuqivMQSGsPonzd9MWa
    address (KSM)    E9kFL5FrZNFpP6scM6rHm9vh9rgiLAt6oTffe9zjWBbhysD
straightforwardgas commented 3 years ago

I used npm install, let me try it again.

straightforwardgas commented 3 years ago

Following those steps listed

Clone the repo via git clone https://github.com/jacogr/sample-ledger-ed25519.git Change into the folder cd sample-ledger-ed25519 Install the dependencies via npm install (or yarn)

then using the same example

npm start polkadot "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" 0 0

has given me the same error, where the program is not finding the package.

straightforwardgas commented 3 years ago

Edit: Found my first error, whoops, sorry. I seem to have ran into another error.

> node ./index.js "polkadot" "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" "0" "0"

/home/name/sample-ledger-ed25519/node_modules/@polkadot/networks/index.js:3
import { knownGenesis, knownIcon, knownLedger, knownTestnet } from "./defaults.js";
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/jae/sample-ledger-ed25519/index.js:1:27)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sample-ledger-ed25519@1.0.0 start: `node ./index.js "polkadot" "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" "0" "0"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sample-ledger-ed25519@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
jacogr commented 3 years ago

That is weird :) Especially if it worked for you before. What is node --version?

straightforwardgas commented 3 years ago

Yeah, sorry. Haha, node version is v10.19.0 I believe

jacogr commented 3 years ago

Ok, you should upgrade that to at least 14 (I just added an entry in the package.json to warn about that, sorry about the run-around)

straightforwardgas commented 3 years ago

no problem. Thank you so much!