Update 04_2__Interlude_Using_JQ.md

Fixed minor typos
This commit is contained in:
wintercooled 2018-03-22 14:22:19 +00:00 committed by GitHub
parent 034dc365cf
commit 8602b7b71d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -362,12 +362,12 @@ Whew!
**Usage Example:** _Calculate the fee for a transaction._ **Usage Example:** _Calculate the fee for a transaction._
To figure out the complete transaction fee at this point just requires one more bit of math: determining out how much money is going through the .vout. That's a simple use of JQ where you just use `awk` to sum up the `value` of all the `vout` information: To figure out the complete transaction fee at this point just requires one more bit of math: determining how much money is going through the .vout. That's a simple use of JQ where you just use `awk` to sum up the `value` of all the `vout` information:
``` ```
$ bitcoin-cli decoderawtransaction $rawtxhex | jq -r '.vout [] | .value' | awk '{s+=$1} END {print s}' $ bitcoin-cli decoderawtransaction $rawtxhex | jq -r '.vout [] | .value' | awk '{s+=$1} END {print s}'
1.045 1.045
``` ```
To complete the transaction fee calculation,, you subtract the .vout .amount (1.045) from the .vin .amount (1.3). To complete the transaction fee calculation, you subtract the .vout .amount (1.045) from the .vin .amount (1.3).
Putting it all together creates a complete calculator in just five lines of script: Putting it all together creates a complete calculator in just five lines of script:
``` ```