Seeing that a smart contract is just code. How would it be possible to make a smart contract generate a Bitcoin public/private key pair and send it to a user without anyone knowing the pair.

3 Answers 3


All data, transactions, and computations on the Ethereum blockchain, are public.

It is not yet possible for a contract to generate (or decrypt) secret data that is secure or hidden from observers of the blockchain. What's required is obfuscation:

Obfuscation is a way of turning any program into a “black box” equivalent of the program, in such a way that the program still has the same “internal logic”, and still gives the same outputs for the same inputs, but it’s impossible to determine any other details about how the program works.


This article may help provide related ideas which are more feasible currently.


Ethereum smart contract cannot currently be used to handle private data like private keys. All the inputs to the contract calls and the code of the contracts are broadcast to the whole network. And since the contract code execution must be deterministic, any intermediate and final outputs of this execution are also effectively known to anybody who can re-run the computation.


I don't know if this is the right place to do this but it might be worth telling us a bit more about the problem you're trying to solve.

You can't directly do anything secret on the blockchain, because the whole thing is public, but if you're dealing with a user who already has an Ethereum address, they already have a private key that they're using for Ethereum, and in theory that could also be used to spend coins on the bitcoin network.

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.