mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 07:56:31 +00:00
Update 04_2__Interlude_Using_JQ.md
Fixed minor typos
This commit is contained in:
parent
034dc365cf
commit
8602b7b71d
@ -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:
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user