-
Notifications
You must be signed in to change notification settings - Fork 3
Wallet Staking on VPS
So you've decided to stake your Obsidian on a machine other than your sweet gaming rig, or your grandma's beat up Windows 98? Excellent, well hopefully by the end of this walkthrough you'll have a super sleek Ubuntu Virtual Private Server (VPS) setup and running Obsidian-Qt headlessly through the obsidiand
executable.
I will be referencing DigitalOcean throughout this guide and in the accompanying YouTube video. All links to DO are a referral link which will give you $10 of free Credit for your DO account. The lowest tier VPS is $5 a month, which is what I used to create this guide. I have no affiliation with DigitalOcean. Making an account on DO through my referral link gives me credits if you continue their service which help support my projects :). Donations and Tips are welcomed if you find me on the Obsidian Slack (@Pixxl) or by sending ODN to my address at the bottom of this guide.
I am in the process of creating a video guide to go along with the information detailed out below.
I've run through this a few times on the bare minimum for a Digital Ocean VPS and it took ~35 minutes from start to finish. The more CPU/Cores you have to get through the installation the faster it should go.
- SSH Basics
- VPS Basics
- Digital Ocean VPS Setup
- Obsidian-QT Installation
- Wallet Setup
- ODN Address Setup
- Staking your ODN
- Useful obsidiand commands
- Exporting your address/wallet
- Familiarity with your computer's Terminal (Mac), Console (Windows), Shell (Linux/Ubuntu).
- Basic understanding of the command prompt.
- You have an SSH Key generated already, see SSH Guide below for details.
- An Ubuntu machine you can remote-ssh into, like a VPS, see VPS Guide below for details.
To keep it simple, SSH
is a Secure SHell used to operate services securely over the network. SSH
provides a secure channel of communication between one computer and another computer. You'll need to generate and have an SSH key on your computer to authenticate yourself when you want to open up communication with your remote server. We will be using DigitalOcean throughout this tutorial as a reference. I always end up using the simple SSH Guide provided by Github to generate an SSH Key. Generating an SSH key provides you two files: id_rsa
and id_rsa.pub
. The first file is your private key, never share it with anyone you don't know! The second file is your public key. The use of these two files are to securely authenticate yourself on another machine. View Github SSH Guide
A Virtual Private Server, also known as a VPS, is a virtual machine running somewhere else remotely. Throughout this guide we will be using DigitalOcean as a reference as they provide a very easy to understand interface when it comes to "spinning" up a VPS. Their most basic VPS plan starts at $5 a month which is the min we need currently to run obsidiand
and begin staking ODN.
You can skip this part if you already have a VPS ready to use.
- Login to or Sign-up with DigitalOcean.
- Add your SSH key to your Account before deploying a VPS.
- Click on your Account Avatar > Settings.
- Click on Security on the left navigation panel.
- Click on Add SSH Key.
- Copy the contents of
.ssh/id_rsa.pub
or whatever your generated SSH key Public File contains. - Paste it into the Modal/window on DigitalOcean.
- Provide a name to reference this key.
- Click Add SSH Key.
You can skip this part if you already have a VPS ready to use. Once logged in and you have added your SSH key to your DigitalOcean account you can create a VPS through their "Droplet" system.
- Click the green Create dropdown menu.
- Click Droplets
- Make sure Ubuntu 16.04.3 x64 is selected.
- Select your Droplet size, the bare minimum is the $5/mo Standard Droplet (used in this guide).
- Select the region you want your VPS to be located.
- Checkmark the SSH key that matches the label you added.
- Give it a hostname (this is not the same as a website url!)
You will then be redirected to your Droplets Dashboard, you can click on your newly created Droplet and wait for it to finish setting up. Once it is setup, copy the IP Address (ipv4) and move to the next step!
Once you have setup your VPS and you have the IP address you can use to access it, open up your command prompt interface for your system. In my case, I have a Mac and I will be using iTerm (similar to Terminal, but for l33t professionals ;P). All lines beginning with #
are code comments and should not be run. Everything else can be copied and pasted to be executed on your VPS.
# ssh -i PATH_TO_SSH_KEY USER@IP_ADDRESS`
# `-i` Tells your computer to use the SSH Key you specify
# `USER` Is the username you can use to access your VPS
# `IP_ADDRESS` Is the IP address of your VPS
ssh -i ~/.ssh/id_rsa root@127.0.0.1
# Update your Ubuntu software package manager
sudo apt-get update
# Install dependencies for building headless obsidiand
sudo apt-get install -f -y build-essential autoconf automake git g++ libtool make unzip wget qt5-default qt5-qmake qtbase5-dev qtbase5-dev-tools libqt5webkit5 libqt5webkit5-dev libqt5qml5 libqt5quickwidgets5 qml-module-qt-labs-settings qtdeclarative5-dev-tools qttools5-dev-tools libboost-all-dev libssl-dev libdb++-dev libdb5.3++-dev libdb5.3-dev libminiupnpc-dev libqrencode-dev libprotobuf-dev
# Setup the system SWAP memory usage to make sure we have enough memory
# to get through obsidiand creation later on and libsodium installation.
# More info: https://support.rackspace.com/how-to/create-a-linux-swap-file/
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
sudo mkswap /var/swap.img
sudo chmod 600 /var/swap.img
sudo swapon /var/swap.img
# Create a temporary folder to download libsodium, another dependency
mkdir ~/tmp
cd ~/tmp
# Download libsodium 1.0.14 into the current tmp directory and unzip it
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.14.tar.gz
tar -xvzf libsodium-*
# Configure libsodium
cd libsodium*
./configure
# Prepare libsodium to be installed and install it
# (this takes a little while...)
make
make check
sudo make install
sudo ldconfig
# Cleanup libsodium temporary folder
cd ~
rm -rf tmp/
# Setup Obsidian directory and config
# txindex=1/0 is for setting specialized indexing; not normally needed
# rpcuser, rpcpassword, rpcport are OPTIONAL... They are for communicating
# with your obsidian VPS remotely or locally.
mkdir -p ~/.obsidian && touch $_/obsidian.conf
config=~/.obsidian/obsidian.conf
echo "server=1" >> $config
echo "txindex=0" >> $config
echo "rpcuser=me" >> $config
echo "rpcpassword=123" >> $config
echo "rpcport=8332" >> $config
# Download Obsidian-QT Git Repo and go to the src/ directory
mkdir ~/github
cd ~/github
git clone https://github.com/obsidianplatform/Obsidian-QT.git obsidian-qt
cd obsidian-qt/src
# Build the obsidian executable file with all processors available
# This will take a *very long time* depending on how many processors
# (CPU cores) you have available...
NPROC=$(nproc)
make -j$NPROC -f makefile.unix
# Finally, we will move the created file into a global folder
sudo cp obsidiand /usr/bin/obsidiand
Hey you've made it this far! If everything was successful you can now run obsidiand
on your VPS to begin running the Obsidian-QT wallet headless! But before you do that, and begin staking there are some commands you should run first, and I should also explain how to run your Obsidian-QT wallet in the background (a background process). Please be aware that it may take some time depending on your connection and how big the blockchain is for you to catch up and download everything.
After you run obsidiand
or obsidiand -daemon
for the first time you need to encrypt your wallet for proper wallet/staking setup. The command to setup is obsidiand encryptwallet <PASSWORD>
where the password can be anything you'll remember as you'll need this to unlock your wallet for staking or exporting private keys. After you run that command you are told that the server is stopping, your wallet has been setup properly, and you can continue using obsidiand.
user@SERVER:~# obsidiand -daemon
user@SERVER:~# Obsidian server starting
user@SERVER:~# obsidiand encryptwallet SECRET_PASSWORD
wallet encrypted; Obsidian server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.
user@SERVER:~# obsidiand -daemon
Now that your obsidiand
process is running and your wallet is setup you can now generate your first ODN address!
obsidiand getaccountaddress 0
This will output a generated ODN address and assign it to an account ID of 0. The account ID is used for some Obsidiand commands, but otherwise don't worry about it. You can generate multiple addresses and they can all be associated to account ID 0. You can view addresses stored in your wallet with obsidiand listaddressgroupings
though your generated address may not show up until you've received a transaction. I always recommend sending a test transaction of a couple ODN to any new wallet to confirm everything is working before you send larger amounts.
The amount of ODN you have stored in your wallet/address needs to be confirmed 100 times before that balance can begin contributing to the Proof-of-Stake protocol that Obsidian runs on. You may have noticed that after sending ODN to your wallet and unlocking your wallet for staking that obsidiand getstakinginfo
may show false
next to the staking
property:
user@vps:~# obsidiand getstakinginfo
{
"enabled" : true,
"staking" : false,
"errors" : "",
...
}
This means that your ODN balance has probably not been confirmed enough times yet on the network. To view how many confirmations your incoming transactions are currently at, you can use obsidiand listunspent
which will display a list of transactions and metadata about each one, including total confirmations.
user@vps:~# obsidiand listunspent
...
[
{
"txid" : "xxx",
"vout" : 1,
...
"confirmations" : 14,
"spendable" : true
}
]
Now that you can use obsidiand
on your VPS there are numerous commands you can send using that executable while your server is running. For a full list, simply enter obsidiand help
which will output a list of commands available to you. I'll review a couple important ones.
To start Obsidian-QT in the background, just pass the -daemon
flag when you run obsidiand
normally.
obsidiand -daemon
To unlock your wallet for staking, you will need to run the proper command and pass the correct information. The command below will unlock my wallet for staking for the next 999,999 seconds.
# obsidiand walletpassphrase WALLET_PASSWORD <TIME_SECONDS> <STAKING=true>
obsidiand walletpassphrase mrcoolguyjpeg123 999999 true
obsidiand getinfo
obsidiand getstakinginfo
obsidiand getmininginfo
So if there comes a time you'd like to export your address and/or wallet you can do so either through a simple copy of the wallet.dat
file or by exporting your address and the associated private key. I'll review each method below.
To export your wallet locally on your VPS, all you need to do is run the cp
command to copy your wallet somewhere else, like your VPS user's desktop:
sudo cp ~/.obsidian/wallet.dat ~/wallet.dat
Alternatively, you can use a protocol known as scp
to copy a file from your remote VPS to your local machine.
#scp -i PATH_TO_SSH_KEY USER@VPS_IP:PATH_TO_WALLET.DAT LOCAL_MACHINE_PATH
scp -i ~/.ssh/id_rsa root@website.com:/odnuser/.obsidian/wallet.dat ~/Desktop/backups
To export your private key you'll first need to know which addresses you have stored in your wallet which can be done by running obsidiand listaddressgroupings
.
Once you have the address you would like to export the private key for figured out, you'll need to unlock your wallet again. You might have already done so for staking, but unlocking your wallet for exporting a private key and for staking are two different actions. As such, you will need to re-enable staking after you finish exporting your private key!.
# The below command will unlock your wallet for 600 seconds, not for staking!
obsidiand walletpassphrase SUPER_SECRET_PASSPHRASE 600
Now that the wallet is unlocked, you can run obsidiand dumpprivkey <ODN Address>
to export the private key for your chosen public key / ODN address. Don't forget to unlock your wallet again for staking afterwards!
obsidiand walletpassphrase SUPER_SECRET_PASSPHRASE 999999 true
I'm currently working on some fun projects with the Obsidian Team, as well as a personal RnD project to display information about your node status via a website interface. After some more polishing and fine-tuning, this project should be open sourced and you can set it up yourself! Have a sneak peak here.
Feel free to reach out to the Obsidian Team, or me specifically (@Pixxl) in the Slack for help and questions! Additionally, if you have some feedback or suggestions on how I can improve this guide, please let me know! I am in the process of creating a video which will be added to YouTube sometime soon.
If you are feeling generous I appreciate any tips you send my way! They will help pay for the relentless amount of caffeine I consume, and keep me up coding through the night.
XKhXakF3mM9cvtWniRQteyAV961WCgBpx3
0xf4AC2333D03c96Ef0beA27d37ac3c73935590Dd9
1Pg85SxzJhujpYe1TZiMDuMb8Rn99PmAa7
LbJijfPg7JsrtW5zfeLv8QHoh5x5jkcy7V
Obsidian (ODN) is Published and supported by Obsidian Platform Ltd. ---
Learn more about the next evolution of Obsidian, ODIN Blockchain. A human-centered, privacy focused blockchain platform.