<p><code>data</code> is meant for OP_RETURN outputs.</p>

<p>You cannot add comments using <code>sendrawtransaction</code>.</p>

CC BY-SA 4.0
2019-09-15T11:47:28.277Z
Do you have any idea to put comment?
H.Mohseni
CC BY-SA 4.0
2019-09-15T11:58:09.500Z
Use sendtoaddress, or keep a map of `txid`:`comment` in an outside database.
Raghav Sood
CC BY-SA 4.0
2019-09-15T11:36:23.343Z
2019-09-15T11:36:23.343Z
Raghav Sood
<p>I use <a href="https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/sendrawtransaction/" rel="nofollow noreferrer">sendrawtransaction</a> to submitt my transaction and I want to put comment or comment-to in transaction like <a href="https://bitcoincore.org/en/doc/0.18.0/rpc/wallet/sendtoaddress/" rel="nofollow noreferrer">sendtoaddress</a> fields that store in the wallet and not sent with transactions. I think the <code>"data": "hex"</code> field in <a href="https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/createrawtransaction/" rel="nofollow noreferrer">createrawtransaction</a> is for this, but I can not use that.</p>

<p>I use the following list as recipients field in createrawtransaction, but I get error: <strong><em>bitcoinrpc.authproxy.JSONRPCException: -8: Invalid parameter, key-value pair must contain exactly one key</em></strong></p>

<pre><code> [{'mowMh2bocyV97NUP9vqVsuCPcJ2XhJUuoH': Decimal('0.000123'),
 '2NAJPzU1pVTcNABNrdrD336eRWRrbKBBuSe': Decimal('0.03149347')},
 {'data': 'happy birthday'}]
</code></pre>

<p>How to use that? Is there any good idea to do this?</p>

<bitcoin-core><json-rpc>
How to put comment when use sendrawtransaction in bitcoincore?
H.Mohseni
# How to put comment when use sendrawtransaction in bitcoincore?

(Asked by: username_0 on 2019-09-15)

I use sendrawtransaction to submitt my transaction and I want to put comment or comment-to in transaction like sendtoaddress fields that store in the wallet and not sent with transactions. I think the "data": "hex" field in createrawtransaction is for this, but I can not use that.
I use the following list as recipients field in createrawtransaction, but I get error: bitcoinrpc.authproxy.JSONRPCException: -8: Invalid parameter, key-value pair must contain exactly one key
 [{'mowMh2bocyV97NUP9vqVsuCPcJ2XhJUuoH': Decimal('0.000123'),
 '2NAJPzU1pVTcNABNrdrD336eRWRrbKBBuSe': Decimal('0.03149347')},
 {'data': 'happy birthday'}]

How to use that? Is there any good idea to do this?

**Tags:** bitcoin-core, json-rpc


---

## 1 answers

### Answer by username_1 on 2019-09-15. Score: 0 | Accepted answer

`data` is meant for OP\_RETURN outputs.

You cannot add comments using `sendrawtransaction`.

> **Comments:**
> **username_0**: Do you have any idea to put comment?  
> **username_1**: Use sendtoaddress, or keep a map of `txid`:`comment` in an outside database.  

---

