<p>Standard output scripts are defined by <a href="https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp#:%7E:text=IsStandard" rel="noreferrer">IsStandard()</a> (which calls <a href="https://github.com/bitcoin/bitcoin/blob/master/src/script/standard.cpp#:%7E:text=Solver" rel="noreferrer">Solver()</a> to perform the actual script matching). The standard output scripts are as follows:</p>
<ul>
<li>P2PKH</li>
<li>P2PK</li>
<li>P2SH</li>
<li>P2WPKH</li>
<li>P2WSH</li>
<li>A script beginning with an OP_RETURN and only pushes at most 80 bytes data to the stack</li>
<li>Bare multisig up to a 3-of-3 multisig</li>
</ul>
<p>Any other script will be non-standard and the entire transaction will be rejected as being non-standard.</p>
<hr />
<p>Instead of trying to include a non-standard output script, you can instead use P2SH or P2WSH. Your output script will become the redeem script or witness script which can be anything. P2SH and P2WSH allow you to do exactly the same things as if the script were in an output script.</p>
<p>If you still insist on wanting your non-standard script to be in the output, then for your transaction to be broadcast and mined, you will need to find a miner and give them your transaction through some other means. Non-standard transactions will not be relayed and most nodes will not accept them. You will need to give your transaction to a miner who is accepting non-standard transactions, and it is highly likely that you need to do this out of band, i.e. over some form of communication that is not the P2P network.</p>

CC BY-SA 4.0
2018-12-04T18:29:15.477Z
Thank you very much for your exhaustive answer. The fact that I can't use P2SH is because this requires the redeem script to be known by the sender (so he can include the hash in the output script) and the receiver. In my setting, instead, the redeem script is known only by the sender.
Daniel
CC BY-SA 4.0
2018-12-04T21:57:37.253Z
That doesn't really make sense. How does the receiver know he's being paid if he doesn't know what output script to look for?
Ava Chow
CC BY-SA 4.0
2023-04-06T15:14:33.463Z
@AndrewChow you are saying just use P2SH instead of any non-standard script... but then the redeem script will be non-standard, right? Or is ANYTHING considered valid in a redeem script?
ZMitton
CC BY-SA 4.0
2023-04-06T16:23:22.653Z
@ZMitton Any redeemScript is valid. There are no standardness checks on the input script type.
Ava Chow
CC BY-SA 4.0
2018-12-04T16:28:39.480Z
2021-02-05T19:01:14.470Z
2021-02-05T19:01:14.470Z
Ava Chow
<p>You can always wrap your non-standard output scripts in p2sh/p2wsh output scripts, which will be recognized for standardness and propagated by nodes on the network.</p>

CC BY-SA 4.0
2018-12-04T11:09:12.180Z
The fact is that I can't use P2SH, because I need my non-standard script to be placed into an output script. With P2SH I have to place it into an input script.
Daniel
CC BY-SA 4.0
2018-12-04T11:47:18.000Z
What do you mean saying "I need my non-standard script to be placed into an output script"??? You can not today put your arbitrary script into the transaction outputs. But you can achieve the SAME goals using p2sh/p2wsh - they were designed/implemented for this case!
amaclin
CC BY-SA 4.0
2018-12-04T12:12:45.833Z
Yeah, I figured as much. However, Testnet allows me to do that.
Daniel
CC BY-SA 4.0
2018-12-04T10:40:34.203Z
2018-12-04T10:40:34.203Z
James C.
<p>I'm developing an application on Bitcoin blockchain, and I use output transaction scripts that are not standard according to the classic payment methods.
However, even so, on Tesnet everything works fine but I recently read on Bitcoin site the following:</p>

<p><img src="https://i.sstatic.net/BWmyw.png" alt="enter image description here"></p>

<p>So, appearently, Tesnet may relax some restrictions on transaction scripts, but it doesn't specify much more. So, now, I have no way of knowing if such output transaction scripts could be accepted on the Mainnet, except by buying some Bitcoins with money that I really don't have, and I'm also starting to wonder what is the purpose of the Testnet if its behaviour doesn't reflect the one of the real net and, even worse, what is the purpose of having a script language with such multiple instructions when you can actually use just a few of them.
Is someone able to give me more informations about all this?
Thanks in advance. </p>

<transactions><script><bitcoin-core-development>
Non-standard transaction scripts broadcasting
Daniel
# Non-standard transaction scripts broadcasting

(Asked by: username_0 on 2018-12-04)

I'm developing an application on Bitcoin blockchain, and I use output transaction scripts that are not standard according to the classic payment methods.
However, even so, on Tesnet everything works fine but I recently read on Bitcoin site the following:

![enter image description here](https://i.sstatic.net/BWmyw.png)

So, appearently, Tesnet may relax some restrictions on transaction scripts, but it doesn't specify much more. So, now, I have no way of knowing if such output transaction scripts could be accepted on the Mainnet, except by buying some Bitcoins with money that I really don't have, and I'm also starting to wonder what is the purpose of the Testnet if its behaviour doesn't reflect the one of the real net and, even worse, what is the purpose of having a script language with such multiple instructions when you can actually use just a few of them.
Is someone able to give me more informations about all this?
Thanks in advance.

**Tags:** transactions, script, bitcoin-core-development


---

## 2 answers

### Answer by username_1 on 2018-12-04. Score: 9

Standard output scripts are defined by [IsStandard()](https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp#:%7E:text=IsStandard) (which calls [Solver()](https://github.com/bitcoin/bitcoin/blob/master/src/script/standard.cpp#:%7E:text=Solver) to perform the actual script matching). The standard output scripts are as follows:

* P2PKH
* P2PK
* P2SH
* P2WPKH
* P2WSH
* A script beginning with an OP\_RETURN and only pushes at most 80 bytes data to the stack
* Bare multisig up to a 3-of-3 multisig

Any other script will be non-standard and the entire transaction will be rejected as being non-standard.

---

Instead of trying to include a non-standard output script, you can instead use P2SH or P2WSH. Your output script will become the redeem script or witness script which can be anything. P2SH and P2WSH allow you to do exactly the same things as if the script were in an output script.

If you still insist on wanting your non-standard script to be in the output, then for your transaction to be broadcast and mined, you will need to find a miner and give them your transaction through some other means. Non-standard transactions will not be relayed and most nodes will not accept them. You will need to give your transaction to a miner who is accepting non-standard transactions, and it is highly likely that you need to do this out of band, i.e. over some form of communication that is not the P2P network.

> **Comments:**
> **username_0**: Thank you very much for your exhaustive answer. The fact that I can't use P2SH is because this requires the redeem script to be known by the sender (so he can include the hash in the output script) and the receiver. In my setting, instead, the redeem script is known only by the sender.  
> **username_1**: That doesn't really make sense. How does the receiver know he's being paid if he doesn't know what output script to look for?  
> **username_2**: @AndrewChow you are saying just use P2SH instead of any non-standard script... but then the redeem script will be non-standard, right? Or is ANYTHING considered valid in a redeem script?  
> **username_1**: @username_2 Any redeemScript is valid. There are no standardness checks on the input script type.  

---

### Answer by username_3 on 2018-12-04. Score: 1

You can always wrap your non-standard output scripts in p2sh/p2wsh output scripts, which will be recognized for standardness and propagated by nodes on the network.

> **Comments:**
> **username_0**: The fact is that I can't use P2SH, because I need my non-standard script to be placed into an output script. With P2SH I have to place it into an input script.  
> **username_4**: What do you mean saying "I need my non-standard script to be placed into an output script"??? You can not today put your arbitrary script into the transaction outputs. But you can achieve the SAME goals using p2sh/p2wsh - they were designed/implemented for this case!  
> **username_0**: Yeah, I figured as much. However, Testnet allows me to do that.  

---

