<p>I suspect that the second output is being rejected because it contains an OP_RETURN with two data pushes.  From browsing the code, "Solver" in script.cpp only categorizes output scripts as "standard" if they meet one of a limited set of templates.</p>

<p>All such templates containing OP_RETURN:</p>

<ol>
<li>OP_RETURN, by itself</li>
<li>OP_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack.</li>
</ol>

<p>Since your script is "OP_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack, <strong>followed by another data push operation</strong>", it looks like it wouldn't meet either of those templates.</p>

CC BY-SA 3.0
2014-05-04T02:50:39.537Z
2014-05-04T02:50:39.537Z
Joe Amenta
<p>The raw transaction below is being rejected by bitcoind 0.9.1 (<code>error: {"code":-22,"message":"TX rejected"}</code>)</p>

<pre><code>01000000015594a8c1f84b926e84d70c3a3d5e517e0c12dc07cb1a774b587121fef08f91b8000000006a47304402203ea43861e1e22603873f49e73c6ace08d32ef024e1feaca5a6242f74bf152810022044aeee3231e81d927accf20b0b0106ec327728b6a61aedd75596c5c12e5d9999012102add59262e234c0045d1f6a3d40a144b47ea0b4214916f55fb6029a079cc0b3cbffffffff0358020000000000001976a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac0000000000000000196a054f4101000111753d687474703a2f2f7265642e70696c6cd8720000000000001976a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac00000000
</code></pre>

<p>And the following error appears in the logs:</p>

<pre><code>ERROR: AcceptToMemoryPool : nonstandard transaction: scriptpubkey
</code></pre>

<p>The decoded transaction uses OP_RETURN and looks like this:</p>

<pre><code>{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"b8918ff0fe2171584b771acb07dc120c7e515e3d3a0cd7846e924bf8c1a89455"
         },
         "script":"47304402203ea43861e1e22603873f49e73c6ace08d32ef024e1feaca5a6242f74bf152810022044aeee3231e81d927accf20b0b0106ec327728b6a61aedd75596c5c12e5d9999012102add59262e234c0045d1f6a3d40a144b47ea0b4214916f55fb6029a079cc0b3cb"
      }
   ],
   "vout_sz":3,
   "hash":"4dd1b7130045f84e7dd75a03dc802063f76687812cf877dacff2a645a1b0991b",
   "vin_sz":1,
   "out":[
      {
         "address":"12QkihKUyE1hAkv7wmaMj6V3QiN8FfMvpv",
         "script_string":"OP_DUP OP_HASH160 0f763005e063382f8f4138f75cdc64d14f8ec16f OP_EQUALVERIFY OP_CHECKSIG",
         "value":600,
         "script":"76a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac"
      },
      {
         "script_string":"OP_RETURN 4f41010001 753d687474703a2f2f7265642e70696c6c",
         "value":0,
         "script":"6a054f4101000111753d687474703a2f2f7265642e70696c6c"
      },
      {
         "address":"12QkihKUyE1hAkv7wmaMj6V3QiN8FfMvpv",
         "script_string":"OP_DUP OP_HASH160 0f763005e063382f8f4138f75cdc64d14f8ec16f OP_EQUALVERIFY OP_CHECKSIG",
         "value":29400,
         "script":"76a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac"
      }
   ],
   "size":259,
   "version":1
}
</code></pre>

<p>However OP_RETURN is standard in Bitcoin 0.9, so why is this being rejected?</p>

<p>Note: This works in testnet.</p>

CC BY-SA 3.0
2014-05-03T15:00:49.507Z
Given that bitcoin-qt is the reference  implementation, if it thinks your transaction is nonstandard, then it's nonstandard. (Note that nonstandard transactions are allowed on testnet.)
Nate Eldredge
CC BY-SA 3.0
2014-05-03T16:34:33.877Z
@NateEldredge Please post this as an answer, not a comment :) .
Jori
CC BY-SA 3.0
2014-05-03T17:00:06.553Z
Please elaborate on why it is not standard...
Flavien
CC BY-SA 3.0
2014-05-03T23:25:02.090Z
@Flavien: I would have to single-step through the source code and see exactly why the check for standardness fails.  I don't have the time or inclination to do that at present, but I encourage you to do so.
Nate Eldredge
<bitcoind><raw-transaction>
Transaction with OP_RETURN rejected by bitcoind 0.9
Flavien
# Transaction with OP_RETURN rejected by bitcoind 0.9

(Asked by: username_0 on 2014-05-03)

The raw transaction below is being rejected by bitcoind 0.9.1 (`error: {"code":-22,"message":"TX rejected"}`)

```
01000000015594a8c1f84b926e84d70c3a3d5e517e0c12dc07cb1a774b587121fef08f91b8000000006a47304402203ea43861e1e22603873f49e73c6ace08d32ef024e1feaca5a6242f74bf152810022044aeee3231e81d927accf20b0b0106ec327728b6a61aedd75596c5c12e5d9999012102add59262e234c0045d1f6a3d40a144b47ea0b4214916f55fb6029a079cc0b3cbffffffff0358020000000000001976a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac0000000000000000196a054f4101000111753d687474703a2f2f7265642e70696c6cd8720000000000001976a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac00000000

```

And the following error appears in the logs:

```
ERROR: AcceptToMemoryPool : nonstandard transaction: scriptpubkey

```

The decoded transaction uses OP\_RETURN and looks like this:

```
{
   "lock_time":0,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"b8918ff0fe2171584b771acb07dc120c7e515e3d3a0cd7846e924bf8c1a89455"
         },
         "script":"47304402203ea43861e1e22603873f49e73c6ace08d32ef024e1feaca5a6242f74bf152810022044aeee3231e81d927accf20b0b0106ec327728b6a61aedd75596c5c12e5d9999012102add59262e234c0045d1f6a3d40a144b47ea0b4214916f55fb6029a079cc0b3cb"
      }
   ],
   "vout_sz":3,
   "hash":"4dd1b7130045f84e7dd75a03dc802063f76687812cf877dacff2a645a1b0991b",
   "vin_sz":1,
   "out":[
      {
         "address":"12QkihKUyE1hAkv7wmaMj6V3QiN8FfMvpv",
         "script_string":"OP_DUP OP_HASH160 0f763005e063382f8f4138f75cdc64d14f8ec16f OP_EQUALVERIFY OP_CHECKSIG",
         "value":600,
         "script":"76a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac"
      },
      {
         "script_string":"OP_RETURN 4f41010001 753d687474703a2f2f7265642e70696c6c",
         "value":0,
         "script":"6a054f4101000111753d687474703a2f2f7265642e70696c6c"
      },
      {
         "address":"12QkihKUyE1hAkv7wmaMj6V3QiN8FfMvpv",
         "script_string":"OP_DUP OP_HASH160 0f763005e063382f8f4138f75cdc64d14f8ec16f OP_EQUALVERIFY OP_CHECKSIG",
         "value":29400,
         "script":"76a9140f763005e063382f8f4138f75cdc64d14f8ec16f88ac"
      }
   ],
   "size":259,
   "version":1
}

```

However OP\_RETURN is standard in Bitcoin 0.9, so why is this being rejected?

Note: This works in testnet.

**Tags:** bitcoind, raw-transaction

> **Comments:**
> **username_1**: Given that bitcoin-qt is the reference  implementation, if it thinks your transaction is nonstandard, then it's nonstandard. (Note that nonstandard transactions are allowed on testnet.)  
> **username_2**: @username_1 Please post this as an answer, not a comment :) .  
> **username_0**: Please elaborate on why it is not standard...  
> **username_1**: @username_0: I would have to single-step through the source code and see exactly why the check for standardness fails.  I don't have the time or inclination to do that at present, but I encourage you to do so.  

---

## 1 answers

### Answer by username_3 on 2014-05-04. Score: 7 | Accepted answer

I suspect that the second output is being rejected because it contains an OP\_RETURN with two data pushes. From browsing the code, "Solver" in script.cpp only categorizes output scripts as "standard" if they meet one of a limited set of templates.

All such templates containing OP\_RETURN:

1. OP\_RETURN, by itself
2. OP\_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack.

Since your script is "OP\_RETURN, followed by a data push operation that pushes not more than 40 bytes onto the stack, **followed by another data push operation**", it looks like it wouldn't meet either of those templates.


---

