Works/monero-cli-wallet-training-...

283 lines
15 KiB
Markdown

# Monero CLI Wallet Training With StageNet
## Intro
The main reason I put this together was because I have not found a good tut that would do all the following without a ton of fluff
1. Walk you through installing and setting up the cli wallet
3. Get you a wallet set up on stagenet so you can learn and play
That being said there are other very good tuts out there that are way more comprehensive such as what can be found on [XMRGuide](https://xmrguide.org/)<br>
but for now this is supposed to be a quick and easy setup to let you just start playing and throwing XMR around.<br><br>
UPDATE: Due to my Stagenet Tor Nodes being super flakey I have updated this to not use Tor, Again the whole point of this tut is to give you a place to practice the CLI without losing funds. There are plenty of other tuts for how to use Tor and Onion nodes so after you learn how to use the CLI with this you can moveon to those.
### Disclaimers
I am going to skip over some security and privacy best practices to make it as simple and easy to follow for just learning how to use the cli wallet.<br>
When you go make a mainnet wallet I suggest you go check out more tuts and make sure you are ready based on your risk model<br>
This tut will also have you use a remote stagenet node so you don't have to sync a full node yourself locally,<br>
again when making your official mainnet wallet, hosting your own node is something you will want to do.<br>
You do not need to use Docker if you have a Debian/Ubuntu host you want to play on. Docker is just so you can follow along quickly. There are tons of ways to skin a cat. If you are advanced follow along however you like, if you are new to all of this you can do the docker method, up to you.
### Why the CLI Wallet
Cuz its cool... But also becuase thats what this tut is for, we will have others for other wallets in the future.
## Setup
In order to try to accommodate all who are reading this I will be using docker, mostly because this allows me to ensure you are able to get an environment that I know will work with this tut and remove frustrations of trying to adjust to other platforms.<br>
Once you are comfortable with your docker wallet you should be able to migrate anywhere and try more advanced tuts.
### Install Docker
NOTE: Again you do not have to use docker if you can follow along on your own linux host<br>
I am not going to guide you on this specific part due to how many options there are, do some searching and find a guide to install it on your host.
### Stand up Wallet Container
Once you have docker up and running we will need to make a bare Ubuntu container to build our wallet in.<br>
The next command will pull down the ubuntu 20.04 and run it clean for you
```
docker run -it -d --name StagenetWallet --hostname wallet ubuntu:20.04 /bin/bash
```
Once it is all done you should be able to drop right into your new container with the following command
```
docker exec -it StagenetWallet /bin/bash
```
You should get a prompt such as this
```
root@wallet:/#
```
If you do you are good to move on. Everything else we do from here on will be in our new container
## Installing the Wallet
First We need to grab the offical cli wallet using wget <br>
You will need to install wget first `apt install wget`
```bash
wget https://downloads.getmonero.org/cli/monero-linux-x64-v0.17.3.2.tar.bz2
```
This is the current version at the time of writing this doc, if you want to check for the latest go to [Downloads](https://www.getmonero.org/downloads/#cli)<br>
Now there is one thing I will not gloss over and that is getting in the habit of checking your hash sums.<br>
Click that Download link above and check the hash table to make sure your output for the next command matches like it is does below<br>
Use the below command to check the hash locally after downloading
```bash
sha256sum monero-linux-x64-v0.17.3.2.tar.bz2
```
Then Verify against the site<br>
For Example <br>
[![sha256sum.png](https://docs.hackliberty.org/uploads/images/gallery/2022-05/scaled-1680-/EIHCzz2wh1sT1Ly3-sha256sum.png)](https://docs.hackliberty.org/uploads/images/gallery/2022-05/EIHCzz2wh1sT1Ly3-sha256sum.png)
```
root@wallet:/# sha256sum monero-linux-x64-v0.17.3.2.tar.bz2
1e54acd749265d9439d3733441c645d9b058316283c8f21cca2a333c1238cd16 monero-linux-x64-v0.17.3.2.tar.bz2
```
With that out of the way lets extract out the files and move them into opt
```
tar -xvf monero-linux-x64-v0.17.3.2.tar.bz2 && \
mkdir /opt/monero && \
mv monero-x86_64-linux-gnu-v0.17.3.2/* /opt/monero/ && \
cd /opt/monero
```
Now we can build out first Stagenet Wallet to start and play<br>
## Standing Up your Stagenet Wallet
Run the next block of code to create a stagenet.conf file we will be using<br>
NOTICE: This is where users who cant use Tor for any reason need to split off, you need to run the following
```bash
tee stagenet.conf <<EOF
stagenet=1
trusted-daemon=1
daemon-address=node2.sethforprivacy.com:38089
EOF
```
You do not have to set Trusted to 1 if you do not want to<br>
With the config made we can initialize our wallet<br>
```bash
./monero-wallet-cli --config stagenet.conf --generate-new-wallet StageNetWallet
```
- SIDE NOTES: This would be a great time to learn about and play with the `--extra-entropy` option. Using this you can pass a file in to help seed better entropy, try playing with `/dev/random`, `/dev/urandom`, using password managers like KeepassXC to make 256 char long strings over and over, or even stream out physical stats like thermal temps and fan speeds to a text doc. For a quick option you can try this.
```bash
head -c 10000 /dev/urandom > start_entropy.txt
```
```bash
openssl aes-256-cbc -salt -pbkdf2 -in start_entropy.txt -out wallet_entropy.txt
```
When you are asked for a password to encypt the file, use something like KeepassXC to make a massive complex password, you wont need to remember it, its just to jumble up urandom output even more. Then you can add that wallet_entropy.txt file to your wallet generation command like this.
```bash
./monero-wallet-cli --config stagenet.conf --extra-entropy wallet_entropy.txt --generate-new-wallet StageNetWallet
```
Using physical stats is the best option for true random if you want to be safe, there are all sorts of fun ways you can come up with to generate your wallet_entropy.txt file.
You will be asked to provide a password to access your wallet and then you will be asked what Language you want your seed phase to be in<br>
Output should look like this
```
This is the command line monero wallet. It needs to connect to a monero
daemon to work correctly.
WARNING: Do not reuse your Monero keys on another fork, UNLESS this fork has key reuse mitigations built in. Doing so will harm your privacy.
Monero 'Oxygen Orion' (v0.17.3.2-release)
Logging to ./monero-wallet-cli.log
WARNING: You may not have a high enough lockable memory limit, see ulimit -l
Enter a new password for the wallet:
Confirm password:
List of available languages for your wallet's seed:
If your display freezes, exit blind with ^C, then run again with --use-english-language-names
0 : Deutsch
1 : English
2 : Español
3 : Français
4 : Italiano
5 : Nederlands
6 : Português
7 : русский язык
8 : 日本語
9 : 简体中文 (中国)
10 : Esperanto
11 : Lojban
Enter the number corresponding to the language of your choice:
```
After this point you will be shown your wallet main address as well as your seed phrase.<br>
you will then see the sync start to the remote node, it should not take too long.<br>
You will also be asked if you want to do background mining, for now with this tut say NO<br>
Once the sync is complete we are just going to exit first so you know the next command to get back in<br>
so type `exit` and hit enter<br>
Now run this command to get back into your wallet you just made
```
./monero-wallet-cli --config stagenet.conf --wallet-file StageNetWallet
```
You should see the following for the most part
```
This is the command line monero wallet. It needs to connect to a monero
daemon to work correctly.
WARNING: Do not reuse your Monero keys on another fork, UNLESS this fork has key reuse mitigations built in. Doing so will harm your privacy.
Monero 'Oxygen Orion' (v0.17.3.2-release)
Logging to ./monero-wallet-cli.log
WARNING: You may not have a high enough lockable memory limit, see ulimit -l
Wallet password:
Opened wallet: 56TvmWYrS3DVbtg2Y43f12dWfAd4dthnJL3ZqgvRtqBm11ofZzBVYWtXFH7tyx9cHcQWaRxg77uNkTDdCmivVS8j2cZCefe
**********************************************************************
Use the "help" command to see a simplified list of available commands.
Use "help all" to see the list of all available commands.
Use "help <command>" to see a command's documentation.
**********************************************************************
Background mining not enabled. Run "set setup-background-mining 1" to change.
Starting refresh...
Refresh done, blocks received: 4
Untagged accounts:
Account Balance Unlocked balance Label
* 0 56TvmW 0.000000000000 0.000000000000 Primary account
----------------------------------------------------------------------------------
Total 0.000000000000 0.000000000000
Currently selected account: [0] Primary account
Tag: (No tag assigned)
Balance: 0.000000000000, unlocked balance: 0.000000000000
Background refresh thread started
[wallet 56TvmW]:
```
## Starting to play
First things first... CLI wallet is nice in that it will lock your wallet for you after a set amount of time.
```
/ I locked your Monero wallet to protect you \
| while you were away |
\ see "help set" to configure/disable /
--------------------------------------------
\ (__)
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
Locked due to inactivity. The wallet password is required to unlock the console.
Wallet password:
```
Since we will be playing around and this is stagenet lets set this timeout to 10 min so we dont have to keep giving our password
```
set inactivity-lock-timeout 600
```
Lets make a new address so we can get some monero<br>
```
address new from_faucet
```
This will show you a new address starting in 7
```
[wallet 56TvmW]: address new from_faucet
1 74yqbY1khwVD2dJEmhwXXfVi1hEppfTnn1nwQEFXoaLfc7R395xAvWFiNvmXoTgFiJL2B4c9r5sW2QqdVH4nsF93AMWDHju from_faucet
```
Ok now, lets go get some XMR, head on over to a [Stagenet Faucet](https://community.rino.io/faucet/stagenet/) and get some play monero.<br>
On that site put in your address that you just made.<br>
Eventually you will see `out of sync` and you can type
```
[wallet 56TvmW (out of sync)]: refresh
Starting refresh...
Enter password (output received):
```
put in your password and you should see something like the following
```
Height 1100941, txid <d910a2c1941bb2744e5d6cbe049e2b563b96872bc401edc8223f8e9394cd02ed>, 10.000000000000, idx 0/1
Refresh done, blocks received: 3
Untagged accounts:
Account Balance Unlocked balance Label
* 0 56TvmW 10.000000000000 0.000000000000 Primary account
----------------------------------------------------------------------------------
Total 10.000000000000 0.000000000000
Currently selected account: [0] Primary account
Tag: (No tag assigned)
Balance: 10.000000000000, unlocked balance: 0.000000000000 (7 block(s) to unlock)
Background refresh thread started
[wallet 56TvmW]:
```
That should do it, wait for your funds to unlock and use the `help`, `help <command>` and `help all` commands to learn more<br>
There is also a lot of good information on the [Official Docs](https://monerodocs.org/interacting/monero-wallet-cli-reference/)
## Cleaning Up
Again this is not a static solution, I would not run a real wallet this way, this is just a way to learn and play where you can clean up without much effort.<br>
So with that lets give back out Monero to the faucet so others can use it before eradicating this wallet.<br>
Lets do a sweep to send all we have back to the faucet so others can use it
```
[wallet 56TvmW]: sweep_all 73a4nWuvkYoYoksGurDjKZQcZkmaxLaKbbeiKzHnMmqKivrCzq5Q2JtJG1UZNZFqLPbQ3MiXCk2Q5bdwdUNSr7X9QrPubkn
Wallet password:
Transaction 1/1:
Spending from address index 1
Sweeping 10.000000000000 for a total fee of 0.000042870000. Is this okay? (Y/Yes/N/No): Y
Transaction successfully submitted, transaction <f476b684b7abb344cc7e69e3acd3eaf4fab9718a13e27256ba9315e5805ac1bd>
You can check its status by using the `show_transfers` command.
```
```
[wallet 56TvmW]: show_transfers
1100941 in unlocked 2022-05-26 15:39:43 10.000000000000 d910a2c1941bb2744e5d6cbe049e2b563b96872bc401edc8223f8e9394cd02ed 0000000000000000 0.000000000000 74yqbY:10.000000000000 1 -
pending out - 2022-05-26 16:30:46 9.999957130000 f476b684b7abb344cc7e69e3acd3eaf4fab9718a13e27256ba9315e5805ac1bd 0000000000000000 0.000042870000 73a4nWuvkYoYoksGurDjKZQcZkmaxLaKbbeiKzHnMmqKivrCzq5Q2JtJG1UZNZFqLPbQ3MiXCk2Q5bdwdUNSr7X9QrPubkn:9.999957130000 1 -
```
Wait a bit to see if its successful<br>
NOTE: If you are getting failed transfers then being told you are double spending you will need to change nodes, this is a Tor issue I am trying to look into more.
```
[wallet 56TvmW]: show_transfers
1100941 in unlocked 2022-05-26 15:39:43 10.000000000000 d910a2c1941bb2744e5d6cbe049e2b563b96872bc401edc8223f8e9394cd02ed 0000000000000000 0.000000000000 74yqbY:10.000000000000 1 -
1100971 out - 2022-05-26 16:32:54 9.999957130000 f476b684b7abb344cc7e69e3acd3eaf4fab9718a13e27256ba9315e5805ac1bd 0000000000000000 0.000042870000 73a4nWuvkYoYoksGurDjKZQcZkmaxLaKbbeiKzHnMmqKivrCzq5Q2JtJG1UZNZFqLPbQ3MiXCk2Q5bdwdUNSr7X9QrPubkn:9.999957130000 1 -
[wallet 56TvmW]:
```
Once you see its been sent out you can start all the clean up. Go ahead and type `exit` and hit enter <br>
exit out of the container with `exit` again
Now we can stop and nuke the container
```
docker stop StagenetWallet
```
Then we can delete it
```
docker rm StagenetWallet
```
And that should wrap up cleanup.
## In practice
Now that you have had a chance to really get your hands into the cli wallet you can take what you have learned and make something a bit more stable.<br>
Again I would not really use a docker container (unless its specifically made for it) like this. This was all just about getting you confortable in using cli<br>
without risking much. <br>
Here are some helpful links to continue on your journey
- https://monerodocs.org/interacting/monero-wallet-cli-reference/
- https://monerodocs.org/interacting/monero-config-file/
- https://xmrguide.org/
- https://sethforprivacy.com/external-content/
- Matrix rooms
- https://matrix.to/#/#monero:monero.social
- https://matrix.to/#/#localmonero:agoradesk.com
- https://matrix.to/#/#cryptoagorism:nokyc.im
- https://matrix.to/#/#optout:monero.social
#### Questions, Comments, or Whatever reach out to me on Matrix
@ackermann:hackliberty.org<br>
For fun you can use this [stagenet donation](https://www.getwishlisted.xyz/donate/) page where you can send stagenet xmr and you can get feedback if it was recived by it.