I would like to create a Bitcoin brain-wallet generator using an Ethereum contract that takes as input a given password, and gives as output a deterministic Bitcoin private and public key corresponding to the given password. I assume the deriving of the addresses themselves from the password could be done purely by hashfunctions (SHA-256 and RIPEMD160). The motivation is of course to have an "indestructible" and trustless brain-wallet such that the generator can never be lost, and one would know for sure that it does not store any generated keys. Is this possible, and how do I ensure that the function input is not exposed to the network and/or "man in the middle attacks"? thanks.
-
If the function that accepts the password and gives the private/public key pair as output is a constant function, i.e. it does not write anything to storage and does not change the blockchain state, then calling it would not send a transaction to the blockchain. The function would just run locally on the node, so I think that the password will not be exposed to the network. Also, if it can be called as a constant function, that would give the user confidence that the contract is not storing the generated private key in its storage.– Ajoy BhatiaCommented Jul 6, 2017 at 23:55
-
I did not make my previous comment an answer because I would like someone with more expertise and knowledge to confirm that I am correct.– Ajoy BhatiaCommented Jul 6, 2017 at 23:56
-
@AjoyBhatia Makes sense, I am pretty sure you are right.– Daniel VallandCommented Jul 6, 2017 at 23:59
-
I will convert it to an answer, and let someone else who knows more post their own answer, if needed.– Ajoy BhatiaCommented Jul 7, 2017 at 0:00
-
@AjoyBhatia I agree with your interpretation. Nifty idea.– Rob HitchensCommented Jul 7, 2017 at 0:45
1 Answer
If the function that accepts the password and gives the private/public key pair as output is a constant function, i.e. it does not write anything to storage and does not change the blockchain state, then calling it would not send a transaction to the blockchain. The function would just run locally on the node, so I think that the password will not be exposed to the network. Also, if it can be called as a constant function, that would give the user confidence that the contract is not storing the generated private key in its storage.
-
I want to emphasize that the caller should send the function call to a local node. If the call is made over JSON-RPC API to a remote node, then a password sent in plaintext could be sniffed in the HTTP traffic on the Internet. Commented Jul 7, 2017 at 19:43