Are you sure about this?
Maybe I should show an example, how to move some mainnet transaction into regtest.
First, pick some mainnet block, that can be migrated, for example 227836, and get its coinbase transaction:
https://mempool.space/tx/0f3601a5da2f516fa9d3f80c9bf6e530f1afb0c90da73e8f8ad0630c5483afe5Then, generate at least N-1 blocks, that has to be present before that. Because of network rules, I usually generate 1000 blocks at a time:
generatetodescriptor 1000 "raw(51)#8lvh9jxk"
But it can be done faster, if you have custom software, because you can generate "the maximum amount of blocks" if you keep putting the earliest possible time in your blocks (the difficulty in regtest is left unchanged, so you can do that).
Also, because all coins are sent to OP_TRUE, it will be possible to reproduce my example, no matter, what block headers you will construct.
Of course, if you generate 1000 blocks at a time, starting from the current timestamp, you may encounter this error:
CreateNewBlock: TestBlockValidity failed: time-too-new, block timestamp too far in the future (code -1)
To avoid that, you can change your clock, or use custom software, to put custom timestamps in your headers. Coinbase hashes will stay identical, even if you tweak your timestamps.
Sooner or later, you should get there:
And then, just check the last block you produced, and submit a new block on top of that, with the coinbase transaction from the mainnet.
submitblock 00000020ec6e213d3dc91be62e1d9c938f50ff894509c6bcdfe300ac17ac5012c76cf560e074c0ffa900ae2bf25debe7ee43d201f438b66ce6d7c89fa59ee4338dc48b63ac204f51ffff7f20000000000201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703fc7903062f503253482f04ac204f510858029a11000003550d3363646164312f736c7573682f0000000001207e6295000000001976a914e285a29e0704004d4e95dbb7c57a98563d9fb2eb88ac0000000002000000010101811a9245cfae75af3f2fb5ebebb35ee25dfee53b74afac6a45be242bbab40000000000fdffffff01e073a39400000000015100000000
getblockcount
227836
getblockhash 227836
210573a3315d3ba36edbf728e15f748a1328a9ad40560489c70b6d311517532b
getblock 210573a3315d3ba36edbf728e15f748a1328a9ad40560489c70b6d311517532b
{
"hash": "210573a3315d3ba36edbf728e15f748a1328a9ad40560489c70b6d311517532b",
"confirmations": 1,
"height": 227836,
"version": 536870912,
"versionHex": "20000000",
"merkleroot": "638bc48d33e49ea59fc8d7e66cb638f401d243eee7eb5df22bae00a9ffc074e0",
"time": 1364140204,
"mediantime": 1325892379,
"nonce": 0,
"bits": "207fffff",
"difficulty": 4.656542373906925e-10,
"chainwork": "000000000000000000000000000000000000000000000000000000000006f3fa",
"nTx": 2,
"previousblockhash": "60f56cc71250ac17ac00e3dfbcc6094589ff508f939c1d2ee61bc93d3d216eec",
"strippedsize": 266,
"size": 266,
"weight": 1064,
"tx": [
"0f3601a5da2f516fa9d3f80c9bf6e530f1afb0c90da73e8f8ad0630c5483afe5",
"ced3a8562bd17e22598beee00724b3a74a3f1670537f6647943d3a6a1f1e49e1"
]
}
decoderawtransaction 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703fc7903062f503253482f04ac204f510858029a11000003550d3363646164312f736c7573682f0000000001207e6295000000001976a914e285a29e0704004d4e95dbb7c57a98563d9fb2eb88ac00000000
{
"txid": "0f3601a5da2f516fa9d3f80c9bf6e530f1afb0c90da73e8f8ad0630c5483afe5",
"hash": "0f3601a5da2f516fa9d3f80c9bf6e530f1afb0c90da73e8f8ad0630c5483afe5",
"version": 1,
"size": 124,
"vsize": 124,
"weight": 496,
"locktime": 0,
"vin": [
{
"coinbase": "03fc7903062f503253482f04ac204f510858029a11000003550d3363646164312f736c7573682f",
"sequence": 0
}
],
"vout": [
{
"value": 25.06260000,
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 e285a29e0704004d4e95dbb7c57a98563d9fb2eb OP_EQUALVERIFY OP_CHECKSIG",
"desc": "addr(n2Ah6YcQjuDCkLJ5YKuRKDLMEsLSPhKwWQ)#2l2jtden",
"hex": "76a914e285a29e0704004d4e95dbb7c57a98563d9fb2eb88ac",
"address": "n2Ah6YcQjuDCkLJ5YKuRKDLMEsLSPhKwWQ",
"type": "pubkeyhash"
}
}
]
}
decoderawtransaction 02000000010101811a9245cfae75af3f2fb5ebebb35ee25dfee53b74afac6a45be242bbab40000000000fdffffff01e073a39400000000015100000000
{
"txid": "ced3a8562bd17e22598beee00724b3a74a3f1670537f6647943d3a6a1f1e49e1",
"hash": "ced3a8562bd17e22598beee00724b3a74a3f1670537f6647943d3a6a1f1e49e1",
"version": 2,
"size": 61,
"vsize": 61,
"weight": 244,
"locktime": 0,
"vin": [
{
"txid": "b4ba2b24be456aacaf743be5fe5de25eb3ebebb52f3faf75aecf45921a810101",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967293
}
],
"vout": [
{
"value": 24.93740000,
"n": 0,
"scriptPubKey": {
"asm": "1",
"desc": "raw(51)#8lvh9jxk",
"hex": "51",
"type": "nonstandard"
}
}
]
}
See? It is valid, and instead of 1MejoVXRvsmwyDpTpkw3VJ82NsjjT8SyEw mainnet address, you have n2Ah6YcQjuDCkLJ5YKuRKDLMEsLSPhKwWQ regtest address. And because a lot of altcoins just copy-pasted Bitcoin code, you can migrate their coinbase transactions as well.