create account

[Guide]: Setting up a Muse Witness Server by dimitrisp

View this thread on: hive.blogpeakd.comecency.com
· @dimitrisp · (edited)
$32.31
[Guide]: Setting up a Muse Witness Server
<center>![](https://steemitimages.com/DQmYfmMg8XFGj3NJnkVso47E9d8cUvFQsp5N1XcxzZD5VLn/image.png)</center>

***If you want to learn more about Muse Blockchain, [click here!](http://museblockchain.com/)***

---

HF1 of the Muse Blockchain is now around the corner! How about a guide to set up your own witness server? Parts of this guide were taken from the Muse Blockchain github page, some other parts were taken from @roelandp's instructions on Muse Slack and some other parts are my own while setting up my witness. ***Note: There are more optimal ways to config your witness. I'm writing this guide using a logical way, so it may take you a couple of minutes longer and a few more restarts.***

***Mistakes were made! :P I updated the rpc-endpoint part of the post, so take a look***

## Requirements

You need a big server to make it future proof. I would suggest getting one with at least 16GB of RAM. Right now HDD/CPU is somewhat irrelevant, but my server has a Quad Core Xeon L3426 @ 1.8Ghz and 2x1TB 15k Drives in RAID1. Of course, you need a great network speed with low latency! 

You can get a VPS for starters, to familiarise yourself. You can even keep this VPS in production if you have dedicated CPU cores, but contact your provider first!

Also, do not log in as root! Disable root logins, change SSH port and make your server as secure as possible (if you don't know how, [read my Basic Server Security](https://steemit.com/tutorial/@dimitrisp/servers-101-basic-server-security-part-1) series)

## Operating System

Because we need a system that we will not be reformatting every now and then, we need a linux distro with long time security updates. Right now the way to go is Ubuntu 16.04 (for me. if you are familiar with rolling release distros, that's the way to go!)

## Installing the needed packages

We will be compiling the Muse Blockchain Daemon (`mused`), that will be syncing & signing the blocks, so we have to install a basic set of utilities.

Let's start with updating our system to make sure we are 100% up to date!

```
sudo apt-get update
sudo apt-get upgrade
```

Then we install the basic set of utilities we will need to compile everything!

```
sudo apt-get install build-essential autotools-dev automake autoconf libtool make cmake checkinstall realpath gcc g++ clang flex bison doxygen gettext git qt5-default libqt5svg5-dev libreadline-dev libcrypto++-dev libgmp-dev libdb-dev libdb++-dev libssl-dev libncurses5-dev libboost-all-dev libcurl4-openssl-dev python-dev libicu-dev libbz2-dev screen
```

Ubuntu 16.04 comes with an incompatible version of BOOST (libboost), which will be installed while running the previous command. As soon as the installation finishes, we will remove it, and install a compatible version (which is 1.60).

## Installing a compatible BOOST version (1.60)

First, we remove the old libboost version:

```
sudo apt-get remove libboost-all-dev
sudo apt-get autoremove
```

and then we download and compile the one we want:

```
mkdir -p ~/dev/third-party
cd ~/dev/third-party
rm -rf boost_1_60_0* boost-1.60.0*
wget https://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz
tar xvf boost_1_60_0.tar.gz
mkdir boost-1.60.0_prefix
cd boost_1_60_0
export BOOST_ROOT=$(realpath ../boost-1.60.0_prefix)
./bootstrap.sh --prefix=$BOOST_ROOT
./b2 install
cd ..
rm -rf boost_1_60_0 boost_1_60_0.tar.gz
```

This will take a while, so go grab a cup of coffee or tea.

## Preparing the blockchain code

We have installed `git` on the first step and we will now use it to download the blockchain source code:

```
git clone https://github.com/themuseblockchain/Muse-Source.git --branch HF_1
```

*Notice the HF_1 at the end. We will install the HF_1 version of Muse Blockchain. If we don't specify a branch, we will get the previous version*

As soon as the source code is downloaded, we need to download all the dependencies. It's not hard, it's 2 commands for you:

```
cd Muse-Source/
git submodule update --init --recursive
```

When it finishes, we need to make a change in the source of a dependency. It took me a while to get this right the first time (because I couldn't find the file :P ), but it's easier than it seems.

```
nano libraries/fc/vendor/websocketpp/websocketpp/transport/asio/endpoint.hpp
```

Now, locate this line (it's on line 38):

```
#include <websocketpp/common/functional.hpp>
```

and just above it add the following line:

```
#include <websocketpp/common/asio.hpp>
```
<br />
Then locate this line (it's on line 95):

```
, m_listen_backlog(0)
```

and change it to read like this:

```
, m_listen_backlog(lib::asio::socket_base::max_connections)
```

Save and exit.

## Compiling & configuring the Muse Blockchain source

Compile the code running these two lines:

```
cmake -DBOOST_ROOT="$BOOST_ROOT" -DBUILD_MUSE_TEST=OFF -DENABLE_CONTENT_PATCHING=OFF -DLOW_MEMORY_NODE=ON -DCMAKE_BUILD_TYPE=Release .
cmake --build . --target all -- -j$(nproc)
```

*You need at least 4GB of RAM to make this happen! You've been warned!*

Once again, it will take a while (a lot longer than in the Boost section).

Now, start the muse daemon to create the default config file:

```
cd programs/mused/
./mused
```

in a couple of seconds, just stop the daemon (by pressing Control+C). Now, open the config file:

```
nano witness_node_data_dir/config.ini
```

and at the top paste these lines:

```
# Muse Blockchain Seed Nodes
seed-node = muse.cervantes.one:33333
seed-node = 138.197.68.175:33333
seed-node = muse.roelandp.nl:33333
seed-node = muse-seed.altcap.io:33333
seed-node = muse.riverhead.ltd:33333
seed-node = 45.76.192.171:33333
seed-node = 104.199.134.87:33333
seed-node = seed.muse.blckchnd.com:33333
seed-node = muse-seed.lafona.net:33333
seed-node = 116.62.121.169:33333
seed-node = muse.thetimsaid.com:33333
seed-node = muse.agoric.systems:33333
seed-node = 45.79.206.79:33333
seed-node = 88.198.90.17:33333
seed-node = muse-seed.pt-kc.net:33333
seed-node = seed.musenodes.com:33333
seed-node = 5.9.18.213:33333
```
*List taken from [MuseNodes.com](http://status.musenodes.com/)*

Also, locate these lines:

```
# Endpoint for websocket RPC to listen on
# rpc-endpoint =
```

and change them to read like this:

```
# Endpoint for websocket RPC to listen on
rpc-endpoint = 127.0.0.1:8090
```
(find a local IP of your server, and replace 127.0.0.1 with it, although in 99% of the cases this will work)

save and exit.

## Starting up Mused

We now have to start mused to sync the blockchain before configuring our witness details. We will be using "screen" to make it run even after we close our terminal instance and also while we work on our server. Issue these 2 commands one at a time (don't copy/paste altogether to save time, you may not have the result we need)

```
screen
./mused
```

When you get to the point where a message like this appears (the blocks number will be different), your witness server is fully synced:

> 1635731ms th_a  main.cpp:186  main  ] Started witness node on a chain with 2466202 blocks.

Press control+a and then control+d to detach the screen instance and allow the muse daemon run in the background while we add the final touches.

## Configuring a wallet

Right now, if you followed my instructions line by line, you are in folder `~/dev/third-party/Muse-Source/programs/mused`. Issue these commands to start a cli wallet instance:

```
cd ../cli_wallet
./cli_wallet
```

You will see lines like this coming up:

> Logging RPC to file: logs/rpc/rpc.log
> Starting a new wallet
> 2559524ms th_a       main.cpp:159                  main                 ] wdata.ws_server: ws://localhost:8090
> 2559525ms th_a       main.cpp:164                  main                 ] wdata.ws_user:  wdata.ws_password:
> 2559526ms th_a       websocket_api.cpp:88          on_message           ] message: {"id":1,"result":true}
> 2559527ms th_a       websocket_api.cpp:88          on_message           ] message: {"id":2,"result":0}
> 2559528ms th_a       websocket_api.cpp:88          on_message           ] message: {"id":3,"result":2}
> Please use the set_password method to initialize a new wallet before continuing
> 2559529ms th_a       thread.cpp:95                 thread               ] name:getline tid:140496290703104
> new >>>

You should password-protect your wallet, as it will be holding all your private keys.

```
set_password mysupersecurepassword
unlock mysupersecurepassword
```
*Everytime we open our cli_wallet, we will have to type the "unlock ..." line to gain access, so don't forget this password*

Now, type `suggest_brain_key` and you'll get this as a reply:

> suggest_brain_key
> {
>   "brain_priv_key": "REVEL TAYER DELIME JOYHOP UNIPOD SCALENE RADISH ANHIMA ROBERD KUTCHA BINGE HAGBORN FIBERED SITFAST CREPY INRING",
>   "wif_priv_key": "5JtGRN5gAdPAdpcqF76Ux1KD46a3cNWQYfkEqXY1qdsHQdFUfY7",
>   "pub_key": "MUSE7p3JEw6Zu7rRJjro62AQKEa2TgeQEfLiMAFo45f9QMMqTAtjUk"
> }

Keep those somewhere safe, you'll need them!

Now, go to your Muse wallet at [https://wallet.museblockchain.com](https://wallet.museblockchain.com), go to "Permissions" tab and get your active private key (starts with a 5...)

and on your cli_wallet import the key:

```
import_key 5...
```

Also, I had to import the "wif_priv_key" from the "suggest_brain_key" to make it work properly. Do it using the "import_key" command.

now type `list_my_accounts`. You should be seeing a few lines, and one stating your Muse blockchain username:

> dimitrisp 0.000000 2.28.0 127669.031756 2.28.1 0.000000 2.28.2

You were successful in creating your witness wallet and associating with your blockchain account!

## Final configuration

Now we have to make 2 final changes on our config.ini file. Follow these commands:

```
cd ../mused
nano witness_node_data_dir/config.ini
```

and locate these lines:

```
# name of witness controlled by this node (e.g. initwitness )
# witness =

# WIF PRIVATE KEY to be used by one or more witnesses or miners
# private-key =
```

On "witness" add your username at the end inside quotes. On private-key, enter the "wif_priv_key" from the "suggest_brain_key" command. Also, remove the hashtags from the beginning of those lines. So, in my example they have to look like this:

```
# name of witness controlled by this node (e.g. initwitness )
witness = "dimitrisp"

# WIF PRIVATE KEY to be used by one or more witnesses or miners
private-key = 5JtGRN5gAdPAdpcqF76Ux1KD46a3cNWQYfkEqXY1qdsHQdFUfY7
```

Save and exit nano.

## Restarting the Muse Daemon to re-read our changes

We have the daemon running in the background. Now we need to restart it. First we have to attach our terminal to the screen instance our mused is running:

```
screen -r
```

and then press control+c to stop it. Then, we have to start it again:

```
./mused
```

As soon as you see 

> ------------------------------------------------------
> initminer public key: MUSE75fnamVHSMV67JaRPSKbCr8vDwGoCEDeDky8e78JJbNEYcbqv1
> chain id: 1459ad9469d36835dbfda0d84ea7700fb6a3ee767c86c4f75de22fa0c40f6c61
> ------------------------------------------------------
> ...
> 87002ms th_a       witness.cpp:94                plugin_initialize    ] _witnesses: ["dimitrisp"]
> 87026ms th_a       witness.cpp:109               plugin_initialize    ] witness plugin:  plugin_initialize() end
> 87026ms th_a       main.cpp:169                  main                 ] starting node
> ...
> 88574ms th_a       witness.cpp:121               plugin_startup       ] Launching block production for 1 witnesses.
> 88574ms th_a       witness.cpp:132               plugin_startup       ] witness plugin:  plugin_startup() end
> ...
> 88574ms th_a       main.cpp:186                  main                 ] Started witness node on a chain with 2466885 blocks.

If you are not seeing block syncing messages, you are good to go! Control+A and then Control+D to send "screen" to the background.

## Running update_witness

Now that everything is good to go, we should announce our intend to witness blocks to the network. We'll do it through cli_wallet (that's what I meant "more optimal ways". the final few steps could be "compressed", but I like having them seperated, more clarity for my OCD!)

```
cd ../cli_wallet
./cli_wallet
unlock mysupersecurepassword
```

Before we enter the command, let's take a look:

```
update_witness "username" "witness_url" "pub_key" {} true
```

this is the most basic format of the command. Substitute "username" with your username, "witness_url" with a page where people can learn more about you, and "pub_key" with the pub_key from "suggest_brain_key". In this example, the final format would be:

```
update_witness "dimitrisp" "https://steemit.com/muse/@dimitrisp/witness-declaration-dimitrisp-witnesses-muse-blockchain" "MUSE7p3JEw6Zu7rRJjro62AQKEa2TgeQEfLiMAFo45f9QMMqTAtjUk" {} true
```

## Get witness votes

You now need people to give you witness votes from the Muse Blockchain Wallet! As soon as you get your votes, you should be signing blocks!

---

If you come across any errors, feel free to let me know, or ask the awesome people on the Muse Slack (there's a link in the Muse Wallet)

---

Other useful links:

Check your witness rank [at muse-db.com](https://muse-db.com/witnesses)
Create your Muse Wallet [at wallet.museblockchain.com](https://wallet.museblockchain.com)

## Final step: Vote for me!

If you are a MUSE stakeholder or a MUSE witness and you found this guide helpful please consider casting your vote for **dimitrisp**

If you are voting in cli_wallet, `vote_for_witness YOURACCOUNT dimitrisp true true`

[You can read my Muse Witness declaration here](https://steemd.com/muse/@dimitrisp/witness-declaration-dimitrisp-witnesses-muse-blockchain)

---

Also, please consider <a href="https://steemit.com/~witnesses" target="_blank">voting me, dimitrisp, for a witness</a> here on Steemit too!

[You can read my Steemit witness declaration here](https://steemit.com/witness-category/@dimitrisp/witness-declaration-of-dimitrisp)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 6 others
👎  
properties (23)
authordimitrisp
permlinkguide-setting-up-a-muse-witness-server
categorymuse
json_metadata{"tags":["muse","blockchain","witness-category","development","dpos"],"users":["roelandp"],"image":["https://steemitimages.com/DQmYfmMg8XFGj3NJnkVso47E9d8cUvFQsp5N1XcxzZD5VLn/image.png"],"links":["http://museblockchain.com/","https://steemit.com/tutorial/@dimitrisp/servers-101-basic-server-security-part-1","http://status.musenodes.com/","https://wallet.museblockchain.com","https://muse-db.com/witnesses","https://steemd.com/muse/@dimitrisp/witness-declaration-dimitrisp-witnesses-muse-blockchain","https://steemit.com/~witnesses","https://steemit.com/witness-category/@dimitrisp/witness-declaration-of-dimitrisp"],"app":"steemit/0.1","format":"markdown"}
created2017-11-07 17:13:51
last_update2017-11-07 17:52:06
depth0
children7
last_payout2017-11-14 17:13:51
cashout_time1969-12-31 23:59:59
total_payout_value24.448 HBD
curator_payout_value7.865 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length14,001
author_reputation75,800,974,934,104
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id19,710,973
net_rshares15,763,587,717,668
author_curate_reward""
vote details (71)
@btsbear ·
do it
properties (22)
authorbtsbear
permlinkre-dimitrisp-guide-setting-up-a-muse-witness-server-20171107t185023932z
categorymuse
json_metadata{"tags":["muse"],"app":"steemit/0.1"}
created2017-11-07 18:50:24
last_update2017-11-07 18:50:24
depth1
children0
last_payout2017-11-14 18:50:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5
author_reputation-623,156,020,679
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id19,718,197
net_rshares0
@mdirfanarju ·
thanks
👍  
properties (23)
authormdirfanarju
permlinkre-dimitrisp-guide-setting-up-a-muse-witness-server-20171220t195428575z
categorymuse
json_metadata{"tags":["muse"],"app":"steemit/0.1"}
created2017-12-20 19:54:51
last_update2017-12-20 19:54:51
depth1
children0
last_payout2017-12-27 19:54:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6
author_reputation360,263,614,093
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id24,405,039
net_rshares62,548,988
author_curate_reward""
vote details (1)
@raymonjohnstone ·
$0.03
Good guide, I am curious however why the dependency for websocketio was changed in this guide and hasnt needed to be in the past.
👍  
properties (23)
authorraymonjohnstone
permlinkre-dimitrisp-guide-setting-up-a-muse-witness-server-20171113t182544436z
categorymuse
json_metadata{"tags":["muse"],"app":"steemit/0.1"}
created2017-11-13 18:25:45
last_update2017-11-13 18:25:45
depth1
children3
last_payout2017-11-20 18:25:45
cashout_time1969-12-31 23:59:59
total_payout_value0.024 HBD
curator_payout_value0.008 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length129
author_reputation14,611,383,737,584
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,279,643
net_rshares16,332,218,554
author_curate_reward""
vote details (1)
@dimitrisp ·
$0.05
I took that part from @roelandp's instructions. I tried to "ignore" it but it wouldn't compile for me (I was trying to avoid searching for the file, because reasons :P)

After changing the source it went through correctly. It might have been random though, I can't tell..
👍  
properties (23)
authordimitrisp
permlinkre-raymonjohnstone-re-dimitrisp-guide-setting-up-a-muse-witness-server-20171113t193024062z
categorymuse
json_metadata{"tags":["muse"],"users":["roelandp"],"app":"steemit/0.1"}
created2017-11-13 19:30:27
last_update2017-11-13 19:30:27
depth2
children2
last_payout2017-11-20 19:30:27
cashout_time1969-12-31 23:59:59
total_payout_value0.040 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length271
author_reputation75,800,974,934,104
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,285,014
net_rshares25,743,947,583
author_curate_reward""
vote details (1)
@raymonjohnstone ·
$0.03
Yea I didnt need it for my compile you might be linking boost wierd that might be why.
👍  
properties (23)
authorraymonjohnstone
permlinkre-dimitrisp-re-raymonjohnstone-re-dimitrisp-guide-setting-up-a-muse-witness-server-20171114t001708418z
categorymuse
json_metadata{"tags":["muse"],"app":"steemit/0.1"}
created2017-11-14 00:17:09
last_update2017-11-14 00:17:09
depth3
children1
last_payout2017-11-21 00:17:09
cashout_time1969-12-31 23:59:59
total_payout_value0.020 HBD
curator_payout_value0.007 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length86
author_reputation14,611,383,737,584
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,304,040
net_rshares14,359,357,338
author_curate_reward""
vote details (1)
@snow-airline ·
$0.03
Thank you so much! I updated my muse node!
👍  
properties (23)
authorsnow-airline
permlinkre-dimitrisp-guide-setting-up-a-muse-witness-server-20171114t070144388z
categorymuse
json_metadata{"tags":["muse"],"app":"steemit/0.1"}
created2017-11-14 07:01:45
last_update2017-11-14 07:01:45
depth1
children0
last_payout2017-11-21 07:01:45
cashout_time1969-12-31 23:59:59
total_payout_value0.027 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length42
author_reputation48,058,030,079,758
root_title"[Guide]: Setting up a Muse Witness Server"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id20,329,315
net_rshares14,025,418,795
author_curate_reward""
vote details (1)