From 4d7b7fe828c8d3b5663d0bde958afe44db2c71cb Mon Sep 17 00:00:00 2001 From: Perry Smit Date: Mon, 15 Jun 2020 14:29:01 +0200 Subject: [PATCH] Update 04_2__Interlude_Using_JQ.md signrawtransaction is deprecated, should be signrawtransactionwithwallet --- 04_2__Interlude_Using_JQ.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/04_2__Interlude_Using_JQ.md b/04_2__Interlude_Using_JQ.md index 71bfc78..ff6d3e3 100644 --- a/04_2__Interlude_Using_JQ.md +++ b/04_2__Interlude_Using_JQ.md @@ -21,7 +21,7 @@ _What is JQ?_ The repository explains it best, saying "jq is like sed for JSON d In the previous section, the use of `signrawtransaction` offered an example of not being able to easily capture data into variables due to the use of JSON output: ``` -$ bitcoin-cli signrawtransaction $rawtxhex +$ bitcoin-cli signrawtransactionwithwallet $rawtxhex { "hex": "0200000001735dfa1584b930a78ad2c1d6db72dd2a80ae5e5d552ad97e19f1d50d41fdd6d8000000006a47304402202210ce4b2a037da02622c380278cd79fec4e0e016e66f3eb894a2dcbb9ee998f02202cac167e6abdbbf08af139fb7c6b86e9d2e58e5516cd566ae2d54953ead9923b012102111bb978a3c93a00038ae344a1a017d7fee8a9be9d0558b5793ce6f440704a96ffffffff01b0e78604000000001976a914e7c1345fc8f87c68170b3aa798a956c2fe6a9eff88ac00000000", "complete": true @@ -33,18 +33,18 @@ To use JQ, run `jq` at the backend of a pipe, and always use the standard invoca To capture a specific value from a JSON object, you just list the key after the `.`: ``` -$ bitcoin-cli signrawtransaction $rawtxhex | jq -r '.hex' +$ bitcoin-cli signrawtransactionwithwallet $rawtxhex | jq -r '.hex' 0200000001735dfa1584b930a78ad2c1d6db72dd2a80ae5e5d552ad97e19f1d50d41fdd6d8000000006a47304402202210ce4b2a037da02622c380278cd79fec4e0e016e66f3eb894a2dcbb9ee998f02202cac167e6abdbbf08af139fb7c6b86e9d2e58e5516cd566ae2d54953ead9923b012102111bb978a3c93a00038ae344a1a017d7fee8a9be9d0558b5793ce6f440704a96ffffffff01b0e78604000000001976a914e7c1345fc8f87c68170b3aa798a956c2fe6a9eff88ac00000000 ``` With that tool in hand, you can capture information from JSON objects to command-line variables: ``` -$ signedtx=$(bitcoin-cli signrawtransaction $rawtxhex | jq -r '.hex') +$ signedtx=$(bitcoin-cli signrawtransactionwithwallet $rawtxhex | jq -r '.hex') $ echo $signedtx 0200000001735dfa1584b930a78ad2c1d6db72dd2a80ae5e5d552ad97e19f1d50d41fdd6d8000000006a47304402202210ce4b2a037da02622c380278cd79fec4e0e016e66f3eb894a2dcbb9ee998f02202cac167e6abdbbf08af139fb7c6b86e9d2e58e5516cd566ae2d54953ead9923b012102111bb978a3c93a00038ae344a1a017d7fee8a9be9d0558b5793ce6f440704a96ffffffff01b0e78604000000001976a914e7c1345fc8f87c68170b3aa798a956c2fe6a9eff88ac00000000 ``` You can then use those variables easily and without error: ``` -$ bitcoin-cli sendrawtransaction $signedtx +$ bitcoin-cli sendrawtransactionwithwallet $signedtx 3f9ccb6e16663e66dc119de1866610cc4f7a83079bfec2abf0598ed3adf10a78 ``` ## Use JQ to Access Single JSON Object Values in an Array by Key