Yeah, I did that and was able to successfully move the coins. It generated the same txid.
No, you generate a new transaction with the same keys, inputs and outputs, but not the same txid, let me explain.
When you take the secret keys from one wallet to another and make a transaction, even you use the same inputs, same amounts, and same outputs, the Transaction ID (txid) will be different.
If you generate a new transaction with the same input/output you will get the same txid. Else blockchain would not work, so Bitcoin wouldn't exist As Linus Torvalds says... talk is cheap, show me the code.
[bitcoin@talk bin]$ a=$(./clamd createrawtransaction '[{"txid":"263f3b50037f2a596a640939ac6f47a688e63fe211a5d06b28ce35180ad97850","vout":1}]' '{"xCPd81UNFhHvhNjNQWyWTJKMJMv1JDijnY":12.47903878}')
[bitcoin@talk bin]$ echo $a
02000000ac6f7663015078d90a1835ce286bd0a511e23fe688a6476fac3909646a592a7f03503b3f260100000000ffffffff018680614a000000001976a9142cd1efeb26e5602d121ef98f5630089dd142e2fb88ac000000002a45787072657373696f6e206f6620506f6c69746963616c2046726565646f6d3a204175746f6372616379
[bitcoin@talk bin]$ ./clamd decoderawtransaction $a
{
"txid" : "015505cb52c24fa83e174dd496e8682323164ebeb7ff5613f484ef00b44fd29f",
"version" : 2,
"time" : 1668706220,
"locktime" : 0,
"clam-speech" : "Expression of Political Freedom: Autocracy",
"vin" : [
{
"txid" : "263f3b50037f2a596a640939ac6f47a688e63fe211a5d06b28ce35180ad97850",
"vout" : 1,
"scriptSig" : {
"asm" : "",
"hex" : ""
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 12.47903878,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 2cd1efeb26e5602d121ef98f5630089dd142e2fb OP_EQUALVERIFY OP_CHECKSIG",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"xCPd81UNFhHvhNjNQWyWTJKMJMv1JDijnY"
]
}
}
]
}
[bitcoin@talk bin]$ a=$(./clamd createrawtransaction '[{"txid":"263f3b50037f2a596a640939ac6f47a688e63fe211a5d06b28ce35180ad97850","vout":1}]' '{"xCPd81UNFhHvhNjNQWyWTJKMJMv1JDijnY":12.47903878}')
[bitcoin@talk bin]$ ./clamd decoderawtransaction $a
{
"txid" : "e9d9b7086dc7ca23ba1d7bd37ff3fb7ced0416adb170d69eacc659f66ebf578b",
"version" : 2,
"time" : 1668706346,
"locktime" : 0,
"clam-speech" : "Expression of Political Freedom: Religious socialism",
"vin" : [
{
"txid" : "263f3b50037f2a596a640939ac6f47a688e63fe211a5d06b28ce35180ad97850",
"vout" : 1,
"scriptSig" : {
"asm" : "",
"hex" : ""
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 12.47903878,
"n" : 0,
"scriptPubKey" : {
"asm" : "OP_DUP OP_HASH160 2cd1efeb26e5602d121ef98f5630089dd142e2fb OP_EQUALVERIFY OP_CHECKSIG",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"xCPd81UNFhHvhNjNQWyWTJKMJMv1JDijnY"
]
}
}
]
}
I was wrong and the TxID comes from the create raw transaction step, and not from the sign raw transaction step.
As you can see in the code i created a transaction with the same inputs, outputs, and amounts and the first one gets the TxID:
015505cb52c24fa83e174dd496e8682323164ebeb7ff5613f484ef00b44fd29f
While the second one:
e9d9b7086dc7ca23ba1d7bd37ff3fb7ced0416adb170d69eacc659f66ebf578b
This is why it's important to know how to build your transactions by hand and understand how the transactions works.