If you are like me, you love/ mine/follow Ravencoin. I wanted to contribute to their ecosystem more. Why not run the Ravencoin blockchain!
I wanted to build a Ravencoin node to run the blockchain via CLI and these are the methods I used. So hopefully this will help someone in getting it running on Ubuntu Linux.
Starting OutFirst you need
- A computer, ideally a well performing one.
- 1TB HDD - I recommend a SSD. (lower sizes will work but eventually its going to run out. 1TB gives you plenty of room)
- Ubuntu 22.04.01 "jammy" which is available from here to install. That is the version this guide addresses but I believe lower versions should work fine I think.
- Be in front of it on command line or SSH into your Ubuntu computer.
I will be listing the linux commands you need to enter in order. We will be building/installing into your user folder under your current user. We will likely need to install Git.
sudo apt install git
Once you are running Ubuntu & have git, we need to get the code for the Ravencoin node from their official GitHub page and NO WHERE ELSE!https://github.com/RavenProject/Ravencoin
Run these commands to setup things:
cd
mkdir src && cd src
git clone https://github.com/RavenProject/Ravencoin
cd Ravencoin
git checkout develop
What we are doing is cloning the develop branch of the Ravencoin node onto our computer in the src directory.
Next once we have the source code for the node, we can start the process of building the program. We need some dependencies/tools installed first so we can compile it. Run this one long command to install what we need:
sudo apt install libboost-chrono1.74-dev libboost-filesystem1.74-dev libboost-program-options1.74-dev libboost-system1.74-dev libboost-thread1.74-dev libboost-test1.74-dev build-essential libssl-dev qtbase5-dev qttools5-dev bison libexpat1-dev libdbus-1-dev libfontconfig-dev libfreetype-dev libice-dev libsm-dev libx11-dev libxau-dev libxext-dev libevent-dev libxcb1-dev libxkbcommon-dev libminiupnpc-dev libprotobuf-dev libqrencode-dev xcb-proto x11proto-xext-dev x11proto-dev xtrans-dev zlib1g-dev libczmq-dev autoconf automake libtool protobuf-compiler
Compiling!These three commands start the process by installing a database (Berkeley DB) we need for the node to run. Swap out $USER for your user if you have issues.
contrib/install_db4.sh ../
./autogen.sh
export BDB_PREFIX='/home/$USER/src/db4'
Now we need to configure our compiler with some flags using this one command: Note, this is one command.
./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --prefix=/usr/local
Now lets throw it all together and generate out binaries! Adjust your "-j8" with however many threads your processor has. ex. -j16, -j4
make -j8
Now go get some coffee or a Redbull. It will be a min.
After that completes, we need to run this command to install it into our /usr/local/bin folder so we can run it anywhere:
sudo make install
If all went good, you now have Ravencoin Node CLI installed on your computer! Yay. Now let us go thru the process of configuring it to run for your setup.
Configuring the NodeHere are some commands to configure the node, start the node, and monitor the node. All your config settings can be done via command line or as a config file like most programs. I like to use a config file cause I think it is easier to visualize the options.
We need to create a data folder and generate our RPC authentication first. make a directory in your users home folder & then lets run this python script that will give us our authentication. Replace the "USERNAME" with your user you are using if there are issues. We will use this in the next step.
cd
python3 ~/src/Ravencoin/share/rpcuser/rpcuser.py $USER
It will spit out something like this:
rpcauth=kritch:83701465552JKCHKJCH81d4ea5AUTHAUTHAUTHAUTHKHFlkfhkjdhfjkdh49bc49705
Your password:
sEjkdhPASSPASSPASS-JYisXKJGHXKGXKJH-u3vUM=
Copy your rpcauth or write it down, we will use it in our config.
Now let us create our config file.
nano /home/$USER/.raven/raven.conf
First paste your rpcauth you just generated into the top of the file. We don't need the password. You don't have to enter anything else if you just want defaults but it at least needs the authorization and password. Some of these options are the default behavior.
Here is a example config file to put in:
#RPC authorization - generate this
rpcauth=kritch:LALALALALALAyourauthcodeLALALA
#Your address to receive any tokens - change to yours
miningaddress=YOURADDRESS
#add a comment to your node info - PUT IN YOUR wallet address
uacomment=YOURWALLET
######################################
#debug - 1 means all
#debug=1
#Use BIP44 or not
bip44=1
#use only ipv4 - default is all - ipv4/ipv6/onion
#onlynet=ipv4
#listen for incoming connections
listen=1
#check mempool every 100 tx
checkmempool=100
#max memory used ion MB (300 default)
maxmempool=800
#specify the most connections you will make; more = more memory
maxconnections=500
#Set database cache size in megabytes (450mb default)
dbcache=800
#run as a server & accept RPC commands
server=1
#use upnp if you don't have port 8767 open on your router
upnp=0
#pay for fees when sending assets. More likely to be done fast.
#paytxfee=0.01
#or
# Create transactions that have enough fees so they are likely to begin confirmation within n blocks (default: 6).
txconfirmtarget=5
#Warning: Reverting pruning requires re-downloading the entire blockchain.
#(default: 0 = disable pruning blocks, 1 = allow manual pruning via RPC, >550
#= automatically prune block files to stay under the specified target size in
#MiB)
prune=1
# Run on the test network instead of the real raven network.
#testnet=0
# Run a regression test network
#regtest=0
# Connect via a SOCKS5 proxy
#proxy=127.0.0.1:9050
# Bind to given address and always listen on it. Use [host]:port notation for IPv6
#bind=<addr>
# Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6
#whitebind=<addr>
##############################################################
## Quick Primer on addnode vs connect ##
## Let's say for instance you use addnode=4.2.2.4 ##
## addnode will connect you to and tell you about the ##
## nodes connected to 4.2.2.4. In addition it will tell ##
## the other nodes connected to it that you exist so ##
## they can connect to you. ##
## connect will not do the above when you 'connect' to it. ##
## It will *only* connect you to 4.2.2.4 and no one else.##
## ##
## So if you're behind a firewall, or have other problems ##
## finding nodes, add some using 'addnode'. ##
## ##
## If you want to stay private, use 'connect' to only ##
## connect to "trusted" nodes. ##
## ##
## If you run multiple nodes on a LAN, there's no need for ##
## all of them to open lots of connections. Instead ##
## 'connect' them all to one node that is port forwarded ##
## and has lots of connections. ##
## Thanks goes to [Noodle] on Freenode. ##
##############################################################
# Use as many addnode= settings as you like to connect to specific peers
#addnode=69.164.218.197
# Alternatively use as many connect= settings as you like to connect ONLY to specific peers
#connect=69.164.218.197:8767
# Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6.
# This option can be specified multiple times (default: bind to all interfaces)
#rpcbind=<addr>
#If no rpcpassword is set, rpc cookie auth is sought. The default `-rpccookiefile` name
# is .cookie and found in the `-datadir` being used for ravend. This option is typically used
# when the server and client are run as the same user.
#
# If not, you must set rpcuser and rpcpassword to secure the JSON-RPC api. The first
# method(DEPRECATED) is to set this pair for the server and client:
#rpcuser=Ulysseys
#rpcpassword=YourSuperGreatPasswordNumber_DO_NOT_USE_THIS_OR_YOU_WILL_GET_ROBBED_385593
#
# The second method `rpcauth` can be added to server startup argument. It is set at initialization time
# using the output from the script in share/rpcuser/rpcuser.py after providing a username:
#
# ./share/rpcuser/rpcuser.py alice
# String to be appended to raven.conf:
# rpcauth=alice:f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae
# Your password:
# DONT_USE_THIS_YOU_WILL_GET_ROBBED_8ak1gI25KFTvjovL3gAM967mies3E=
#
# On client-side, you add the normal user/password pair to send commands:
#rpcuser=alice
#rpcpassword=DONT_USE_THIS_YOU_WILL_GET_ROBBED_8ak1gI25KFTvjovL3gAM967mies3E=
#
# You can even add multiple entries of these to the server conf file, and client can use any of them:
# rpcauth=bob:b2dd077cb54591a2f3139e69a897ac$4e71f08d48b4347cf8eff3815c0e25ae2e9a4340474079f55705f40574f4ec99
# How many seconds raven will wait for a complete RPC HTTP request.
# after the HTTP connection is established.
#rpcclienttimeout=30
#rpcauth=raven:dcaf822caf8d5c5dd3692aca580a1e$9cbfa46bc3d974d31fec0efa0dfcf4287d7c24f3a1509708c702bcf2eb5383eb
#rpcpassword=BC6QSnOEq1e_kK-li8NRrNJboL7LY8u44Cd1NQh_fIc=
# By default, only RPC connections from localhost are allowed.
# Specify as many rpcallowip= settings as you like to allow connections from other hosts,
# either as a single IPv4/IPv6 or with a subnet specification.
# NOTE: opening up the RPC port to hosts outside your local trusted network is NOT RECOMMENDED,
# because the rpcpassword is transmitted over the network unencrypted.
#rpcallowip=10.1.1.34/255.255.255.0
#rpcallowip=1.2.3.4/24
#rpcallowip=2001:db8:85a3:0:0:8a2e:370:7334/96
# Listen for RPC connections on this TCP port:
#rpcport=8766
# You can use Raven or ravend to send commands to Raven/ravend
# running on another host using this option:
#rpcconnect=127.0.0.1
# Miscellaneous options
# Pre-generate this many public/private key pairs, so wallet backups will be valid for
# both prior transactions and several dozen future transactions.
#keypool=100
# User interface options
# Start Raven minimized
#min=1
# Minimize to the system tray
#minimizetotray=1
You will need to come back later to put in your wallet address once we have created the account. Now save your config file by CTRL-X & hit enter.
Starting Ravennode
Let us fire it up! Run the following command that launches ravend, the program name of our node:
ravend -upgradewallet -debug=1 -printtoconsole
This will start our Ravencoin node and start connecting to other peers! It will be spitting out a ton of debug info and printing to the screen so you can make sure it is running. We just wanted to make sure it starts so we know it worked before proceeding. Let it run for a min or so & then to stop ravend, either hit CTRL-C on the keyboard, or preferred, in a different command terminal type "raven-cli stop".
The first time you really run it, it will take a hour or four to get to the point its done syncing & running the blockchain. It is also creating all our other files we need to run under the.raven directory. Lets get it so it starts itself on boot.
Create a ServiceWe need to create a service in Ubuntu that we will use to handle the starting/stoping of our program ravend.
sudo systemctl --force --full edit ravennode
Copy and paste this for the program into our service file:
[Unit]
Description=ravend blockchain
After=network-online.target
[Service]
User=REPLACEUSER
Group=REPLACEUSER
Type=simple
PIDFile=/home/REPLACEUSER/.raven/raven.pid
ExecStart=ravend
Restart=always
TimeoutStopSec=60s
TimeoutStartSec=20s
StartLimitInterval=60
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
You MUST replace the REPLACEUSER a total of 3 times here with your username you have installed this under. We can't use the wildcard cause it will be a system process. What this is telling the computer is to start the ravend program after the network comes online and runs in the background.
Now hit CTRL-X and type yes, and hit enter to keep the default save location. We now have our service created! To enable it to start automatically on boot:
sudo systemctl enable ravennode
And Lastly, if everything went as it should, lets start it up!
sudo systemctl start ravennode
If everything went good you should see nothing. lol. Let us check our service status by seeing if it started correctly.
sudo systemctl status ravenode
Now let us look how you inter act with the ravend via command line.
Interacting with ravendWe use a program called raven-cli to control/interact with ravend. All commands start with the program raven-cli
Here is the command that will return the network status:
raven-cli getnetworkinfo
Here is how to get blockchain sync info:
raven-cli getblockchaininfo
Here are more commands to help you work with ravend with descriptions:
Blockchain Commands:
raven-cli getblockcount #return block count
raven-cli getmempoolinfo #returns memory info
raven-cli getdifficulty #return difficulty
raven-cli getchaintxstats #returns transaction stats
raven-cli abandontransaction "txid" #cancel a transaction
raven-cli pruneblockchain #deletes old blocks for space
Wallet Commands:
raven-cli listwallets #lists wallets open
raven-cli listaccounts #list accounts under wallet
raven-cli getwalletinfo #returns summary wallet info
raven-cli getbalance "walletAddress" #returns specific wallet balance
raven-cli getunconfirmedbalance #returns pending balance
raven-cli getaddressesbyaccount "accountName" #returns RVN address
raven-cli validateaddress "walletAddress" #verifies address
raven-cli getaccountaddress "accountName" #gets a new RVN address
raven-cli backupwallet "destination" #makes copy of wallet
raven-cli dumpprivkey "walletAddress" #retrieves private key
raven-cli importprivkey "privkey" ( "label" ) ( rescan ) #import pvt key
raven-cli importpubkey "pubkey" ( "label" rescan ) #import pub key
raven-cli importaddress "address" ( "label" rescan p2sh ) #import address
raven-cli mnemonic "your words" #space separated list of 12-words to import
raven-cli mnemonicpassphrase "password" #secures your 12-word mnemonic word
raven-cli getmywords # retrieve your BIP44 words
raven-cli encryptwallet "passphrase" #encrypts wallet with passphrase
raven-cli listaddressgroupings #shows accounts with balances
raven-cli listassetbalancesbyaddress "address" #returns assets for wallet
raven-cli move "fromaccount" "toaccount" amount #send between *accounts*
raven-cli sendfrom "fromaccount" "toaddress" amount #send to different wallet
Network Commands:
raven-cli getpeerinfo #returns connected peers and stats
raven-cli getconnectioncount #returns count of peers
raven-cli getnettotals #returns data totals
raven-cli getnetworkinfo #returns network status
raven-cli setnetworkactive "true|false" #turns on/off networking
You need a wallet so here is how you go about getting your wallet address and creating new ones. After ravennode is started and synced:
raven-cli getaccountaddress "accountName"
It will return your wallet address for the new account in your wallet you just created!
Lets see it added now to our account account list:
raven-cli listaccounts
or
raven-cli listaddressgroupings
That will list the accounts you have setup and their balances in that current wallet.
For a list of your transactions, put in your account you want to audit and it will return a list of them:
raven-cli listtransactions "account"
Wanna move between the accounts in your wallet?
raven-cli move "fromaccount" "toaccount" amount
If it is successful it will return true.
Send money to someones wallet? Note,it is your account to send from, not wallet.
raven-cli sendfrom "fromaccount" "toaddress" amount
It will return your TX hash if successful.
Network SetupI can't go into much here because everyones setup is different. You need to port forward 8767 to your ravennode. Usually you set a DHCP reservation on your private network and then forward the port to that so it never changes.
If you cant open the port, make sure you turn on UPNP=1 in the config file.
WooHoo!This should be it for running a basic Ravencoin node! You can check ravennodes.com if you server is listed by searching for your external IP. It will take a hour or so to first appear. You wanna keep your node up and running as much as possible. Even a slight downtime will hurt your percent online.
If anyone wants some good info here are a couple links I used to get my info:
Good Reference with more raven-cli commands
Thanks for reading my guide!
If you find errors or something doesn't work, feel free to send me a message on hackster.io or on twitter @kritch83. I try to make it as easy to run as possible but sometimes I make errors, like everyone.
Go Ravencoin!
My RVN Address ππ» RV1axYiEdBiJU2cKUgfYzTs48cJ9ERUnKn
Comments