Use UTXOs before transaction is signed/broadcasted

0

Suppose I have an address with a single UTXO. I want to create 100 transactions and sign/broadcast them all at once. Could I do the following:

  1. Create a transaction by hand (where change funds are sent to the sender address)
  2. Calculate the transaction ID
  3. Use the transaction ID and change UTXO output index to create the second transaction
  4. Go to step 2

Until I create 100 transactions? I suppose my question boils down to: Is it possible to calculate the TXID of a raw transaction before it is signed or broadcasted?

Thanks!

apr

Posted 2019-02-27T00:59:16.947

Reputation: 3

Answers

1

It depends.

If your UTXO is a segwit UTXO, then yes. You will have everything that you need to know to calculate the txid before you signed the transaction.

If your UTXO is not a segwit UTXO, then no, you cannot know the txid until you sign the transaction. This is because with spending non-segwit UTXOs, the signature is part of data that is hashed to become the transaction id. So you cannot calculate the transaction id until you know what the signature is.


Signing and broadcasting a transaction is not a single step that happens simultaneously. You can sign a transaction before you broadcast it. So you can make your 100 transactions and sign them as you make them. Once all are made, you can then broadcast the transactions.

Furthermore, if you are sending 100 transactions with one output paying someone, and the other being change back to yourself, why don't just create one transaction with 100 outputs? This is far more efficient and will guarantee that all 100 receivers receive their money at exactly the same time. This will also save you on transaction fees.

Andrew Chow

Posted 2019-02-27T00:59:16.947

Reputation: 40 910

Thanks for the reply. I want to generate transactions online and sign offline, so I wanted to group the operations together. Also, I am using Bitcoin transactions indirectly to transfer OMNI tokens, which doesn't have the concept of multiple recipients :(apr 2019-02-27T01:41:18.300