Skip to content

Commit 0c2e966

Browse files
authored
Merge pull request #76 from heavysalt/always-listening-wallet-guide
Add instructions for creating a wallet service
2 parents bb84292 + d6c13c5 commit 0c2e966

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

docs/getting-started/quickstart/receive.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ grin-wallet listen
3232

3333
Done! This sets up your wallet to listen for incoming connections through Tor. Just let the sender know that your wallet is ready. You can type `grin-wallet info` to check your wallet balance.
3434

35+
You can make sure your wallet is online by [checking if it's reachable](../../wiki/extra-documents/always-listening-wallet.md#verifying-your-wallet-is-online-and-reachable).
36+
37+
If your wallet should always be online, see [Setting up an always listening wallet](../../wiki/extra-documents/always-listening-wallet.md).
38+
3539
## Slatepack
3640

3741
Slatepacks are encoded text messages used to transfer the data required to form a transaction, and are an alternative to a hands-off method such as Tor. The messages are easily copy-pasted and can be transferred in any communication channel imaginable: email, forum, social media, chat, letter, carrier pigeon etc.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Setting up an always listening wallet
2+
3+
For some use cases, like mining Grin, it's important to have a wallet that is always listening for incoming transactions. For this use case and others like it, configuring `grin-wallet` as a service is recommended and easy to do.
4+
5+
## Set up grin-wallet as a service
6+
7+
Create a service file for `grin-wallet`:
8+
9+
```bash
10+
sudo nano /etc/systemd/system/grin-wallet.service
11+
```
12+
13+
Paste the following content into the file. The following configuration assumes a 'grin' user will be running the process with the wallet configuration living in `/var/lib/grin`. Wallet configuration by default is saved to the user's home directory in `.grin`. If you installed the snap package, your wallet command will be `grin.wallet` instead.
14+
15+
```
16+
[Unit]
17+
Description=grin wallet
18+
After=network.target
19+
20+
[Service]
21+
WorkingDirectory=/var/lib/grin
22+
User=grin
23+
Group=grin
24+
PrivateDevices=yes
25+
Type=simple
26+
ExecReload=/bin/kill -HUP $MAINPID
27+
KillMode=mixed
28+
KillSignal=SIGTERM
29+
TimeoutStopSec=60
30+
ExecStart=/usr/local/bin/grin-wallet listen
31+
Restart=on-failure
32+
RestartSec=30
33+
34+
[Install]
35+
WantedBy=multi-user.target
36+
Alias=grin.service
37+
```
38+
39+
Tell systemd to reload (you need to do that every time you edit this file):
40+
41+
```bash
42+
systemctl daemon-reload
43+
```
44+
45+
Now try to start the wallet service:
46+
47+
```bash
48+
sudo systemctl start grin-wallet
49+
```
50+
51+
And check to see if it's running:
52+
53+
```bash
54+
ps aux | grep grin-wallet
55+
```
56+
57+
That should give you two lines of output like this:
58+
59+
```bash
60+
grin 269149 0.0 0.0 971240 10804 ? Sl Aug25 0:00 /usr/local/bin/grin-wallet listen
61+
ubuntu 336964 0.0 0.0 7004 2168 pts/0 S+ 22:02 0:00 grep --color=auto grin-wallet
62+
```
63+
64+
## Handling a wallet password
65+
66+
If your wallet is configured with a password, the `ExecStart` line in `grin-wallet.service` should probably look something like this...
67+
68+
```bash
69+
ExecStart=/bin/sh -c 'cat wallet-password.txt | /usr/local/bin/grin-wallet listen'
70+
```
71+
72+
Drop you wallet's password in `wallet-password.txt`. Make sure this file lives in the configured `WorkingDirectory` and that correct read permissions are set. The contents of this file will be fed into the `grin-wallet` command.
73+
74+
## Verifying your wallet is online and reachable
75+
76+
Run the following command to get your wallet's address:
77+
78+
```bash
79+
grin-wallet info
80+
```
81+
82+
Grab the address that is displayed and search for it on [grinchck](https://grinchck.uber.space/)
83+
84+
[More information on grinchck](https://forum.grin.mw/t/is-this-grin-wallet-url-reachable/7349)

0 commit comments

Comments
 (0)