Loading...
Loading...
The purpose of this guide is to help educate Zcashers who are interested in running a full node on a low-powered Raspberry Pi 4.
If you find this guide useful, consider donating ZEC to support ZecHub:
zs1txa9wzxsc46w4940c4t76wjlylhntyp7vcppsp8re32z02srqse038melgglew4jwsh3qes4m4n
In this step you will create a bootable SD card that will allow your Raspberry Pi 4 to boot.
Insert the microSD card into your computer. You may need to use the adapter that comes with the Canakit or any other equivalent adaptor.
Install Raspberry Pi Imager for your operating system. Download the version for the OS you currently have access to.
For example in linux you would type the following after downloading:
sudo dpkg -i imager_latest_amd64.deb
rpi-imager
Choose OS and Storage Device. Since Raspberry Pi 4's are 64 bit, I recommend choosing "Other general-purpose OS" => Ubuntu => Ubuntu Server 22.10 (64 bit). Click on Storage and select your SD Card
Before writing to SD card, click on Advanced options by clicking on the white gear icon near the bottom right corner.
Here you can update:
If you have an extra monitor and keyboard plug those in now. Note: these are optional.
We now need to connect to your Raspberry Pi 4. Things we need:
If you have a monitor and keyboard connected directly to your pi, the rest of this section can be skipped.
Two ways to find your IP address are via your router admin page, or with nmap. If using the router, it depends on which manufacture and I'll defer those details to a quick google search.
sudo apt-get install nmap
Find the IP address of your current computer and note the first three sections. This is typically 192.168.1.xxx or 192.168.50.xxx
Plug these details into nmap as follows:
sudo nmap -sn 192.168.50.0/24
or sudo nmap -sn 192.168.1.0/24
Using your username, pw, and IP address we can now login using SSH
ssh <username>@<ip address of your pi>
note: you must plugin your username and your IP address, and your pw when prompted.
For example: ssh ubuntu@192.168.1.25
where the username is ubuntu and IP address is 192.168.1.25.
If youâre curious which version Raspberry Pi you are using, try this command:
cat /sys/firmware/devicetree/base/model ; echo
Two ways of installing zcashd include downloading a precompiled binary or compiling zcashd from source. I highly recommend compiling from source.
If downloading a precompiled binary one source is adityapk00 . Note that since we are running a 64 bit OS, we want zcash-linux-aarch64-v*.tar.gz. Also note that up-to-date versions of zcashd are rarely precompiled.
For compiling yourself it is highly recommended to cross-compile. Cross-compile is to build on one platform a binary that will run on another platform. One reason for this is Raspberry Pi 4's are low-powered and thus not very fast! Leverage your main computer to help with this. You can grab the latest release here .
To cross compile we need to make sure we have the needed packages. Install the following:
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python3 python3-zmq zlib1g-dev curl bsdmainutils automake libtinfo5
sudo apt-get install gcc-aarch64-linux-gnu
Next change directory into the freshly downloaded zcashd release and run:
HOST=aarch64-linux-gnu ./zcutil/build.sh
We now need to transfer all the zcashd binary files to your Raspberry Pi 4. As of Zcashd v5.3 the needed files include:
zcashd
zcash-cli
zcash-tx
zcash-gtest
zcash-inspect
zcashd-wallet-tool
fetch-params.sh
These files are found in the /src directory of your latest release download location if you compiled them yourself. Otherwise, the precompiled files are where you downloaded them.
Two ways of achieving the tranfers are either using SFTP, or by using your External drive.
SFTP
sftp username@<ip of RaspberryPi4>
put zcashd
put zcash-cli
put zcash-tx
put zcash-gtest
put zcash-inspect
put zcashd-wallet-tool
put fetch-params.sh
OR
Simply copy the files onto the External before you plug it into the Raspberry Pi 4.
If you already have a full node synced and want to save time, you can also copy the blocks and chainstate data.
cd ~/.zcash/
tar -zcvf blocks.tar.gz /blocks
tar -zcvf chainstate.tar.gz /chainstate
Copy the blocks and chainstate .gz files into your External SSD/HHD.
Using External SSD/HHD on your Raspberry Pi 4
Mount the External SSD/HDD in the Media folder so you can see it:
lsblk
will display all drives connected. Most will be of the format sda
id
will show your user and group id's.
sudo mount -o umask=0077,gid=<groupid>,uid=<userid> /dev/sda1 /media/portableHD/
Keep an eye on both who owns the folders/files and also the permissions.
sudo chown -R <username>: portableHD
sudo chmod -R 700 portableHD/
If you copied the blocks and chainstate .gz files from your other computer untar these now. Make sure they are in the .zcash folder on your External drive.
tar - xvzf blocks.tar.gz
tar - xvzf chainstate.tar.gz
Setup /media/portableHD/.zcash/zcash.conf
notice how we moved the datadir to the External SSD/HDD which has much more space available.
Since the default .zcash folder location has been moved, we need to tell zcashd this by using symbolic links:
cp -rp ~/.zcash/* /new_dir
// Make copy of datadir or supply with an external HD
rm -rf ~/.zcash
// Remove default folder
ln -s /media/portableHD/ ~/.zcash
// Symbolic link new data location to the default so zcashd is happy
Run fetch-params.sh script to download needed data for zcashd
./fetch-params.sh
Start a new 'screen' [ program in linux ]. Open zcashd with -datadir set:
screen -S zcashScreen
./zcashd -datadir=/media/portableHD/.zcash/
Detach the screen. Ctrl+a , Ctrl+d
Create an alias so you dont have to type out all these extra data location commands
alias zcash-cli="./zcash-cli -datadir=/media/portableHD/.zcash/"
Ready to use!
zcash-cli getblockchaininfo
How do you check the status of your node?
tail -n 500 <path to>/.zcash/debug.log
To get current height from your log
tail -n 10 <path to>/.zcash/debug.log | grep -o 'height=[^b]*'
zcash-cli getinfo
How do you send a memo?
As seen here , download
ascii2hex
and
hex2ascii
Make them executable
chmod +x ascii2hex hex2ascii
Create a memo and convert it to hex. You can convert back to ascii to test.
Create a z2z transaction (Sapling) using the hex version of your memo from above
zcash-cli z_sendmany "ztestsapling1kg3u0y7szv6509732at34alct46cyn0g26kppgf2a7h5tpqxldtwm7cmhf8rqmhgt" "[{\"address\": \"ztestsapling2kg3u0y7szv6509732at34alct46cyn0g26kppgf2a7h5tpqxldtwm7cmhf8rqmhgtmpakcz5mdv\",\"amount\": 0.0001, \"memo\":\"5A656348756221\"}]"
How do you resume your zcashScreen after you detached it?
screen -r zcashScreen
How do you stop zcashd ?
zcash-cli stop
How do you create a UA?
zcash-cli z_getnewaccount
Now build a UA receiver according to your needs. This includes Orchard only, Orchard + Sapling, and finally Orchard + Sapling + Transparent.
Note you can tell the difference between receivers by how long they are.
zcash-cli z_getaddressforaccount 0 '["orchard"]'
zcash-cli z_getaddressforaccount 0 '["orchard","sapling"]'
zcash-cli z_getaddressforaccount 0 '["orchard","sapling","p2pkh"]'
How do you send ZEC using a UA?
zcash-cli z_sendmany "fromOaddress" "[{\"address\": \"dOrchardAddress\",\"amount\": 0.0001, \"memo\":\"yourMemoinHex\"}]" <minconf> <fee> <privacyPolicy>
Where can I find more info on UA's?