<p>It's not particularly required and may be considered redundant as that information is generally implied from the transaction outpoints referenced in the input. However, this form of transaction serialization allows wallet softwares to explicitly commit to the fees involved in the transaction. This is particularly useful if say you are using a hardware wallet where you have your private keys and at the same time you use a watch-only online wallet. Since the online wallets knows all the UTXOs that your private keys control, it can effectively create a transaction consuming some inputs. </p>

<p>To know how much fee you are committing to the transaction, the hardware wallet would have to query the input referenced, grab all the outputs of that transactions (which may be very large) and then only it will know what the fee is for this particular transaction. Otherwise, if it doesn't, the software that created the transaction could lie, and in fact convert a giant portion of the bitcoins consumed into fee without you knowing it. However, keeping the input amount as part of the message that signature commits to means the hardware wallet software knows the amount explicitly and hence can provide the user with an accurate measurement of the fees.  </p>

CC BY-SA 4.0
2019-05-31T09:57:36.167Z
2019-05-31T09:57:36.167Z
Ugam Kamat
<p>When spending a P2PKH output, the "data" we hash only includes the output script from previous transaction but when spending a P2WPKH (the new serialization) we also include the amount field from previous transaction (<a href="https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#specification" rel="nofollow noreferrer">#6 in BIP-143 specification</a>). Why?</p>

<transactions><segregated-witness><signature>
What is the rationale for inclusion of previous amount in SegWit signing process?
Coding Enthusiast
# What is the rationale for inclusion of previous amount in SegWit signing process?

(Asked by: username_0 on 2019-05-31)

When spending a P2PKH output, the "data" we hash only includes the output script from previous transaction but when spending a P2WPKH (the new serialization) we also include the amount field from previous transaction ([#6 in BIP-143 specification](https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#specification)). Why?

**Tags:** transactions, segregated-witness, signature


---

## 1 answers

### Answer by username_1 on 2019-05-31. Score: 3 | Accepted answer

It's not particularly required and may be considered redundant as that information is generally implied from the transaction outpoints referenced in the input. However, this form of transaction serialization allows wallet softwares to explicitly commit to the fees involved in the transaction. This is particularly useful if say you are using a hardware wallet where you have your private keys and at the same time you use a watch-only online wallet. Since the online wallets knows all the UTXOs that your private keys control, it can effectively create a transaction consuming some inputs.

To know how much fee you are committing to the transaction, the hardware wallet would have to query the input referenced, grab all the outputs of that transactions (which may be very large) and then only it will know what the fee is for this particular transaction. Otherwise, if it doesn't, the software that created the transaction could lie, and in fact convert a giant portion of the bitcoins consumed into fee without you knowing it. However, keeping the input amount as part of the message that signature commits to means the hardware wallet software knows the amount explicitly and hence can provide the user with an accurate measurement of the fees.


---

