<p>The JSON that you see is only a nice way to look at a transaction, provided by the API you're using. The actual <a href="https://en.bitcoin.it/wiki/Raw_Transactions" rel="nofollow">raw transaction</a>, as it is transmitted on the network, is <a href="https://en.bitcoin.it/wiki/Protocol_specification#tx" rel="nofollow">binary data that looks quite different</a>.</p>

<p>The only place in the transaction that you can insert arbitrary data is the transaction <a href="https://en.bitcoin.it/wiki/Script" rel="nofollow">script</a>. This script is normally used to specify the address that the money can be paid to, but can contain arbitrary data. Note that if this data happens to be a program, it won't be executed by any (typical) client, it's <em>just</em> data.</p>

CC BY-SA 3.0
2014-07-19T14:21:54.050Z
Thanks for clearing up the JSON misunderstanding. Relating to the script, IIUC, it is not actually run by clients, they just extract the hash out of it. This means that I could add extra stuff there?
Marius
CC BY-SA 3.0
2014-07-19T15:21:06.577Z
@Marius the script is executed according to the rules of the OP codes at https://en.bitcoin.it/wiki/Script (basically, a very limited scripting language). If you wanted to include extra stuff that wouldn't run, you might just OP_RETURN and then have your data, e.g. https://blockchain.info/tx/064c3364055cc2d862f9320279e486b95a169806aac315333bb035a5ee684891 (note that this output is unspendable, so you probably want it to be 0 value so you're not throwing money away)
Tim S.
CC BY-SA 3.0
2014-07-19T13:02:38.790Z
2014-07-19T13:02:38.790Z
Tim S.
<p>It seems to me like you could put arbitrary data into a transaction payload, since it is JSON. Is this true, can a sender add additional fields to the transaction JSON? Or if thats not possible, could a sender put an arbitrary program into the scriptPubKey?</p>

<p>For example, ScriptPubKey could be <code>OP_DUP &lt;myArbitraryData&gt; OP_DROP OP_HASH160 &lt;pubKeyHash&gt; OP_EQUALVERIFY OP_CHECKSIG</code>, which would put some arbitrary data on the stack and then pop it off the stack right away again, which wouldn't influence the result of the script but would let the sender include arbitrary data in the transaction.</p>

CC BY-SA 3.0
2014-07-19T10:14:02.057Z
what do you mean with json? bitcoin protocoll has nothing to do with json I guess you are talking about blockchain.info or the bitcoin core json rpc api?
Dennis Kriechel
<protocol>
Can you put additional data in the payload?
Marius
# Can you put additional data in the payload?

(Asked by: username_0 on 2014-07-19)

It seems to me like you could put arbitrary data into a transaction payload, since it is JSON. Is this true, can a sender add additional fields to the transaction JSON? Or if thats not possible, could a sender put an arbitrary program into the scriptPubKey?

For example, ScriptPubKey could be `OP_DUP <myArbitraryData> OP_DROP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG`, which would put some arbitrary data on the stack and then pop it off the stack right away again, which wouldn't influence the result of the script but would let the sender include arbitrary data in the transaction.

**Tags:** protocol

> **Comments:**
> **username_1**: what do you mean with json? bitcoin protocoll has nothing to do with json I guess you are talking about blockchain.info or the bitcoin core json rpc api?  

---

## 1 answers

### Answer by username_2 on 2014-07-19. Score: 1

The JSON that you see is only a nice way to look at a transaction, provided by the API you're using. The actual [raw transaction](https://en.bitcoin.it/wiki/Raw_Transactions), as it is transmitted on the network, is [binary data that looks quite different](https://en.bitcoin.it/wiki/Protocol_specification#tx).

The only place in the transaction that you can insert arbitrary data is the transaction [script](https://en.bitcoin.it/wiki/Script). This script is normally used to specify the address that the money can be paid to, but can contain arbitrary data. Note that if this data happens to be a program, it won't be executed by any (typical) client, it's *just* data.

> **Comments:**
> **username_0**: Thanks for clearing up the JSON misunderstanding. Relating to the script, IIUC, it is not actually run by clients, they just extract the hash out of it. This means that I could add extra stuff there?  
> **username_2**: @username_0 the script is executed according to the rules of the OP codes at https://en.bitcoin.it/wiki/Script (basically, a very limited scripting language). If you wanted to include extra stuff that wouldn't run, you might just OP_RETURN and then have your data, e.g. https://blockchain.info/tx/064c3364055cc2d862f9320279e486b95a169806aac315333bb035a5ee684891 (note that this output is unspendable, so you probably want it to be 0 value so you're not throwing money away)  

---

