Skip to content

Commit 51c232f

Browse files
committed
Change parameters in create address section.
1 parent 1e5aef6 commit 51c232f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

04_4__Interlude_Using_Curl.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,19 @@ This is almost exactly the same output that you receive when you type `bitcoin-c
218218

219219
After you know where your funds are, the next step in crafting a transaction is to get a change address. By now you've probably got the hang of this, and you know that for simple RPC commands, all you need to do is adjust the `method` is the `curl` command:
220220
```
221-
$ curl --user StandUp:8eaf562eaf45c33c3328bc66008f2dd1 --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": ["legacy"] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/ | jq -r '.'
221+
$ curl --user StandUp:8eaf562eaf45c33c3328bc66008f2dd1 --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": ["", "legacy"] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/ | jq -r '.'
222222
{
223223
"result": "mrSqN37TPs89GcidSZTvXmMzjxoJZ6RKoz",
224224
"error": null,
225225
"id": "curltest"
226226
}
227227
228+
> **WARNING:** The parameters order is important when you are sending RPC commands using curl. For example here, if we had sent `"params": ["legacy"]` instead of `"params": ["", "legacy"]`, we would get a `bech32` address with a label of `"legacy"` instead of a `legacy` address, so pay attention to the order.
229+
228230
```
229231
At this point, we can even revert to our standard practice of saving results to variables with additional help from `jq`:
230232
```
231-
$ changeaddress=$(curl --user StandUp:8eaf562eaf45c33c3328bc66008f2dd1 --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": ["legacy"] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/ | jq -r '.result')
233+
$ changeaddress=$(curl --user StandUp:8eaf562eaf45c33c3328bc66008f2dd1 --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getrawchangeaddress", "params": ["", "legacy"] }' -H 'content-type: text/plain;' http://127.0.0.1:18332/ | jq -r '.result')
232234
$ echo $changeaddress
233235
mqdfnjgWr2r3sCCeuTDfe8fJ1CnycF2e6R
234236
```

0 commit comments

Comments
 (0)