<p>You can store data or its <strong><em>hash</em></strong> in the blockchain using OP_RETURN outputs which can store up to 80 bytes <a href="http://blog.coinprism.com/2015/02/11/80-bytes-op-return/" rel="nofollow">http://blog.coinprism.com/2015/02/11/80-bytes-op-return/</a></p>

CC BY-SA 3.0
2015-11-15T17:53:26.753Z
2015-11-15T17:53:26.753Z
Farghaly
<p>I don't see why you would store any data on the block chain instead of just a hash.</p>

<p>The Bitcoin blockchain is not intended (it's actively discouraged) and therefore not suitable for data storage. The distribution system will most likely not suit your needs either. And if you're still not convinced: you're not going to be able to pay for it anyway: Bitcoin transactions cost money per byte, so you want to use as little as possible.</p>

<p>Use some other network/storage system that matches your requirements. Be it a website or bittorrent or a piece of paper.</p>

<p>Whether the actual data there is encrypted or not is your own choice. The blockchain doesn't care.</p>

CC BY-SA 3.0
2015-11-15T17:39:26.013Z
2015-11-15T17:39:26.013Z
Jannes
<p>I don't see why you wouldn't be able to encrypt the data you'd like to share on the blockchain with the intended recipient's public key. That should keep it private from everyone except the holder of the private key, which should be the intended recipient.</p>

CC BY-SA 3.0
2015-11-15T14:01:58.987Z
2015-11-15T14:01:58.987Z
enkrates
<p>Yes, you can encrypt the data you wanted to add with SHA256 Here: </p>

<p><a href="http://www.freeformatter.com/sha256-generator.html" rel="nofollow">http://www.freeformatter.com/sha256-generator.html</a></p>

<p>Add the encrypted data to a note on one of your transaction by clicking <em>Note</em> button in <em>My Transaction</em>s.</p>

CC BY-SA 3.0
2015-11-15T23:24:14.663Z
While it's technically true that SHA256 encrypts the data it's given, it seems misleading, since you can't actually get the data back.
Nick ODell
CC BY-SA 3.0
2015-11-16T00:21:55.827Z
Strictly speaking it's not encryption, simultaneously nor does it hide the contents at all. If you put a secret behind a hash "my phone number is (541) 754-3010" anybody can just take a stab at it and roll numbers until they get a hash which matches. Storing any sort of personal data in the Bitcoin blockchain, encrypted, hashed, whatever, is absolute insanity.
Claris
CC BY-SA 3.0
2017-07-14T11:19:11.287Z
@Bitcoin if the message you hash is longer than the hash, there will be a collision. sounds like you don't trust hashing or encryption at all. people are already publicly sharing a lot of encrypted information, i don't see why doing it in the blockchain is different.
Janus Troelsen
CC BY-SA 3.0
2017-07-28T00:53:51.200Z
The input space is ascii and extremely enumerable. A hash is not encryption.
Claris
CC BY-SA 3.0
2015-11-15T19:14:07.207Z
2015-11-15T23:23:40.693Z
2015-11-15T23:23:40.693Z
Lt.Bitcoin
<p>If you need something publicly readable (but encrypted) you can put bytes into your pubkey too. Of course the bigger the message the more fees you may have to pay.</p>

<p>A scriptPubKey like this could work:</p>

<p>'my-data' OP_DROP OP_DUP OP_HASH160 pubKeyHash OP_EQUALVERIFY OP_CHECKSIG</p>

CC BY-SA 3.0
2015-11-20T03:02:53.070Z
2015-11-20T03:02:53.070Z
Richard
<p>Generally everyone can see all data stored in a blockchain.
Is there any way to handle private personal data like personal medical records which only right person can see?</p>

CC BY-SA 3.0
2015-11-15T10:56:10.333Z
Why would you want to store somebodies medical records there to begin with?
Claris
CC BY-SA 3.0
2015-11-15T14:30:04.997Z
Have a look over at the Ethereum forum: [Distributed Encrypted Electronic Health Data](https://forum.ethereum.org/discussion/718/distributed-encrypted-electronic-health-records-ehr) (This is one of the many theoretical uses of Ethereum's blockchain.)
Richard Horrocks
CC BY-SA 3.0
2015-11-15T17:50:43.150Z
@RichardHorrocks It doesn't really seem like storing or encrypting the data is the difficult part. The page glosses over the most important detail: how does a doctor who should have access to your records obtain the key to decrypt them?
Nick ODell
CC BY-SA 3.0
2015-11-17T11:42:27.893Z
I was asked by one of my friends if you can handle personal data in blockchains. I didn't think it's a good idea, but I just wanted to know if anyone knows how to do it in a good way.
Satoshi Nakanishi
<privacy>
Is there any way to store personal data in a blockchain?
Satoshi Nakanishi
# Is there any way to store personal data in a blockchain?

(Asked by: username_0 on 2015-11-15)

Generally everyone can see all data stored in a blockchain.
Is there any way to handle private personal data like personal medical records which only right person can see?

**Tags:** privacy

> **Comments:**
> **username_1**: Why would you want to store somebodies medical records there to begin with?  
> **username_2**: Have a look over at the Ethereum forum: [Distributed Encrypted Electronic Health Data](https://forum.ethereum.org/discussion/718/distributed-encrypted-electronic-health-records-ehr) (This is one of the many theoretical uses of Ethereum's blockchain.)  
> **username_3**: @username_2 It doesn't really seem like storing or encrypting the data is the difficult part. The page glosses over the most important detail: how does a doctor who should have access to your records obtain the key to decrypt them?  
> **username_0**: I was asked by one of my friends if you can handle personal data in blockchains. I didn't think it's a good idea, but I just wanted to know if anyone knows how to do it in a good way.  

---

## 5 answers

### Answer by username_4 on 2015-11-15. Score: 2

You can store data or its ***hash*** in the blockchain using OP\_RETURN outputs which can store up to 80 bytes <http://blog.coinprism.com/2015/02/11/80-bytes-op-return/>


---

### Answer by username_5 on 2015-11-15. Score: 1

I don't see why you would store any data on the block chain instead of just a hash.

The Bitcoin blockchain is not intended (it's actively discouraged) and therefore not suitable for data storage. The distribution system will most likely not suit your needs either. And if you're still not convinced: you're not going to be able to pay for it anyway: Bitcoin transactions cost money per byte, so you want to use as little as possible.

Use some other network/storage system that matches your requirements. Be it a website or bittorrent or a piece of paper.

Whether the actual data there is encrypted or not is your own choice. The blockchain doesn't care.


---

### Answer by username_6 on 2015-11-15. Score: 0

I don't see why you wouldn't be able to encrypt the data you'd like to share on the blockchain with the intended recipient's public key. That should keep it private from everyone except the holder of the private key, which should be the intended recipient.


---

### Answer by username_7 on 2015-11-15. Score: 0

Yes, you can encrypt the data you wanted to add with SHA256 Here:

<http://www.freeformatter.com/sha256-generator.html>

Add the encrypted data to a note on one of your transaction by clicking *Note* button in *My Transaction*s.

> **Comments:**
> **username_3**: While it's technically true that SHA256 encrypts the data it's given, it seems misleading, since you can't actually get the data back.  
> **username_1**: Strictly speaking it's not encryption, simultaneously nor does it hide the contents at all. If you put a secret behind a hash "my phone number is (541) 754-3010" anybody can just take a stab at it and roll numbers until they get a hash which matches. Storing any sort of personal data in the Bitcoin blockchain, encrypted, hashed, whatever, is absolute insanity.  
> **username_8**: @Bitcoin if the message you hash is longer than the hash, there will be a collision. sounds like you don't trust hashing or encryption at all. people are already publicly sharing a lot of encrypted information, i don't see why doing it in the blockchain is different.  
> **username_1**: The input space is ascii and extremely enumerable. A hash is not encryption.  

---

### Answer by username_9 on 2015-11-20. Score: -1

If you need something publicly readable (but encrypted) you can put bytes into your pubkey too. Of course the bigger the message the more fees you may have to pay.

A scriptPubKey like this could work:

'my-data' OP\_DROP OP\_DUP OP\_HASH160 pubKeyHash OP\_EQUALVERIFY OP\_CHECKSIG


---

