I have a protocol that creates a raw signed transaction that is then broadcast to the network. The transaction aims to send X BTC to a single address Z. The transaction is created with the help of bitcoin core.
In the past I've seen a few instances where people got themselves in trouble by creating unexpected transactions, for example by paying 90% of the UTXO's value as a mining fee or the like.
Therefore I was wondering if someone could advise on procedures/tips for the following
Given a raw transaction T sending X BTC to address Z, how to validate the transaction accomplishes this gracefully?
The idea is that before the broadcast one issues an additional decoderawtransaction and checks that everything is as intended. I would like to hear tips on what one should check for at this point.
I understand the question itself is a bit vague but I'd like to hear any kind of feedback on what to look for in the output of decoderawtransaction that might be telling something is either not right, or validate that
- The transaction is sending X BTC to Z,
- What the exact expenditure (X+fees) is,
- That the change is sent to the right (i.e under the wallet's control) address.