3

I am using example webwallet.html from https://github.com/ConsenSys/eth-lightwallet

It seems to work for me but I am confused on how does it actually work. Can someone explain to me please?

Here is what tried, in webwallet.html, I use localhost:8545 as host. I do not even connect my computer to internet. I give seed and password and I get 3 addresses.

Now from totally different computer I go to https://lightwallet.io, give the seed and password and I get the same 3 addresses as I saw in my local webwallet.html

I wonder how does other computer able to restore and get same 3 addresses?

Please can someone explain me how does this webwallet.html working?

3

The lightwallet relies on Hierarchical Deterministic to derive the private keys. That means your 12 word seed is turned into a 128 bit master key. Now for every address you generate your private key by taking the master key and adding an incremental counter to the end.

  • Address 1 -> Private Key = Master Key + 1 -> generate public Address from Private Key
  • Address 2 -> Private Key = Master Key + 2 ...

This way you can always generate the same keys. Found this explanation from MyCellium quite helpful. It works the same for bitcoin or ethereum.

1

The reason you are able to type in a passphrase without even connecting to the internet and get 3 addresses in return is because ConsenSys implementes a Hierarchical Deterministic (HD) wallet. This means it is using an algorithm to convert passphrases into private keys. The algorithm always stays the same (it's deterministic) -online and offline- so no matter where you use their light wallet, your passphrase will always generate that same private key, enabling you to sign transactions through their client.

0

I just added an answer because I can't comment I agree completely with t-Io's answer. I would just add this the BIP32 standard as reference to check

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.