BlackCoin Full Node , Raspberry Pi3 - (Lore)
(For any Single board computer running an ARM Cortex-A53 processor - Full list of compatible hardware listed here)
Latest Update 23rd May 2018
Step (1) Preparing the Pi
Because all the preparation steps are the same for all nodes here, I have made a beginner friendly guide with images, step-by-step. "Getting started" Link opens a new window
Getting Started
Then continue below...
Step (1) Preparing the Pi
Because all the preparation steps are the same for all nodes here, I have made a beginner friendly guide with images, step-by-step. "Getting started" Link opens a new window
Getting Started
Then continue below...
Step (2) Enabling WiFi
Wifi is available once the Pi is rebooted. Either reboot now using
sudo reboot and remove the ethernet cable. Or continue, and reboot later as it is required after the next step. |
With the Pi turned on, booted and you logged in with SSH we can start the setup.
First WiFi network connections are stored: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf Go to the bottom of the file and add the following text: network={ ssid="YOUR WIFI ROUTER NAME" psk="YOUR WIFI ROUTER PASSWORD" } **Note: Enter details between the quotes, leave the "" in save and exit using ctrl+O Then 'enter' ctrl+X |
Step (3) Expand the file system, (making full use of the SD card) and changing the Password.
|
enter:
sudo raspi-config The default password for obvious security reasons should be changed. That is done in this menu. select "1 change user password", and follow the on-screen instructions. This will be the new password when using PUTTY to SSH into the Pi. Because we installed a 2GB image onto the card, the Pi may think that the card is only 2GB in size. So we tell it to expand the file-system (returns it to it's full size allowed): select "7 advanced options" select "A1 expand filesystem" select 'finish' and the system will reboot, (remove the Ethernet cable if you didn't at the previous step). And log back in with SSH and PUTTY once reboot is complete. |
Step (4) Updates
The image we downloaded may have an update or two since they released it:
sudo apt-get update -y
sudo apt-get upgrade -y
The image we downloaded may have an update or two since they released it:
sudo apt-get update -y
sudo apt-get upgrade -y
Step (6) - Starting BlackCoin for the first time:
After the installation type
cd
to return to the Pi home directory.
After the installation type
cd
to return to the Pi home directory.
Your Pi will do what's shown above. The green cursor will drop down a line and begin the node showing "Blackcoin server starting", it is now downloading and synchronizing the blockchain.
We can now manage the running node
(7) Setup/Initial walllet Functions
./arm32/lore-cli help
Will give a full list of available commands for future reference. I'll explain the key/common ones for functionality below:
./arm32/lore-cli help
Will give a full list of available commands for future reference. I'll explain the key/common ones for functionality below:
./arm32/lore-cli getinfo This command shows some basic useful information about the running node. Initially it is most useful to see if you are full sync'd by checking the value of "blocks" (your current block height) against the actual network block height. Once it's within one or two blocks, it's sync'd and you'll be able to spend funds. It's worth noting that a complete sync takes a Raspberry Pi 3B approximately 4 hours on a fast connection. This "getinfo" command will be most used to check balances and staking later. |
**Disclaimer** From here on in you must very very careful. I am not an official BlackCoin Dev nor do I have any affiliation with them. These commands and the software I have pointed you towards are all open source and you are free to interrogate them to check I have not done anything malicious. But as a rule you should not follow anyone in the crypto-world blindly, assess the risks. Yes, you are your own bank! But banks as a store of wealth are targets. Be smart, use firewalls, change default passwords and never share your Private Keys.... The punchline to this is that I accept no responsibility or liability for any funds you decide to store on this device. I've built these nodes purely as an educational project, and with previous builds there were no funds involved. However in this case, staking and loading the wallets now involves financial risk, and what you decide to do is 100% on you. Not me. Make backups of your wallet.dat and password you use to encrypt it. Typically the wallet.dat and password can be used to enact a recovery on another device should the Raspberry Pi/SD card/HDD fail.
With that said, if you wish, we'll proceed.
./arm32/lore-cli getnewaddress
#This generates a BlackCoin account, displays the address and produces a wallet.dat file in the .blackcoin directory we made earlier.
This is your receiving address and will be used to fund your wallet for staking. Make a note of it.
It is currently not encrypted
This is your receiving address and will be used to fund your wallet for staking. Make a note of it.
It is currently not encrypted
./arm32/lore-cli dumpprivkey <copy/paste address from above>
#Displays the Private key of the address produced above. The account and any funds held within it can be recovered with this sequence of letters and numbers. It is case sensitive. Record it somewhere and keep it safe. It is a method of recovering your funds in the event of hardware failure. Funds could be lots FOREVER if this key is lost/destroyed.
However if someone else has this key, they have your funds.
However if someone else has this key, they have your funds.
./arm32/lore-cli encryptwallet <Type a super secret mega complicated password here>
**Upper and lowercase letters and numbers only, no special characters.
**Upper and lowercase letters and numbers only, no special characters.
#Encrypts the wallet to prevent private keys being leaked.
**Very important** It's not obvious due to this website's text formatting but the above encryptwallet command has a space (_) before ./arm32/lore-cli. This is very important as it will prevent your password from being saved in the bash/command history.
This password you set should be remembered and backed up to gain access to with wallet and funds in future. It encrypts the wallet.dat file.
Once the encryption step is complete the node shuts down for security reasons.
**Very important** It's not obvious due to this website's text formatting but the above encryptwallet command has a space (_) before ./arm32/lore-cli. This is very important as it will prevent your password from being saved in the bash/command history.
This password you set should be remembered and backed up to gain access to with wallet and funds in future. It encrypts the wallet.dat file.
Once the encryption step is complete the node shuts down for security reasons.
Step (8) Moving everything to the USB drive
People have been making projects (not just nodes) on the raspberry pi for some time. A common failure point seems to be the SD cards. The constant read/write process 24/7 drastically shorten their life. We can reduce this by moving the entire file-system to the USB drive, and where possible using traditional platter HDDs. Check out the 'HARDWARE' section for cheap solutions available to the Raspberry Pi.
This is the ideal time to perform this step. Our Blackcoin wallet has safely shut itself down, and has an encrypted wallet file and address ready to receive funds. When we perform this next step and copy the contents of the SD card to the HDD we are making a backup which remains on the SD card but is not used.
If at any point the USB HDD fails, this step can be performed again and our files are restored onto the new HDD, the node then continues to function, (after any required synchronization) with the same addresses and private keys.
So:
For moving the file-system we need the "git" repository
sudo apt-get install git
Insert the USB drive if you havn't already, then check it is mounted to the Pi.
sudo lsblk
99% of the time it will be mounted as /dev/sda with a partition called sda1. However if it has found sda1 it won't let us continue until it is unmounted. (It would be telling it to make changes to the filesystem whilst it's in use. It won't let us and doesn't like it). So we unmount with
umount /dev/sda1
We need to delete this partition to stop raspbian from automatically using the drive on boot, at this point. The helper in the next step will automatically create a new partition to do it's job of moving the files.
sudo fdisk /dev/sda
d
(deletes old partition)
w
(writes and commits the changes)
Now it's compatible with the helper script.
The folks at Adafruit have made a very useful helper to reduce the amount of commands you need. These next three lines create a new partition and move the entire file system onto the USB drive. It does warn you that any data currently written to /sda will be overwritten. If you are an advanced user and have called the partition something other than /sda, this is where it should be changed.
git clone https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git
cd Adafruit-Pi-ExternalRoot-Helper
sudo ./adafruit-pi-externalroot-helper -d /dev/sda
It will ask you to check that you are writing to the correct partition, select y when you are sure. When I do this step it takes a little under 10mins. Please be patient.
People have been making projects (not just nodes) on the raspberry pi for some time. A common failure point seems to be the SD cards. The constant read/write process 24/7 drastically shorten their life. We can reduce this by moving the entire file-system to the USB drive, and where possible using traditional platter HDDs. Check out the 'HARDWARE' section for cheap solutions available to the Raspberry Pi.
This is the ideal time to perform this step. Our Blackcoin wallet has safely shut itself down, and has an encrypted wallet file and address ready to receive funds. When we perform this next step and copy the contents of the SD card to the HDD we are making a backup which remains on the SD card but is not used.
If at any point the USB HDD fails, this step can be performed again and our files are restored onto the new HDD, the node then continues to function, (after any required synchronization) with the same addresses and private keys.
So:
For moving the file-system we need the "git" repository
sudo apt-get install git
Insert the USB drive if you havn't already, then check it is mounted to the Pi.
sudo lsblk
99% of the time it will be mounted as /dev/sda with a partition called sda1. However if it has found sda1 it won't let us continue until it is unmounted. (It would be telling it to make changes to the filesystem whilst it's in use. It won't let us and doesn't like it). So we unmount with
umount /dev/sda1
We need to delete this partition to stop raspbian from automatically using the drive on boot, at this point. The helper in the next step will automatically create a new partition to do it's job of moving the files.
sudo fdisk /dev/sda
d
(deletes old partition)
w
(writes and commits the changes)
Now it's compatible with the helper script.
The folks at Adafruit have made a very useful helper to reduce the amount of commands you need. These next three lines create a new partition and move the entire file system onto the USB drive. It does warn you that any data currently written to /sda will be overwritten. If you are an advanced user and have called the partition something other than /sda, this is where it should be changed.
git clone https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git
cd Adafruit-Pi-ExternalRoot-Helper
sudo ./adafruit-pi-externalroot-helper -d /dev/sda
It will ask you to check that you are writing to the correct partition, select y when you are sure. When I do this step it takes a little under 10mins. Please be patient.
So everything has been copied over and the drive configured. We just need to change the boot file so it starts from the USB drive from now on. The helper untility should have done this automatically. But recently this has not been the case. Do this just to check, it's simple and is just a copy/paste action. sudo blkid -o export /dev/sda1 The numbers will be different but it brings up something like the image on the left. |
This is our drives labels and addresses. We need to check that the PARTUUID long number (that's the USB), is entered into
sudo nano /boot/cmdline.txt
sudo nano /boot/cmdline.txt
Enter:
sudo nano /boot/cmdline.txt And ensure that the helper has changed root=PARTUUID= to match the one that was listed to you above. Yours will be different to mine. Then Save and exit using ctrl+o then ctrl+x. Do another reboot with sudo reboot and when the Pi starts this time your USB activity light will blink like crazy, showing it's now getting it's data from there. |
(9) Staking
(a) Unlock wallet, with staking enabled:
Log back into the Pi as before.
Then restart lored:
./arm32/lored -daemon
And we can now use our wallet securely. I'll explain the features listed below:
(a) Unlock wallet, with staking enabled:
Log back into the Pi as before.
Then restart lored:
./arm32/lored -daemon
And we can now use our wallet securely. I'll explain the features listed below:
We need to gain access to our wallet. First we un-encrypt it:
./arm32/lore-cli walletpassphrase SuP3R5ecrETPa55w0rD 999999999 true
./arm32/lore-cli walletpassphrase SuP3R5ecrETPa55w0rD 999999999 true
Broken down into parts so you understand:
walletpassphrase SuP3R5ecrETPa55w0rD
#Tells the node to unlock the wallet with whatever passoword you set in the encryption stage. Again be careful to include a space(_) before the command so your password isn't saved in the Pi's history.
999999999
#Tells the node how long to unlock the wallet for in seconds. I want it to unlock and stake indefinitely, and that's 31 years.
true
# This unlocks the wallet for staking only, preventing unauthorized spending. Essentially this unlocks the staking features, the spending feature remains locked.
It will display an error message only if you enter an incorrect password. If all goes well it will wait for another command.
walletpassphrase SuP3R5ecrETPa55w0rD
#Tells the node to unlock the wallet with whatever passoword you set in the encryption stage. Again be careful to include a space(_) before the command so your password isn't saved in the Pi's history.
999999999
#Tells the node how long to unlock the wallet for in seconds. I want it to unlock and stake indefinitely, and that's 31 years.
true
# This unlocks the wallet for staking only, preventing unauthorized spending. Essentially this unlocks the staking features, the spending feature remains locked.
It will display an error message only if you enter an incorrect password. If all goes well it will wait for another command.
(b) Add funds:
Earlier we made a receiving address and made a note of it.
Send funds to that address which you'd like to stake. There are many ways to do this but it is not within the scope of this guide. Most people send directly from and exchange and the process will differ depending on which exchange you use.
Once you have sent funds, after one confirmation (approx 1 minute) they will appear under "balance" on the "getinfo" page:
Earlier we made a receiving address and made a note of it.
Send funds to that address which you'd like to stake. There are many ways to do this but it is not within the scope of this guide. Most people send directly from and exchange and the process will differ depending on which exchange you use.
Once you have sent funds, after one confirmation (approx 1 minute) they will appear under "balance" on the "getinfo" page:
(c) Wait:
I know it's a bit of a underwhelming step! However it's a network rule that coins for staking must be un-moved for 500 confirmations or approx 8 hours.
After this time the coins have matured and will be staking.
I know it's a bit of a underwhelming step! However it's a network rule that coins for staking must be un-moved for 500 confirmations or approx 8 hours.
After this time the coins have matured and will be staking.
(10) Basic Wallet Functions:
So once the 500 confirmations/approx 8 hours has passed the following command will bring up a screenshot similar to that on the right: ./arm32/lore-cli getstakinginfo So long as "staking" : true is shown (providing you have loaded a balance) then you are staking. Below I'll list a more comprehensive explanation of the date here. |
To explain (just educational, you probably don't need to know this):
"enabled" : true, = staking enabled
"staking" : true = yes, you are staking your balance of your currently unlocked wallet
"currentblocksize" : ####, = This number '1.69kb' is the amount of data used in that block, the more transactions the larger the number. There is a total and definite limit to how much data can fit within each single block of transactions.
"currentblocktx" : #, = How many transactions are to be included in the next block within the above mentioned data limit.
"pooledtx" : #, = How many transactions are waiting to be processed into blocks and stored in a "pool". E.g. If there are more transactions than will fit in the next block due to the data limit, they are kept in the pool for the next available block with space.
"difficulty" : ####, A value in the complex calculation that is used to maintain the block interval to as close to 64 seconds per block as possible.
"weight" : ####, I loaded my wallet with 10 BlackCoins, this is shown to 8 decimal places as my staking weight.
"netstakeweight" : ####, The total sum of everyone's staked BlackCoin on the network (8 decimal places) In this screenshot approx 16.5M
"expectedtime" : ####, The estimated time in seconds until I am expected to stake with my current weight.
"enabled" : true, = staking enabled
"staking" : true = yes, you are staking your balance of your currently unlocked wallet
"currentblocksize" : ####, = This number '1.69kb' is the amount of data used in that block, the more transactions the larger the number. There is a total and definite limit to how much data can fit within each single block of transactions.
"currentblocktx" : #, = How many transactions are to be included in the next block within the above mentioned data limit.
"pooledtx" : #, = How many transactions are waiting to be processed into blocks and stored in a "pool". E.g. If there are more transactions than will fit in the next block due to the data limit, they are kept in the pool for the next available block with space.
"difficulty" : ####, A value in the complex calculation that is used to maintain the block interval to as close to 64 seconds per block as possible.
"weight" : ####, I loaded my wallet with 10 BlackCoins, this is shown to 8 decimal places as my staking weight.
"netstakeweight" : ####, The total sum of everyone's staked BlackCoin on the network (8 decimal places) In this screenshot approx 16.5M
"expectedtime" : ####, The estimated time in seconds until I am expected to stake with my current weight.
Sending BlackCoin:
First unlock your wallet for spending using:
./arm32/lore-cli walletpassphrase YouR5uP3rsec7eTpA55w0rD 999999999 false
The format is:
./arm32/lore-cli sendtoaddress <blackcoinaddress> <amount>
First unlock your wallet for spending using:
./arm32/lore-cli walletpassphrase YouR5uP3rsec7eTpA55w0rD 999999999 false
The format is:
./arm32/lore-cli sendtoaddress <blackcoinaddress> <amount>
So in my case I'm going to send 5 BlackCoins to my exchange:
./arm32/lore-cli sendtoaddress BSK24U77vSRcANa5At8SfcpJiiorDc1DTg 5
./arm32/lore-cli sendtoaddress BSK24U77vSRcANa5At8SfcpJiiorDc1DTg 5
If the conditions of the network are followed, eg, If your wallet balance is sufficient, wallet unlocked etc a successful transaction will produce a transactio ID below your command.
**Note you will also be required to pay a 0.0002BlackCoin transaction fee.
This tx ID can be followed in an online block-explorer.
Once you're done sending re-lock your wallet with:
./arm32/lore-cli walletlock
And if you wish to return to staking mode it's the same as before:
./arm32/lore-cli walletpassphrase YouR5uP3rsec7eTpA55w0rD 999999999 true
**Note the "true" or "false" on that command is for the option: "enable staking only"
**Note you will also be required to pay a 0.0002BlackCoin transaction fee.
This tx ID can be followed in an online block-explorer.
Once you're done sending re-lock your wallet with:
./arm32/lore-cli walletlock
And if you wish to return to staking mode it's the same as before:
./arm32/lore-cli walletpassphrase YouR5uP3rsec7eTpA55w0rD 999999999 true
**Note the "true" or "false" on that command is for the option: "enable staking only"
Step (11) Security
I've been made aware that there are some underlying defaults that can affect system security. One is to disable root login by ssh by editing
sudo nano /etc/ssh/sshd_config and changing PermitRootLogin without-password to PermitRootLogin no and add the line below to only allow ssh access to user 'pi' AllowUsers pi Save, ctrl+o, enter, exit ctrl+x then reboot just sshd by sudo /etc/init.d/ssh restart I will update any security recommendations as I become aware of them. Enjoy |
How to restore your wallet from a backup:
And how to make backups in the event of failure. (3 Methods)
In the event of HDD failure:
And how to make backups in the event of failure. (3 Methods)
In the event of HDD failure:
Method (1)
The easiest method is to shutdown the Pi if you haven't already, and put the Micro SD card into a PC.
The easiest method is to shutdown the Pi if you haven't already, and put the Micro SD card into a PC.
On the SD card, visible on a windows PC are two files of interest
cmdline (.txt) and cmdline.txt.bak This was setup by the script that copied all our files to the HDD. cmdline.txt.bak is the origional file the Pi used to boot from before we attached the HDD, and our wallet files are still held on the SD card as we set them up before copying them. All that is required is for you to rename 'cmdline' to 'cmdline.txt.old' to disable it. And rename 'cmdline.txt.bak' to 'cmdline.txt' to enable it. Put the card back in the Pi and it will run as it did before the move to the HDD. |
Simply complete 'Step (8) Moving everything to the USB drive' again with a new HDD and the node/wallet will perform as normal with the encrypted wallet.
Method 2: Import the Private key to a new node/rebuild.
There is a function of the wallet to import the private key we made and backed up
With lored -daemon running:
./arm32/lore-cli importprivkey "bitcoinprivkey"
**Where "bitcoinprivkey" is the clear text key generated when you did "dumpprivkey" on the build. (without "")
This will regenerate the un-encrypted wallet file again.
Follow the steps in this guide to re-encrypt the wallet and continue as normal.
There is a function of the wallet to import the private key we made and backed up
With lored -daemon running:
./arm32/lore-cli importprivkey "bitcoinprivkey"
**Where "bitcoinprivkey" is the clear text key generated when you did "dumpprivkey" on the build. (without "")
This will regenerate the un-encrypted wallet file again.
Follow the steps in this guide to re-encrypt the wallet and continue as normal.
Method 3: Copy the wallet.dat file
The Lore wallet.dat file is held at /home/pi/.lore/wallet.dat
Using a tool called WinSCP mentioned in the "Getting Started" section of this guide we can view this file:
WinSCP is a very useful tool, it shows the contents of the Pi structured like a windows file system which you may be more familiar with.
The Lore wallet.dat file is held at /home/pi/.lore/wallet.dat
Using a tool called WinSCP mentioned in the "Getting Started" section of this guide we can view this file:
WinSCP is a very useful tool, it shows the contents of the Pi structured like a windows file system which you may be more familiar with.
WinSCP works by displaying the file system on the Pi in the right window,
and the host PC file system in the left window.
Navigate to /home/pi/.lore/ to find wallet.dat then drag and drop the file to the host PC in the left window. It brings up the dialogue window shown in the screenshot to "download". If your happy with the location click ok.
To restore the wallet.dat onto the Pi, reverse the process and Lore will find it on boot.
and the host PC file system in the left window.
Navigate to /home/pi/.lore/ to find wallet.dat then drag and drop the file to the host PC in the left window. It brings up the dialogue window shown in the screenshot to "download". If your happy with the location click ok.
To restore the wallet.dat onto the Pi, reverse the process and Lore will find it on boot.