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.
1 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.
-
5For 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? Apr 9, 2019 at 0:03
-
2I believe that only works for blocks that are non-segwit as the segwit commitment would be different.– Andrew Chow ♦Apr 9, 2019 at 0:08
-