---
# System prepended metadata

title: Untitled

---

<center><img src="https://images.hive.blog/p/HuuaCwcKuiEjNgLb5Q7HbtUvB1HEHgck8hUkQMB4bFSJaxwFsYXGx7N9qtgEvLdGaoY?format=match&mode=fit">
<sub>Used With Permission From @someguy123</sub></center>

Because @someguy123 hasn't written a post about using HIAB I decided to do it, mainly because I use it and always end up referring to discord chats on how to set it up. Much easier to just have it all in one place, and what better place than the chain itself? Im just going over basic setup using snapshots but theres even more functionality(you can replay the server, or sync without a blocks_log file) which you can read about here: https://github.com/someguy123/hive-docker. 


### Server

First thing that you'll need is a server for this. Thanks to the efforts in HF 24, its become quite a bit easier to run I would recommend a<a href="https://privex.io?r=rishi556"> Privex</a> server for this because you can pay with Hive and HBD, but because we have a lot of witnesses already on Privex and its important to have our chain be distributed between different datacenter and providers, I would recommend that you find your own.

I run my witness(@hextech) on a server with 16 gigs of RAM and 4 threads for the witness along with 400 GB(320 GB being used right now) on a NVME on Ubuntu 20. Higher ram usage is required during the snapshot import process(reaching about 15.3 GB used). 


### Setting Up HIAB

I like to update my server as the first thing to do as well as install git and screen.

```
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install git -y
sudo apt-get install screen -y
```

Then we clone the repo.

```
git clone https://github.com/someguy123/hive-docker.git
```

And then use it to install docker for you. This shouldn't take too long.

```
cd hive-docker
./run.sh install_docker
```

We can then install the latest docker image for the witness with. It will grab whatever is the latest from dockerhub(https://hub.docker.com/r/someguy123/hive/tags).

```
./run.sh install
```

The next step is to download the block_log(somewhere around 300 GB around now) as well as the snapshot files. We are going to do this in a screen so we don't need to remain connected while this goes on. 

```
screen -S download
export BC_HTTP_RAW="http://files.privex.io/hive/block_log" 
export RSYNC_BASE="rsync://files.privex.io/hive"
./run.sh fix_blocks
```
You'll be presented with a screen like this. For downloading the rest of blocks_log, you'll want to say yes (y). This will take a while, depending on the connection speed. The best thing to do is wait. 

![Screen Shot 20201107 at 5.17.16 PM.png](https://files.peakd.com/file/peakd-hive/rishi556/NBjD9C5C-Screen20Shot202020-11-0720at205.17.1620PM.png)


After that you'll be asked if you want to grab block_log.index as well. Say yes to that as well. 

Then you'll get asked about snapshot, again say yes.

Finally you'll be asked about shared_memory.bin, for that say no(n). 

While those are downloading, you can move onto the next few steps, I'll let you know where you'll need those files to move on. 

### CLI Wallet And Keys

Now we are going to want to generate our witness signing keys. You can reuse some keys that you already use, but it's recommended to generate new ones just for signing blocks. To do that, we use the cli_wallet. 

We'll be using the remote wallet as our local instance isn't ready yet.

```
./run.sh remote_wallet
```

You should get presented with something like this on a fresh install. If it says `locked` instead of `new` then you already have a wallet setup(you won't unless you are updating) and you can unlock it and skip the init step.

![Screen Shot 20201107 at 5.25.29 PM.png](https://files.peakd.com/file/peakd-hive/rishi556/eSs2pI5W-Screen20Shot202020-11-0720at205.25.2920PM.png)

You can type in `set_password ` to set your password. For example, if I wanted my password to be 123, I'd type in `set_password 123` Remember the password as you'll need this to unlock the wallet in the future. You'll want to unlock your wallet after that. Thats as simple as `unlock 123`. Replace 123 with the password you set. 

Once you are unlocked you can use `suggest_brain_key` to get a public private keypair generated. You'll want to save that as you'll need it in the future. ![Screen Shot 20201107 at 5.29.09 PM.png](https://files.peakd.com/file/peakd-hive/rishi556/znrDztKe-Screen20Shot202020-11-0720at205.29.0920PM.png)

You can exit the wallet by pressing control + D. If you ever forget your password, you can wipe the wallet clean and use a new password. A `wallet.json` file is generated and stored within the `data` directory. Just delete that and it'll start the wallet fresh again.

### Config 

Next we'll  need to modify the config file to work with our witness. Its located at `data/witness_node_data_dir/config.ini` directory. We'll want to modify that. 

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

Most of the values there are already good. If you want to modify anything go ahead if you know what you are doing. 

The place we want to modify is `witness = ` and `private-key = `. They are already commented out(line begins with `#`) so we can just go find them and delete the # at the start of the line. For the witness, you'll want to type in the username of the account that the witness will be running under. This value must go in quotes. The private key should be the private key that we generated from the cli wallet. This should not go in quotation marks. Use the image below as an example.


![Screen Shot 20201107 at 5.42.17 PM.png](https://files.peakd.com/file/peakd-hive/rishi556/X9sITamf-Screen20Shot202020-11-0720at205.42.1720PM.png)


### Starting Up

Going on, you'll need to have all the files that we started downloaded earlier ready to go. If not, please finish downloading then continue. While you wait for this to download, some good things to do are write a post about you staring up your witness, voting @hextech for witness and thinking about how you can help benefit the hive ecosystem. 

We are going to load in the snap that we got so that we don't need to replay. 
```
./run.sh load_snap privexsnap  
```

This does take some time, but nowhere near as long as it would take if we had to run a replay. You can monitor what step of the process this is at by using `./run.sh logs`.

Once the snapshot loads in, it'll automatically start syncing up to live. You can check the sync progress using `./run.sh monitor`. It'll tell you how long it'll take to get synced up. Again this is a time to wait. You'll know that you are live when you see individual blocks being produced in `./run.sh logs`. That'll look like this:

![Screen Shot 20201107 at 6.58.25 PM.png](https://files.peakd.com/file/peakd-hive/rishi556/dmpGRIr9-Screen20Shot202020-11-0720at206.58.2520PM.png)

The block numbers will be going up by one. Nows the big time, time to enable as a witness.

### Enabling Your Witness

Let's enable the witness, you can do so using either the remote wallet or the local one. To use the local wallet, use `./run.sh wallet` and remote is `./run.sh remote_wallet`.

```
./run.sh wallet
```


Unlock the wallet with the password set before using `unlock 123` where 123 is the password. We'll want to import in your active key to sign the transaction that we'll be broadcasting. Find the private active_key using your preferred choice. If your private active key is 5KNrHHigj3PRurkm5moaV1XM3gwGrDZJJZCgPRL2FpBLjWy1obg you'd import it by typing in `import_key 5KNrHHigj3PRurkm5moaV1XM3gwGrDZJJZCgPRL2FpBLjWy1obg`

Now we want to broadcast enabling the witness. Modify the following command to match what you want and type it into the wallet. Replace username with the name of your witness, the https://example.com part with the url you want to use for your witness and STM1111111111111111111111111111111114T1Anm with the public key generated for your private signing key when we first got into the wallet. Following that are your witness parameters, modify them to your liking, but these are the current standard ones being used by witnesses and so it's wise to follow along. 

```
update_witness "username" "https://example.com" "STM1111111111111111111111111111111114T1Anm" {"account_creation_fee":"3.000 HIVE","maximum_block_size":65536,"hbd_interest_rate":0} true
```

After that gets broadcast, you are up and running as a witness. You can check that you are enabled somewhere like https://peakd.com/me/witnesses. The green ball means that you are enabled. Your version will not report to the version that you are using until you sign your first block so don't worry if it says 0.0.0. Just get the word out there that you are being a witness and get more votes. 

![Screen Shot 20201107 at 7.09.34 PM.png](https://files.peakd.com/file/peakd-hive/rishi556/kaXmX4Yp-Screen20Shot202020-11-0720at207.09.3420PM.png)

I was following along on a fresh server and it took me 2 hours and 15 minutes to get to the point where I could broadcast the enable witness transaction. The latest updates and the work from someguy to make HIAB exist has made it a lot easier to be a witness.

### Future & Questions

You'll want to setup a pricefeed and failover script as well. For pricefeed, I recommend someguy's hivefeed-js (can be found here https://github.com/someguy123/hivefeed-js) as well for failover script(watcher by therealwolf works https://github.com/therealwolf42/hive-witness-essentials/tree/master/essentials/watcher) 


As time goes on, you'll need to update. The update process might involve a replay or it might not. Hard forks involve a replay and soft forks usually don't. You can get information and ask questions about that in the Privex discord which can be found at http://discord.privex.io/. The server requirements might increase as well and you might need to upgrade that. 



<center>

If you like what I do, feel free to vote for my witness https://vote.hive.uno/@hextech

</center>
