Create Sanctuary 2

From BiblePay Wiki
Revision as of 19:28, 25 December 2017 by Togoshigekata (talk | contribs)
Jump to: navigation, search

Step by step guide to create/setup a Sanctuary (Masternode) by Togoshigekata

UPDATED: 2017/12/20


2 machines with 2 separate IP addresses and 1,550,001 BiblePay coins

you are setting up a Sanctuary on a remote Linux cloud server (Sanctuary Wallet)
and storing BiblePay coins on a local Windows PC (Controller Wallet)

This is called a Cold setup, your coins are stored safely on your own machine in the controller wallet,
compared to a Hot setup, where the coins are stored on the remote server in the sanctuary wallet (not recommended)

Rob Original Guide:

Togo Notes:

Testnet Thread - Testing Sanctuaries

PART A - Controller Wallet (Windows)

On local/home Windows PC:

1. Download & Install latest version of BiblePay:

2. Run and Sync BiblePay

3. Send any needed BiblePay coins to your Controller Wallet
Wallet Menu >> File >>> Receiving Addresses

PART B - Rent Linux Cloud Machine

A. Research and Choose Cloud Provider (Vultr, AWS, Google, Azure, etc) and Create Account
B. Choose Machine to Rent (Recommend: Ubuntu 16.04, 2GB RAM [1GB RAM is okay if use Swap File])
C. Payment Method
D. Connect to it / SSH (Putty SSH Client for Windows)

Vultr $5/month (1 CPU 1GB RAM)
AWS $8.3/month (1 CPU 1GB RAM)

(NOTE: These next steps assumes using Vultr)

1. Create Account

2. Add Payment Information

3. Download & Install PuTTY (SSH Client):

4. OPTIONAL: Generate SSH Public/Private Keys

5. Deploy Instance

Instance Type: VC2
1. Server Location: Random
2. Server Type: Ubuntu 16.04 x64
3. Server Size: 1 CPU, 1024MB RAM, $5/mo (*Assuming using SWAP file later for more RAM)
6. SSH Key: Add and Select Public Key you added in Step #4
7. Serverhostname: Add unique name

6. Use Putty to Connect to Vultr Server
Enter IP Address, Port 22, Connection type SSH
You can add your private key file: Connection >> SSH >> Auth >> Browse
You can name and save your connection info: Session >> Saved Sessions >> Enter a Unique Name >> Save

PART C - Install Sanctuary Linux Wallet

1. Install BiblePay
Linux Install Guide:
NOTE: if server is 1GB RAM, before running last command "sudo make", set up the swap file in Step 1a.

1a. Swap File

 free #check if swap is 0
 dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
 mkswap /var/swap.img
 swapon /var/swap.img
 free #check if swap is 1024
 sudo make

Swap File References:

PART D - Run Sanctuary Linux Wallet

On remote Linux machine:

1. Run and Sync BiblePay

 cd home/yourusername/biblepay/src
 ./biblpayd -daemon

2. Close wallet:

 ./biblepay-cli stop
 #if BiblePay is stuck
 ps -ef #view processes and find BiblePay PID number, use in kill command
 kill PID

3. Run BiblePay:

 ./biblepayd -daemon

4. Check that blocks number matches home Windows Controller wallet

 ./biblepay-cli getinfo

PART E - Financing your Sanctuary (Masternode)

1. Generate private key on Sanctuary remote Linux machine

 ./biblepay-cli masternode genkey

(Store this as your SANCTUARY_PRIVATE_KEY)

2. Local Windows Controller Wallet - Show Proof of Coins

Create a unique name (SANCTUARY_NAME) for the address you will be storing your coins in
and send the required 1,550,001 coins to that address

2a. Create Masternode Coin Address with Label

Tools >> Debug Console

 getaccountaddress SANCTUARY_NAME 

this creates your SANCTUARY_ADDRESS


2b. Combine All Your Coins into One Address

File >> Receiving Addresses >> Right click Copy Address (this is your RECEIVING_ADDRESS)
Send all of your wallet coins to this one address

Tools >> Debug Console

   sendtoaddress RECEIVING_ADDRESS 777 "" ""


2c. Send Required Coins to Newly Created SANCTUARY_ADDRESS from step 2a

Enable Coin Control: Settings >> Options >> Wallet >> Click "Enable coin control features" checkbox >> Ok

Send >> Inputs >> Click Checkboxes of which Address(es) to Send Coins From

Send exactly 1550001 coins

NOTE: Fees are OK as long as you dont click the checkbox to Subtract fees. Fees are stored in a different vector
NOTE: Important thing is to make the amount exactly 1550001 and dont click instant send or any other options
NOTE: Coin Control will allow you to send coins from a specific address and not move coins you already set aside in other addresses

2d. Record Transaction Hash

Open the Explorer:
Record Latest Hash for your 1,550,001 deposit (TRANSACTIONHASH)

3. Wait for 7-8 or so confirmations (at 7 minute block rate, that will be around 1 hour)

4.a Controller Windows Wallet - Get TRANSACTIONHASH and INDEX from running this command:
Tools >> Debug Console

 masternode outputs

You will get a string that looks like this:

 "06e38868bb8f9958e34d5155437d009b72dff33fc28874c87fd42e51c0f74fdb" : "0",

The long string is your TRANSACTIONHASH, and the last number is the INDEX.

4.b Controller Windows Wallet - Edit masternode.conf:
Open File Explorer, Enter in address bar: %appdata%/biblepaycore and press Enter
Find and Right Click >> Edit masternode.conf
Add line below and Save:


SANCTUARY_NAME: The name/label that you set for your sanctuary address in step 2
SANCTUARY_PUBLIC_IP: Your sanctuary IP (Your sanctuary Linux VPS/Cloud machine IP)
SANCTUARY_PRIVATE_KEY: This is the private key that you placed in your remote configuration
TRANSACTIONHASH: This is the transaction hash for the transaction in which you got your 1550001 BBP deposited.
INDEX: This is the Index of your transaction for that address I'll show you how to get it in a bit.

NOTE: If you have multiple sanctuaries, should be able to add additional lines to masternode.conf

5. Controller Windows Wallet - Edit biblepay.conf:
Open File Explorer, Enter in address bar: %appdata%/biblepaycore and press Enter
Find and Right Click >> Edit biblepay.conf

Decide on "RandomUsername" and "RandomPassword" to use for RPC credentials
NOTE: Password must be Alphanumeric only! (Letters and Numbers only)
Add Lines below and Save:


NOTE: For the RPC Port, you can use whichever port you want, just make sure to open it in firewall in Step 7

6. Restart (Close and then Open/Run again) Windows Controller Wallet

7. Sanctuary Wallet Remote Linux Machine, Run Firewall/Port commands:

 sudo apt-get update
 sudo apt-get install ufw
 sudo ufw allow ssh/tcp
 sudo ufw limit ssh/tcp
 sudo ufw allow 40000/tcp
 sudo ufw allow 9998/tcp
 sudo ufw logging on
 sudo ufw enable
 sudo ufw status

8. Sanctuary Masternode Linux Wallet - Edit ~/.biblepaycore/biblepay.conf:

 cd ~/.biblepaycore
 vi biblepay.conf

(SANCTUARY_PUBLIC_IP: Public IP Address of Remote Linux Sanctuary Wallet)

9. Sanctuary Masternode Linux Wallet - Restart BiblePay:

 ./biblepay-cli stop
 #if BiblePay is stuck due to new password
 ps -ef #view processes and find BiblePay PID number, use in kill command
 kill PID
 ./biblepayd -daemon

10. Controller Windows Wallet - Start Sanctuary


 masternode list 

View Masternodes in your masternode.conf file

 masternode list-conf

(masternode was not in list but in list-conf and was in state MISSING)

Start your Masternode!

 masternode start-alias SANCTUARY_NAME 

NOTE: SANCTUARY_NAME is from Steps 2a and 4b
NOTE: Masternodes take a few minutes to sync
NOTE: If you have multiple masternodes should be able to start them all with: masternode start-many

Extra Commands for help and debugging:

 masternode help
 masternode debug

Show Masternodes Tab in Windows Controller Wallet

Settings >> Options >> Wallet >> Click "Show Masternodes Tab" checkbox >> Ok >> Restart BiblePay Wallet

11. Sanctuary Masternode Linux Wallet, Check Status:

 ./biblepay-cli masternode status
 ./biblepay-cli mnsync status

12. Wait about 1 - 2 Hours for Masternode Status to go from PRE_ENABLED to ENABLED

NOTE: Sometimes your own windows wallet may not show the correct masternode statuses, double check on a 2nd windows wallet to confirm

PART F - Watchman

How to install Watchman on the Wall

1. Clone & Install Watchman

 sudo apt update
 sudo apt -y install git python-virtualenv virtualenv
 cd ~/.biblepaycore
 git clone
 cd watchman
 virtualenv venv
 venv/bin/pip install -r requirements.txt

2. Run Watchman

 venv/bin/python bin/

NOTE: You want to see empty output from running the command

3. Setup Watchman in Cron:

 crontab -e

NOTE: You might be prompted to choose which text editor you want to use as default, I enter 3 for vim basic

Add this line:

 * * * * * cd /home/YOURUSERNAME/.biblepaycore/watchman && ./venv/bin/python bin/ >/dev/null 2>&1

NOTE: Replace YOURUSERNAME with the username where biblepay is stored: root, ubuntu, etc

NOTE: (If using vi, press i for insert mode, add the line at the end of the file
press ESC for command mode, type :wq to save and exit)

NOTE: If watchman is not running, Proof-Of-Service will fail and your node will report WATCHDOG_EXPIRED in the controller sanctuary list.
To verify watchman is running, run the command you typed in the crontab above as the actual user.
For example, if biblepay runs as user bible, login as bible, then copy the command from above like this:

 cd /home/YOURUSERNAME/.biblepaycore/watchman && ./venv/bin/python bin/

Without the trailing /dev/null 2>&1. Run the command.
Verify the output is empty. If so, you have successfully configured watchman!

NOTE: You could also potentially use this format and replace /home/YOURUSERNAME/ with ~/

 cd ~/.biblepaycore/watchman && ./venv/bin/python bin/



Block Reward Breakdown:
10% Charity
5% IT
2.5% PR (Public Relation campaigns)
2.5% P2P (orphan letter writing, Pay To Preach, Pay to be a Priest, FAQ writers, Social Media functions)
40% Miners
40% Sanctuaries (Masternodes)

Emission Schedule:
For Example, assuming 70 million BBP coins are minted January 2018, there will be:
7 million BBP for Charity fund
3.5 million BBP for IT fund
1.75 million BBP for PR fund
1.75 million BBP for P2P fund


1. Create a Forum Post of the Proposal in the BiblePay Forum - Production Proposal Section:

2. Create a Proposal on the BiblePay Pool website:
Left sidebar >>> Click Governance Tab >>>
Click Add Proposal >>> Fill in Details Below >>> Save

- Proposal Name
- Funding Receiving Address (BiblePay address)
- Proposal Amount (How many BiblePay coins needed)
- Discussion URL (BiblePay Forum Post link)

NOTE: With Windows Wallet, you can find your Receiving Address by clicking File >> Receiving Addresses
You can also create new addresses to use and can label them

View next Superblock and Check Budget:

 superblockbudget 24600

A proposal will need a net 10% of Yes votes to be approved



To see Proposals login to the pool website:
and on left sidebar click "Governance" >> "Proposal List"

You can right click a proposal and click "Copy Vote for Proposal" and paste this directly into your command line to vote

View proposals:

 gobject list

NOTE: Copy the Hash value, you will need it in the next command to vote on it

Vote yes or no with a sanctuary:

 gobject vote-alias Hash funding yes SANCTUARY_NAME

Vote yes or no with many sanctuaries

 gobject vote-many Hash funding yes

Check that the YesCount or NoCount has incremented

 gobject list

See all gobject commands:

 gobject help



Show Masternodes Tab in Windows Wallet
Settings >> Options >> Wallet >> Show Masternodes Tab >> OK

How to Edit Files on Linux
I like to use vi, example:

 vi filename #to open the file
 i #to go into edit mode and be able to insert characters
 ESC #to leave edit mode and go into command mode
 :wq #to save (write) the file and exit (quit) vi 

Port 40000 is biblepay-prod, while 40001 is biblepay-testnet


BiblePay Linux Guide:

Rob Original Sanctuary Guide:

Testnet Thread - Testing Sanctuaries

Togo Sanctuary Notes:

Watchman Guide:

Dash Masternode Guides:

VIVO Masternode Guide:

More References:


QUESTION: How to deal with fees when sending? Does amount have to be 1,550,001 exactly?
Fees are OK as long as you dont click the checkbox to Subtract fees. Fees are stored in a different vector, so the vout is still 1,550,001.

QUESTION: Are we sending coins to ourself?
It is OK to send the balance to yourself or from another node (I tested both).
The important thing is to make the amount exactly 1550001 and dont click instant send or any other options.

If you are creating a Hot wallet (IE funds live on the Sanctuary) you would send the 1,550,001 to the Sanctuary wallet.
Now that we know cold wallets work, the recommended way is to send the funds To the cold wallet (IE the home controller wallet).

QUESTION: Does the Masternode actually hold coins?
In a Hot masternode scenario, the masternode holds the coins, otherwise the masternode wallet is empty.
Biblepay puts a lock on the escrow when the masternode starts.

QUESTION: What are the rpc settings doing? Can the Home Wallet now control the Linux Wallet? or reverse of that?
These config settings only allow the home controller wallet to start and stop the masternode. This is not only to safeguard your eventual 1,550,001 BBP escrow if it goes up in value (to prevent vultr host from stealing it), but also because of Proof-Of-Service. Dash has created POSE, which monitors how much uptime your masternode has stayed up and eventually becomes important if we have more than about 800 masternodes, these nodes start falling to the back of the payment queue and do not get paid if they need restarts. When they fail and need restarted, it is easy for home computer controller wallet to start the masternode again.

QUESTION: Where does Watchman fit in the process? What is Watchman? what is it doing?
Peace be still and bear with us, why do we have to have yet another piece of software called Watchman-on-the-wall?

Watchman implements proof of service and one major superblock budget feature.
The watchman requires Pro-players for Sanctuaries and shuns the lackadaisical nodes [such as one that is on a video game PC that is rebooted].
With watchman, every node has to send a watchdog alert every couple hundred blocks and prove their static IP and how long they been online.
This means as competition heats up you really have to have provided good service to stay in the payment queue.
The other thing watchman does is collects a database of gobjects. Governance objects are stored in tables. Votes are kept.
This feature allows internal deleting governance objects by masternode.

The most important thing it does is when we create a very complicated budget that got approved from a proposal, it creates a text file of budget items for the superblock. Without it the superblocks dont work properly.

The code developed and ported to Watchman was created for a modular design, in case the sanctuary needs to upgrade the superblock code side and NOT the entire network (to upgrade the wallet). We inherited this design and embrace it.

QUESTION: Sanctuaries are only Linux? Or will there be a Windows solution to this?
They are linux only, primarily because the proof-of-service software we use only runs on linux.
No windows solution is currently scheduled, unless our stratis Proof-of-concept is really well received.
If it is, Ill port watchman-on-the-wall to c# so that then you can run a Pose-enabled biblepay node in c#.

QUESTION: Is a static IP required?
Static ip is required, thats primarily why we recommend web hosts for this.
If your node fails to vote when its asked to you lose your sanctuary payment.

QUESTION: Is much bandwidth required ? Any calculations on this?
Very low bandwidth is required, only 10% more than a normal node,
Except since you are a full PoSE node you would be servicing inbound connections, however these are split among all the nodes.
Im running one with 1023 connections and its taking 40kbps so its pretty low.
You can see the network graph in the qt wallet btw (Tools | Network Traffic).

QUESTION: Is it OK to run a masternode on a dedicated machine with a high speed internet connection?
You can run your own sanctuary even on home dynamic IP, as long as its on linux running watchman on the wall, however you have two big risks:
1) If you do go down, you will lose your sanctuary payment, and if you fall out of the payment queue it might take 24 hours to get back in.
2) If your dynamic IP changes, you will have to re-create your whole sanctuary! The Escrow is tied to the static IP. <- This is a real pain..

QUESTION: How long will masternode with 40 GB storage last?
Our blockchain size is only 17 Megs right now with 21000 blocks,
with our small blockchain size and 7 minute blocks, we should technically sync fast and stay small for a long time


- double check Original Guide, My Notes and the whole Sanctuary Testnet thread
- fill out more of FAQ