Closed CivelXu closed 6 years ago
Most JSON wallets will not have a mnemonic phrase. If you generate a wallet using ethers.objc it will encrypt the entropy and include it in the JSON payload, but (last I checked) there was no standard way to include a mnemonic in a JSON wallet, so most will not have one.
You must go the other direction, Mnemonic Phrase => JSON, not JSON => Mnemonic Phrase.
I used Geth
lib to create a wallet, it created a Keystore file in local. And I need backup this wallet by export mnemonic phrase. iOS APP imToken
had this function. so I try to implement it.
I think like this:
Keystore file -> private key -> BIP39 Seed -> BIP39 Mnemonic
Now the problem is I don't know how to generate BIP39 Seed.
You cannot convert a private key to a BIP39 mnemonic. A BIP39 mnemonic phrase derives keys from the hashes (a little more complicated than that, but conceptually similar) from the seed, so you cannot go the other direction.
If you are able to go from a keystore to a a mnemonic, it means the mnemonic seed or entropy was stored in the keystore.
Can you generate a new sample keystore file and post it here using that library?
{"address":"003ab62b31b148c5b2c2cccd945b3aaddcd3cfd0","crypto":{"cipher":"aes-128-ctr","ciphertext":"8981b0eba0b09689986acd386610035206c3d771347ddf5316748b058332d541","cipherparams":{"iv":"1f36cc4b80f19051438e58a369a164d0"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":4096,"p":6,"r":8,"salt":"9f42bc42931bc04965c7d8f721b5a39f99a4ad313442e5c82ab7d62115949cca"},"mac":"1f175d6d532d7fc2ce39f01aff18581708270d247e0c8eeb4d554756936c2dc1"},"id":"6bc6b53b-7b9f-4cd5-aa76-e11fd03aa1fa","version":3}
This file is built By Geth lib.
I want to know Is there a way to generate mnemonic by this.
In fact, imToken
can export mnemonic by imported Account (which you import any way).
I have fully understood the mnemonic, private key and Keystore. Thank you for your help! I closed this issue.
Awesome! Glad it all makes sense now. :)
+ (Cancellable*)decryptSecretStorageJSON: (NSString*)json password: (NSString*)password callback: (void (^)(Account *account, NSError *NSError))callback;
This Func can get an Account instance, But the property
mnemonicPhrase
andmnemonicData
is nil value. Have you implemented export mnemonic words by local Keystore file. I need your help !