<p>Yes, it is theoretically possible for a transaction to be valid on both mainnet and testnet. Transactions don't contain any network specific information other than the previous txid and output index.</p>

CC BY-SA 4.0
2019-04-09T00:03:29.403Z
For instance, if someone were to mine blocks at the same height (because of BIP-34) on both testnet and mainnet, they could arrange for the coinbase transactions to be identical.  In that case, a transaction spending that coinbase could be replayed from one network to the other, and likewise any transaction spending *its* outputs, and so on.  Unless I am missing something?
Nate Eldredge
CC BY-SA 4.0
2019-04-09T00:08:24.797Z
I believe that only works for blocks that are non-segwit as the segwit commitment would be different.
Ava Chow
CC BY-SA 4.0
2019-04-09T00:27:34.233Z
@NateEldredge That's right.
Claris
CC BY-SA 4.0
2019-04-08T23:42:09.240Z
2019-04-08T23:42:09.240Z
Ava Chow
<p>For all practical intents and purposes it seems a testnet tx hex could never be valid on mainnet because of the prev tx hex present for all inputs used in the tx. However, let's say that by some miracle you had identical unspents on both testnet and mainnet. If you signed the tx and broadcast it to testnet, could you then broadcast the same tx hex to the mainnet? In other words, is there anything network specific in the tx hex? I thought there was some network magic that might go into either the signature hash or the script hash but it does not seem to be the case as far as I can tell.</p>

<testnet><raw-transaction>
Could a transaction hex on testnet theoretically be valid on mainnet?
paddy
# Could a transaction hex on testnet theoretically be valid on mainnet?

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

For all practical intents and purposes it seems a testnet tx hex could never be valid on mainnet because of the prev tx hex present for all inputs used in the tx. However, let's say that by some miracle you had identical unspents on both testnet and mainnet. If you signed the tx and broadcast it to testnet, could you then broadcast the same tx hex to the mainnet? In other words, is there anything network specific in the tx hex? I thought there was some network magic that might go into either the signature hash or the script hash but it does not seem to be the case as far as I can tell.

**Tags:** testnet, raw-transaction


---

## 1 answers

### Answer by username_1 on 2019-04-08. Score: 3 | Accepted answer

Yes, it is theoretically possible for a transaction to be valid on both mainnet and testnet. Transactions don't contain any network specific information other than the previous txid and output index.

> **Comments:**
> **username_2**: For instance, if someone were to mine blocks at the same height (because of BIP-34) on both testnet and mainnet, they could arrange for the coinbase transactions to be identical.  In that case, a transaction spending that coinbase could be replayed from one network to the other, and likewise any transaction spending *its* outputs, and so on.  Unless I am missing something?  
> **username_1**: I believe that only works for blocks that are non-segwit as the segwit commitment would be different.  
> **username_3**: @NateEldredge That's right.  

---

