I'm thinking to store around half a dozen private keys on a smart contract. The function to read private keys is restricted to owner (deployer) of the smart contract.

Do miners have access to the restricted data? If yes - Is there any way to protect our data on ethereum blockchain?

  • There is no restricted data in Ethereum blockchain. private variables are still accessible to anyone, they just don't produce a getter. Anything you want to keep private needs to be encrypted before placing on the blockchain and then decrypted after you read it from the blockchain. TLDR - DON'T place raw private keys on the blockchain.
    – Andrey
    Commented Apr 20, 2018 at 15:00

1 Answer 1


The ethereum blockchain doesn't secure the data on the smart contract. so putting private keys or any kind of sensitive data on a smart contract is not good and "technically illegal".

You need to encrypt the data you insert in your smart contract and decrypt it when reading it form your smart contract. (this should probably be done off-chain )

=> All nodes with fully synchronized blockchain can see the data on your smart contract.

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.