Command Line Wallet
This is a guide on how to use the CLI Wallet. It was created for developers by developers and is directed towards our miner community. If you’re not familiar with Linux and the command line or not interested in learning then try out the Mojo wallet.
Contents
Installation
There are some instances where you might want to compile the wallet separate from any mining capability. All it takes is a slight modification of the git repo to do this, so we will start by cloning the git repo:
Clone Git
git clone https://github.com/mochimodev/mochimo
Create new installation script
Next we need to create and make executable a makewal
file so that we can compile just the wallet software and not the Cuda code for mining. The set of four commands to run:
cd ./mochimo/src touch makewal chmod +x ./makewal nano ./makewal
You should now be in the nano editor, and we want to place the following code into that file:
#!/bin/sh # Change the set CC line for your compiler: export set CC='cc -DUNIXLIKE -DLONG64' echo Building wallet... $CC -c crypto/sha256.c 2>ccerror.log $CC -c crypto/wots/wots.c 2>>ccerror.log $CC -o wallet wallet.c wots.o sha256.o 2>>ccerror.log echo Errors logged to ccerror.log ls -l ccerror.log
Now save and exit from nano by doing a Ctrl-o
then Enter
then Ctrl-x
Now, run it!
Now we can run the script by typing ./makewal
at the terminal inside the mochimo/src/
directory.
If we have done everything right, we should have a wallet program in src/
directory. Confirm the wallet program is there with a ls
command to list the directory’s contents.
Let's make a bin
directory, and move the binary over there by using these commands:
mkdir ../bin/ cp ./wallet ../bin cd ../bin
We should now be in the bin
directory.
Confirm the wallet program is there with a ls
command to list the directory’s contents.
That's it! program installed :)
Running for the first time
Create a new wallet
Start from the mochimo/bin/
directory and invoke the wallet with the following command:
./wallet -p2095 -n
(Note: port 2095 is required to be open on your network for mining to function, but not required for the wallet to run. You still need though, to enter the command exactly as above.)
- You will be prompted to choose a name for your wallet. We’ll call it My Wallet in our example.
- You will be prompted for a password. Your wallet will be encrypted 100% of the time. This password will be used to decrypt the wallet - don't lose it.
- You will be asked to enter some random text to help randomize your wallet seed. You do not need to memorize this information.
- If this is a NEW installation of Linux, say on a cloud server, you may get stuck here. This means that your box doesn't have enough entropy to create the randomness needed for this step. Here is the proposed solution to that problem:
- You will have to open a new terminal window and do the following
sudo apt-get install rng-tools
sudo rngd -r /dev/urandom
- This should solve your problem, if not check in the Discord group to see if there might be a newer solution.
- If this is a NEW installation of Linux, say on a cloud server, you may get stuck here. This means that your box doesn't have enough entropy to create the randomness needed for this step. Here is the proposed solution to that problem:
- You will be asked to pick a filename. We recommend
mochimo.wal
. - The wallet file is saved to the disk and the wallet software exits.
- Confirm
mochimo.wal
was successfully created with als
command to list the directory’s contents.
Download a list of network nodes and start the wallet
Let's download a startnodes.lst
file, so the wallet has multiple nodes to grab network information from. It will also help to avoid getting a ***Balance check failed***
error. The easiest way to do that in Linux is:
wget https://www.mochimap.net/startnodes.lst
If you named your wallet mochimo.wal, then open the wallet with the following command:
./wallet -p2095 mochimo.wal
You will be prompted to enter your password. If you enter this incorrectly, the system will not tell you, but the name at the top of the wallet when you open it be some garbled gibberish. The reason for this is the password is a decryption key and is not stored in the wallet itself. If you enter it wrong, the wallet will still decrypt using the wrong key, and the result will be garbage. You know you entered it correctly if the wallet name you chose displays at the top of the screen. In our case, we’ll see My Wallet at the top.
Create a new non-mining address
We are going to play out the scenario that you are NOT a miner, but you would like to buy Mochimo from your friend who is. In order to do this you will have to have a Mochimo address to which he can send your coins. There are two ways of doing this. We are going to address the old-school original way here, since this is the old-school original wallet. The new school way is with our cross-platform Mojo wallet.
- First, create a new address with option
4
. - You must give it a name here, let's use Mo Money. This address will be assigned an index sequentially higher than your last address. If you don't have any addresses yet, this would be index
1
. - If you are using the most recent version of the wallet, you will be asked if you want to "Tag" this address (Learn about Tags here), for this part of the guide, let's say
N
Finding your address index
- After returning to the main menu, it is a good idea to hit
6 Check Balances
every time. If you don't have an addresses with a balance, then you will see No entries.
If you are making an address to export that doesn't yet have a balance, it may be difficult to find that address' index. Here is the right way:
- From the main menu, choose option
9
for the 2nd page menu - Then choose option
2
forDisplay change addresses
. This will show all of your 0 balance addresses. You can find the correct address index here. - If you'd like to see your hex address, choose option
4 Display address in hex
Receive Mochimo
Export address
In order for our friend to send us Mochimo, we are going to have to send him an address file. The reason this is slightly different than other crypto-currencies is part of what makes us a quantum secure coin. Our addresses are over 2000 bytes in length. Not something you can easily type into a field on the web. The easy way around this is to export the entire file and send it to your friend via email which is what we will be doing here. However, there is a "tagging" feature which is our long-term solution to this problem and will be explained later.
- Start from the wallet's Main Menu
- Choose option
7
forExport address
- Now you must choose the index number for the address you wish to export. If you are not sure which is the correct index, then see the previous
Finding your address
section - After selecting the index of the address you wish to export, the wallet will ask you to name the file it is about to write. Let's say: myStack.dat
- The next question is
Write balance (y/n)?
. If we answer yes here, our friend will be able to see our balance when he opens his wallet, if we answer no, it is still possible for our friend to find our balance, but it might take an extra step. - If you answered
y
in the previous question, this will be the next question. If we answered in the negative, we will not get this question:Write secret (y/n)
? In this scenario, we DO NOT want to export the file with it's secret attached. If we did so, our friend would have access to whatever funds he sent us, so we will answern
.
The exported myStack.dat file will be located in the same /mochimo/bin/
directory as your mochimo.wal wallet file (screenshot below of our working example).
The exported file will need to be transferred from the server to your local computer. There are many ways to do this and we suggest secure transfers through encrypted channels for security.
From here we just need to email our friend and attach this file to that email. Then - we wait :)
Send Mochimo
Importing a foreign address
For this part of the walk-through, we are going to pretend as if we are the friend who is paying our new friend some Mochimo. We preloaded our Mo Money address with MCM, to be able to send to our friend.
We have received the email with his address and placed that JohnStack.dat file in the same directory where we have our wallet, then we open our wallet. Now we need to import his “foreign” address. “Foreign” address simply means any address you did not create in your own wallet.
- From the main menu in the wallet we choose option
3
. - For now, we answer
n
to theImport foreign tag (y/n)?
question. This will be addressed later. - In our scenario, the answer to the next question of
Import file name:
is JohnStack.dat - Enter a name for the
Enter address name
field, so you recognize what the address refers to. We will name it the same as the imported file: JohnStack - This should import the foreign address into our wallet and give it the next index number in order. To find what index number was assigned and to see if we can see the balance of the address, we go to the second page of the menu with option
9
, and choose3
forDisplay foreign addresses
. - If our friend answered yes to the Write balance question earlier, we should be able to see that here, but more importantly for our purposes - we now know the index that was assigned to the new address we just imported. In our example, the index number is 2.
Sending MCM to our friend
- Now we are going to send our friend his payment! We go back to the main menu by choosing option
9
inMenu 2
. - We choose option
5
which isSpend address
- Next we choose an address index with a balance to spend from. In our example, we are going to choose index
4
which is the Mo Money address we setup initially and has been funded with some MCM - After choosing the address we will spend from, we are asked to choose a destination address, and the wallet automatically will display your foreign addresses here in case you didn't remember the address you wanted to send to. We already know the index we want as our destination address (JohnStack) is
5
, so enter that here. (We could also choose 0 here if we wanted to send the entire amount from our Spend address to a Change address that would go to yourself. For now, we will always choose a destination address.) - Now we have to enter the amount to send. Careful here. The prompt says
Enter send amount in Satoshi (or append c for Chi):
and we want to send our friend 1.5 MCM. The easiest way to do this is to type out the amount in billions of Satochi that looks like this:1500000000
No decimal points!- (The wallet has a typo here. We use 9 decimal places and the correct unit for that is Satochi - not Satoshi)
- Helpful Conversion Table
- (The wallet has a typo here. We use 9 decimal places and the correct unit for that is Satochi - not Satoshi)
- The wallet will show you what you entered in Chi with the decimal placed correctly.
Send amount: 1.500000000
And now we have to select a Change address, explained in the following section.
Selecting an address for the Change
Note: Mochimo uses Winternitz One-Time-Spend (WOTS+) addresses. Each time you spend from an address, a portion of that address' secret is leaked to the public. For this reason, the wallet requires that you choose a Change address
to send your change to. You should never re-use a spend address, and since we are about to spend from our mining address, that means we will have to create a new one...
- The wallet automatically shows you all available Change addresses here and gives you the option to
Create another change address (y/n)?
For this walk-through we are going to create a Change address on the fly by answeringy
to this question. - Now we need to name our new Change address. Let's say: New Money
- Answer
n
toAdd tag (y/n)?
- The New Money address will be created and it will give you an index number, for our example, it’s 6.
- It will ask you again if you want to
Create another change address (y/n)
? We’ll answern
here, because we’ve already created the one change address we need. - It will now ask for the
Change address index
number, which is 6 for us (New Money Address). - Here we are shown the fixed transaction fee of 0.000000500 MCM and asked to confirm our transaction. Everything looks good! Let's say
y
! - If everything was successful, you will now see Sent!
Confirm the transaction was sent
- We now wait for a block to clear and the MCM to be sent to our friend. You can keep an eye on the current block on www.mochimap.net (image below). At the top, you will see Best Block. Wait for that to update to the next block. Alternatively, you can also go to the Mochimo Explorer https://bx.mochimo.org.
- After the next block clears and assuming our friend shared the balance with us, we can go back to Foreign addresses to confirm the JohnStack address received 1.5 MCM.
- From
Menu 2
, select option3
forDisplay foreign addresses
and look at the JohnStack address balance. - Everything looks good!
Additional Information for Miners
Miners will have mostly the same process with creating wallets, addresses, and sending/receiving. The main difference for miners will be in generating addresses for their miners to mine to.
Prerequisites:
Mining requires CUDA to be installed on the machine and port forwarding to be enabled on port 2095. Link to Mining Rig Guide | Link to Port Forwarding instructions
Generate a mining address
Follow the same steps in the 2.1 Create a new wallet
and 2.2 Download a list of network nodes and start the wallet
sections.
Let’s create a new wallet following the steps in 2.1 Create a new wallet
and naming the wallet file mining.wal instead. Then open the wallet with the following command:
./wallet -p2095 mining.wal
You will be prompted to enter your password. If you enter this incorrectly, the system will not tell you, but the name at the top of the wallet when you open it be some garbled gibberish. The reason for this is the password is a decryption key and is not stored in the wallet itself. If you enter it wrong, the wallet will still decrypt using the wrong key, and the result will be garbage. You know you entered it correctly if the wallet name you chose displays at the top of the screen. In our case, we’ll see My Wallet at the top.
- First, create a new address with option
4
. - You must give it a name here, let's use mining address.
- You will be asked if you want to "tag" this address, say
N
.
WARNING: YOU MUST *NOT* ADD A TAG TO A MINING ADDRESS.
- This address will be assigned an index sequentially higher than your last address. If you don't have any addresses yet, this would be index
1
.
- Let’s check to make sure the address was successfully created. Select option
2
, to display your address entries. If you don’t have any coins yet, “My addresses:” will read “No entries.” - Select option
6
to check the balance on this new address. If you don't have any coins yet, the wallet will read No entries. - To check that the address was created, select option
9
to go to Menu 2. Then select option2
todisplay change addresses
and you should now see mining address.
Exporting your mining address
Now let's save this address to a maddr.dat file the miner uses, so that we can start mining and have our block rewards go to this address.
- Select option
7
, to export. You will be prompted to select the index number of the address you want to export. In this case it will be index1
, since it's the only address you have. Type1
and hit enter. - You will be prompted to select a file name. The file has to be named:
maddr.dat
- You will be asked where to save the Balance. Please select
N
. - If you are replacing a mining address, you will be told that maddr.dat file already exists. If you are asked, enter
Y
to overwrite the old mining address with your new mining address. - Now type
0
to exit, and go invoke your miner.
You are ready to mine!
Replace your mining address
If you plan to spend from your mining address, when you create your change address in the 4.3 Selecting an address for the Change
section, you will need to set the change address as your new maddr.dat mining address following the steps in the 5.2 Exporting your mining address
section.
When you are done with that, you should have a new maddr.dat
file in the mochimo/bin/
directory. You will also need to copy the new maddr.dat
file to the mochimo/bin/d/
directory on our miner.
The Mochimo Tag system
Do not Tag a mining address
The method described above to send you address to your friend so that he can send you Mochimo is less than ideal. Thankfully, the WOTS+ addressing contains space for a 12 byte address that can be transferred from one address to another. The way we have this implemented, all you should really have to do is remember your tag. Then you can just drop your 24 character tag to your friend via text or Discord and they can import that foreign (to them) tag into their wallet, and then send to it. Easy!
For the moment, we would suggest using the GUI Mojo wallet if you want to use tags. Check out the Mojo Quick Start Guide on the Mochimo Wiki. :)