Could a transaction hex on testnet theoretically be valid on mainnet?

3

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.

paddy

Posted 2019-04-08T23:35:29.607

Reputation: 75

Answers

3

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.

Andrew Chow

Posted 2019-04-08T23:35:29.607

Reputation: 40 910

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?Nate Eldredge 2019-04-09T00:03:29.403

2I believe that only works for blocks that are non-segwit as the segwit commitment would be different.Andrew Chow 2019-04-09T00:08:24.797

@NateEldredge That's right.Anonymous 2019-04-09T00:27:34.233