Skip to content

Commit 3a47c73

Browse files
authored
Clarify nigiri commands in the payjoin-cli README (payjoin#691)
A couple of clarifications with the commands could be helpful for easier copying and pasting. Without the `-rpcwallet` set, it defaults to the incorrect wallet. Also the parameters were in the wrong order see: <https://developer.bitcoin.org/reference/rpc/generatetoaddress.html>
2 parents a65928e + ccc985f commit 3a47c73

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

payjoin-cli/README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,48 @@ Payjoin `v2` allows for transactions to be completed asynchronously. Thus the se
2424
To get started, install `nigiri` and [`docker`](https://www.docker.com/get-started). Payjoin requires the sender and receiver each to have spendable [UTXOs](https://www.unchained.com/blog/what-is-a-utxo-bitcoin), so we'll create two wallets and fund each.
2525

2626
```sh
27-
# Download nigiri and check install succeeded
27+
# Download nigiri and check that installation has succeeded.
2828
curl https://getnigiri.vulpem.com | bash
2929
nigiri --version
3030

31-
# Create two regtest wallets
32-
nigiri rpc createwallet "sender"
33-
nigiri rpc createwallet "receiver"
31+
# Create two regtest wallets.
32+
nigiri rpc createwallet sender
33+
nigiri rpc createwallet receiver
3434

3535
# We need 101 blocks for the UTXOs to be spendable due to the coinbase maturity requirement.
36-
nigiri rpc generatetoaddress $(nigiri rpc getnewaddress "sender") 101
37-
nigiri rpc generatetoaddress $(nigiri rpc getnewaddress "receiver") 101
36+
nigiri rpc generatetoaddress 101 $(nigiri rpc -rpcwallet=sender getnewaddress)
37+
nigiri rpc generatetoaddress 101 $(nigiri rpc -rpcwallet=receiver getnewaddress)
38+
39+
# Check the balances before doing a Payjoin transaction.
40+
nigiri rpc -rpcwallet=sender getbalance
41+
nigiri rpc -rpcwallet=receiver getbalance
3842
```
3943

40-
Great! Our wallets are setup, now let's do an async payjoin.
44+
Great! Our wallets are setup. Now let's do an async payjoin.
4145

4246
### Install `payjoin-cli`
4347

48+
The following command will install the most recent version of payjoin-cli. See the crates.io page [here](https://crates.io/crates/payjoin-cli).
49+
4450
```sh
45-
cargo install payjoin-cli --version $VERSION
51+
cargo install payjoin-cli
4652
```
4753

48-
where `$VERSION` is the [latest version](https://crates.io/crates/payjoin-cli).
54+
Optionally, you can install a specific version by setting the `--version` flag in the command.
4955

5056
Next, create a directory for the sender & receiver and create a file called `config.toml` for each. This file provides the information required for `payjoin-cli` to connect to your node and, for `v2`, to know which Payjoin Directory and OHTTP Relay to use.
5157

58+
When running commands, `payjoin-cli` will read the `config.toml` file which is in the current working directory.
59+
5260
```sh
5361
mkdir sender receiver
5462
touch sender/config.toml receiver/config.toml
5563
```
5664

5765
Edit the `config.toml` files.
5866

67+
#### `sender/config.toml`
5968
```toml
60-
# sender/config.toml
61-
6269
# Nigiri uses the following RPC credentials
6370
[bitcoind]
6471
rpcuser = "admin1"
@@ -71,9 +78,8 @@ pj_directory = "https://payjo.in"
7178
ohttp_relay = "https://pj.bobspacebkk.com"
7279
```
7380

81+
#### `receiver/config.toml`
7482
```toml
75-
# receiver/config.toml
76-
7783
# Nigiri uses the following RPC credentials
7884
[bitcoind]
7985
rpcuser = "admin1"

0 commit comments

Comments
 (0)