mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
Change parameters in create address section.
This commit is contained in:
parent
1e5aef6014
commit
51c232f841
@ -218,17 +218,19 @@ This is almost exactly the same output that you receive when you type `bitcoin-c
|
|||||||
|
|
||||||
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:
|
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:
|
||||||
```
|
```
|
||||||
$ 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 '.'
|
$ 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": "mrSqN37TPs89GcidSZTvXmMzjxoJZ6RKoz",
|
"result": "mrSqN37TPs89GcidSZTvXmMzjxoJZ6RKoz",
|
||||||
"error": null,
|
"error": null,
|
||||||
"id": "curltest"
|
"id": "curltest"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> **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.
|
||||||
|
|
||||||
```
|
```
|
||||||
At this point, we can even revert to our standard practice of saving results to variables with additional help from `jq`:
|
At this point, we can even revert to our standard practice of saving results to variables with additional help from `jq`:
|
||||||
```
|
```
|
||||||
$ 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')
|
$ 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')
|
||||||
$ echo $changeaddress
|
$ echo $changeaddress
|
||||||
mqdfnjgWr2r3sCCeuTDfe8fJ1CnycF2e6R
|
mqdfnjgWr2r3sCCeuTDfe8fJ1CnycF2e6R
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user