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.

10
  • 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. Commented 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. Commented Jul 6, 2017 at 23:56
  • @AjoyBhatia Makes sense, I am pretty sure you are right. Commented 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. Commented Jul 7, 2017 at 0:00
  • @AjoyBhatia I agree with your interpretation. Nifty idea. Commented Jul 7, 2017 at 0:45

1 Answer 1

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.

1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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