2

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 Bhatia Jul 6 '17 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 Bhatia Jul 6 '17 at 23:56
  • @AjoyBhatia Makes sense, I am pretty sure you are right. – Daniel Valland Jul 6 '17 at 23:59
  • I will convert it to an answer, and let someone else who knows more post their own answer, if needed. – Ajoy Bhatia Jul 7 '17 at 0:00
  • @AjoyBhatia I agree with your interpretation. Nifty idea. – Rob Hitchens - B9lab Jul 7 '17 at 0:45
2

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. – Ajoy Bhatia Jul 7 '17 at 19:43

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.