How to set up your Witness server with MIRA?
***
Hello there, as you may or may not know the server requirements for hosting a witness server is growing very fast. To combat this, with the recent hardforks to the blockchain MIRA was introduced.
MIRA caches the data on RocksDB files rather than the random acces memory, RAM. Which means you will require a higher storage with fast R/W speeds like SSDs for example. Instead of 64 GB of RAM.
Right now, as of today (**02.04.2020**) the **absolute minimum** requirements for a MIRA node is 8 Gigabytes of RAM, 400GB SSD Storage, 4 cores, 100 Mbps DL/UL speed.
The **recommended** specifications for a MIRA witness/seed node is 32 Gigabytes of RAM, 500GB SSD Storage, 4 cores, 1 Gbps DL/UL speed.
Block logs currently take about **258 GB** of space while RocksDB takes about **37 GB**.
![](https://i.imgur.com/5KTmBrV.png)
Witnesses are of course, crucial to the longevity, stability and decentralization of the chain. If you wan to create a witness server and become a witness, good for you and thank you for volunteering! Managing servers and keeping tabs on them is no easy feat. Lets not forget to mention, cheap.
### Start Setting Up Your Witness On A Fresh Install [DIY]
So you have decided on setting up a witness server using MIRA. You have your server ready, freshly installed. Preferably Ubuntu or Debian, but that's just my taste.
For the setup, we will be using steem-docker made by someguy123 and RocksDB files provided by [Privex.io](privex.io)
Let's get started. Throughout this tutorial, I will be assuming you are `root`.
First, we have to install git so we can use `git clone` to get the necessary files from GitHub.
`apt install git -y`
Now, we clone the repository from GitHub.
`git clone https://github.com/someguy123/steem-docker.git`
Now that `git` has downloaded the repository to your server, we have to `cd` into the folder.
`cd steem-docker`
Next, we are going to use the custom-made script to install `docker` for us.
`./run.sh install_docker`
This will probably take a minute.
Next, we will be installing the necessary docker package.
`./run.sh install someguy123/hive:latest-mira`
Next, we will be setting up the .env for docker.
`nano .env`
```
DOCKER_NAME=witness
PORTS=
```
Paste these in the .env file and save it by pressing CTRL+X and then Y.
Next step is to download the block_log.
```
mkdir root/data/witness_node_data_dir/blockchain
cd root/data/witness_node_data_dir/blockchain
curl -fsSL http://files.privex.io/hive/block_log.lz4 -o - | lz4 -d - block_log
```
As the block_log is quite big, this is going to take anywhere from 20 minutes to several hours depending on the internet connection of your server.
After the block_log has been installed, we have to download the RocksDB files from Privex.io
For HIVE,
`rsync -av --progress --delete rsync://files.privex.io/hive/rocksdb/ /root/steem-docker/data/rocksdb/`
Now that our RocksDB is downloaded, we must generate a brain key for security.
```
cd root/steem-docker
./run.sh remote_wallet
suggest_brain_key
```
![](https://i.imgur.com/oP0tCAy.png)
This will generate a key pair for your witness. Copy the output and save it.
After generating your witness keys we must edit `config.ini` which is the main configuration for the witness server.
`nano root/steem-docker/data/witness_node_data_dir/config.ini`
On the first line, you will see `p2p-endpoint` we should comment this out as our goal is to make a witness server, if you are looking to host a seed node rather than a witness server, you can keep this on.
You can comment this out by putting a pound (#) in front of the line. So it should look like this,
`#p2p-endpoint = 0.0.0.0:2001`
Next, a few lines below that you will see,
`shared-file-size = 64G`
Please change this to your server memory, if your server has 16 gigabytes of RAM, change this to 16G and so on.
Next, scroll down until you see `witness` and `private-key` lines.
For the witness part, put in your username with "" it should look like this,
`witness = "deathwing"`
Next, for the private key put in your previously saved private key without any quotation marks.
`private-key = 5thisisyourpreviosulygeneratedprivatekey`
![](https://i.imgur.com/z8DDsT1.png)
Again, press CTRL+X and then Y to save the file and exit.
You are almost done!
Our next step is to replay the chain, this is going to take quite a long time as this process is single-threaded and can't take advantage of multi-core CPUs, so depending on your processors' single-thread performance, the amount of time it takes will vary. Very likely for it to take an hour if not more.
`./run.sh replay`
After the replay is complete, we can start our server and let it sync with the network.
`./run.sh start`
You can then use `./run.sh logs` to view the log output. It is very normal to see errors appearing here from time to time. You should check it every 20-30 minutes until you see something like this:
![](https://i.imgur.com/sCSVd8y.png)
When you start seeing these messages, you can press CTRL+C to leave the logs.
Now that our witness server is synced up and ready to go, we can update our witness account and broadcast it to the network. To do that, we need to run wallet.
`./run.sh wallet`
The wallet will prompt you to set a password.
```
set_password hunter2 (set your own password)
unlock hunter2
import_key 5yourwitnessaccountsactiveprivatekey
```
You can find your private key on PeakD - https://peakd.com/@yourusername/permissions
![](https://i.imgur.com/lCrGKoc.png)
Remember that for `import_key` you need to put in the private key of the account that will be witnessing on the chain **not** the one previously generated in this tutorial.
Now, we can update our witness and start our journey on supporting the stability, longevity and decentralization of the blockchain.
```
update_witness "WITNESSNAME" "WITNESSURL" "STMxxxxxxx" {"account_creation_fee":"3.000 HIVE","maximum_block_size":65536,"sbd_interest_rate":0} true
```
`WITNESSNAME` = Your Witness account.
`WITNESSURL` = Preferably, your witness announcement post.
`STMxxxxxxx`= Paste the key that we previously generated.
You can check **hiveblocks.com/@yourusername** now, if everything worked you should see a transaction like this;
![](https://i.imgur.com/1JoL29X.png)
Congratulations! You are now a witness. Thank you!
### I want to become a witness but I don't know a thing about servers!
Best way to become a witness in a situation like this is probably purchasing a pre-replayed witness node from [privex.io](privex.io) who provided both the scripts and files used in this tutorial. This option is the best for users who do not have a good server knowledge and want excellent customer support and during their journey on becoming a witness.
After you order your VPS-HIVE server from, you should receive a mail containing the information you need to connect and login to the server.
After you log in, what you have to do is first, switch from the user `ubuntu` to `root`, to do this type,
`su`
Then, we will be generating a key pair using
```
./run.sh remote_wallet
suggest_brain_key
```
then, edit the `config.ini` file with `nano data/witness_node_data_dir/config.ini` ![](https://i.imgur.com/6eJ7jfU.png)
then start the witness server with
`./run.sh start` wait for it to sync,
then run wallet with `./run.sh wallet` and update your witness as shown previously.
Let me know if you have any questions!
_____
post scriptum
![image.png](https://files.peakd.com/file/peakd-hive/deathwing/Y9KDqlV8-image.png)
Remember voting for witnesses is important. I would appreciate if you could vote for me.
Use Peakd's voting page by clicking [here](https://peakd.com/witnesses).
Use Hivesigner by clicking [here](https://deathwing.me/witness).
Thank you!
See: How to set up your Witness server with MIRA? by @deathwing