<p>There are two ways to do it in a standard transaction format that will be relayed by full nodes. However, if you are a miner you will have more leeway into the scripts that you can use to lock your transaction. However, doing this is strictly discouraged as it adds to the UTXO and blockchain bloat in the first case and blockchain bloat in the second case. This answer is meant just for educational purposes.</p>

<p>Trick 1: create a bare multi-sig output (not P2SH) and sending some non-dust value to that base multi-sig address. You would use the bare multi-sig format for encoding like <code>M &lt;pub_key_1&gt; &lt;pub_key_2&gt; ... &lt;pub_key_N&gt; N</code> but here the pubkeys between <code>OP_M</code> and <code>OP_N</code> will be your data that you want to encode padded to the public key length. However, you can lock only up to 3 keys in bare multi-sid which will be 65*3 = 195 bytes. Again I mention that this method is discouraged as it adds to the UTXO bloat.</p>

<p>Trick 2: A better and cleaner way to do it will be to lock some BTC in a hash of the data you want to store encoded in a P2SH address. Then spend these bitcoins where the unlocking script will be the data that you want to store on the blockchain. In this case you can lock a much bigger data but care has to be taken not to exceed 400,000 WU for the overall transaction for spending as it would make the transaction non-standard.</p>

CC BY-SA 4.0
2019-08-26T19:00:56.763Z
2019-08-26T19:00:56.763Z
Ugam Kamat
<p>I want to upload files to the testnet blockchain, specifically the Bitcoin testnet. I am looking for help on how to add a file to the Bitcoin testnet blockchain. I know that these coins are super easy to get via <a href="https://tbtc.bitaps.com" rel="nofollow noreferrer">https://tbtc.bitaps.com</a>, so I just want to know how do I do this? I can't use OP_RETURN because the program that sends them says that they don't work and there is an 80 byte limit that makes it harder even if I could easily do it. Is there a way to add data to the blockchain, i.e. by putting multiple addresses that encode information that have no known public key? This could be done with either bash, simple Python, or both. If there is a GUI program, that would be preferred and greatly appreciated. Thanks.</p>

CC BY-SA 4.0
2019-08-26T18:56:35.710Z
Just don't. It's not designed for that.
Pieter Wuille
CC BY-SA 4.0
2019-08-26T19:01:16.693Z
Yes, this is perfectly OK. I won't do i to mainnet because mainnet coins have real value and would cost lots of $ because I am not an early miner. (I made my first purchase in 2018 after the bubble quieted down at ~$6,500)
Number File
CC BY-SA 4.0
2019-08-26T19:12:33.513Z
+1 for @PieterWuille, It is not a question of the value of the coins but it is as if I went to the sea with the skiing for the snow. The whole blockchain would be affected
vincenzopalazzo
CC BY-SA 4.0
2019-08-26T19:24:40.760Z
@NumberFile If you don't care about doing it on mainnet, why do you care at all? This is simply not an interesting use case for blockchains.
Pieter Wuille
<database><blockchain-data-storage>
How do I upload a file to a testnet blockchain?
Number File
# How do I upload a file to a testnet blockchain?

(Asked by: username_0 on 2019-08-26)

I want to upload files to the testnet blockchain, specifically the Bitcoin testnet. I am looking for help on how to add a file to the Bitcoin testnet blockchain. I know that these coins are super easy to get via <https://tbtc.bitaps.com>, so I just want to know how do I do this? I can't use OP\_RETURN because the program that sends them says that they don't work and there is an 80 byte limit that makes it harder even if I could easily do it. Is there a way to add data to the blockchain, i.e. by putting multiple addresses that encode information that have no known public key? This could be done with either bash, simple Python, or both. If there is a GUI program, that would be preferred and greatly appreciated. Thanks.

**Tags:** database, blockchain-data-storage

> **Comments:**
> **username_1**: Just don't. It's not designed for that.  
> **username_0**: Yes, this is perfectly OK. I won't do i to mainnet because mainnet coins have real value and would cost lots of $ because I am not an early miner. (I made my first purchase in 2018 after the bubble quieted down at ~$6,500)  
> **username_2**: +1 for @username_1, It is not a question of the value of the coins but it is as if I went to the sea with the skiing for the snow. The whole blockchain would be affected  
> **username_1**: @username_0 If you don't care about doing it on mainnet, why do you care at all? This is simply not an interesting use case for blockchains.  

---

## 1 answers

### Answer by username_3 on 2019-08-26. Score: 0

There are two ways to do it in a standard transaction format that will be relayed by full nodes. However, if you are a miner you will have more leeway into the scripts that you can use to lock your transaction. However, doing this is strictly discouraged as it adds to the UTXO and blockchain bloat in the first case and blockchain bloat in the second case. This answer is meant just for educational purposes.

Trick 1: create a bare multi-sig output (not P2SH) and sending some non-dust value to that base multi-sig address. You would use the bare multi-sig format for encoding like `M <pub_key_1> <pub_key_2> ... <pub_key_N> N` but here the pubkeys between `OP_M` and `OP_N` will be your data that you want to encode padded to the public key length. However, you can lock only up to 3 keys in bare multi-sid which will be 65\*3 = 195 bytes. Again I mention that this method is discouraged as it adds to the UTXO bloat.

Trick 2: A better and cleaner way to do it will be to lock some BTC in a hash of the data you want to store encoded in a P2SH address. Then spend these bitcoins where the unlocking script will be the data that you want to store on the blockchain. In this case you can lock a much bigger data but care has to be taken not to exceed 400,000 WU for the overall transaction for spending as it would make the transaction non-standard.


---

