Your guide to setting up a Witness Server (STEEM-in-a-box HF19)

in #steem7 years ago (edited)

NOTE: This article contains both upgrade instructions, AND install-from-fresh instructions.

This article is designed for those running a previous version of my Steem-in-a-box software, or for those looking to set up a new witness server.

If you want to learn more about witnesses and what they do, check out my article here: https://steemit.com/witness-category/@someguy123/seriously-what-is-a-witness-why-should-i-care-how-do-i-become-one-answer

NEW FEATURES

new features include:

  • dlblocks (downloads blocks from @gtg's server, decompresses them into the right folder)
  • install_docker (downloads and installs docker. if not running as root, auto adds your current user to the docker group)
  • remote_wallet (runs cli_wallet against steemd.steemit.com)

UPGRADING FROM HF18

If you have a previous installation of Steem-in-a-box, simply do the following:

Update your steem-in-a-box scripts:

git pull

Disable your witness, or change it to your backup key

./run.sh wallet

locked>> unlock "supersecurepassword"
unlocked>> update_witness "someguy123" "yoururl" "STM1111111111111111111111111111111114T1Anm" {"account_creation_fee":"0.200 STEEM","maximum_block_size":131072,"sbd_interest_rate":0} true

Now stop the witness server

./run.sh stop

Now, make sure you delete the /dev/shm files, as they will not be compatible with HF19 and need to be re-built

rm -rf /dev/shm/*

Finally, update your STEEM image, then start it with replay

./run.sh install
./run.sh replay

You can now check the logs with ./run.sh logs and see that it's rescanning the blockchain.

Once it's fully replayed, you can re-broadcast your witness :)

 update_witness "someguy123" "yoururl" "STM1abcdabcdabcdabcdabcdbdcabacbdcab" {"account_creation_fee":"0.200 STEEM","maximum_block_size":131072,"sbd_interest_rate":0} true

Installing a NEW witness

To become a witness, you'll require a server with at LEAST 8GB of RAM, 100GB disk, and a fast, reliable network. I recommend @privex - they accept STEEM, are affordable, and sell servers with a Zero Block Miss SLA

I personally use @privex for my own witness, as proof of their quality - I haven't missed a block since moving to them months ago, and I get almost 60 per day. (DISCLAIMER: I'm the CEO of Privex Inc. however you'll find plenty of people here on STEEM unaffiliated with us, praising our servers and network)

You're free to use any other server provider. I don't recommend trying to run a witness on your home internet, as it is likely not reliable enough for a witness.

Be aware that certain server providers have poor networks or hardware, and may cause missed blocks, so you may be hopping around a few until you can find one that's suitable for a witness node.

If you want to learn more about witnesses and what they do, check out my article: https://steemit.com/witness-category/@someguy123/seriously-what-is-a-witness-why-should-i-care-how-do-i-become-one-answer

First, we install some basic dependencies (assuming you're on Ubuntu).

sudo apt update
sudo apt install git curl wget

Next, we download Steem-in-a-box, created by myself.

git clone https://github.com/Someguy123/steem-docker.git
cd steem-docker

Now that it's downloaded, and we're in the right folder, we can install Docker.

./run.sh install_docker

NOTE: If you're running this without root, you'll need to log out and back in again after it's done. Remember to cd steem-docker after logging back in.

Now, we download the pre-compiled STEEM image from DockerHub:

./run.sh install

A new feature in the HF19 Steem-in-a-box, automatically downloads blocks from @gtg's server, extracts them, and puts them in the right folder. This will take a while, but will dramatically speed up your setup time.

./run.sh dlblocks

This next part is for witnesses, if you're wanting to run a seed, don't touch the config!

Open the wallet using a public server with the following command:

./run.sh remote_wallet

Create a key pair for your witness.

suggest_brain_key

You should get something similar to this:

  "wif_priv_key": "5xxxxxxxxxxxxxxxxxxx",
  "pub_key": "STMxxxxxxxxxxxxxxxxx"

Put the keys in notepad or something similar for the moment so you don't lose them.

Press CTRL-D to exit the wallet.

Now, you need to decide on how much "shared memory" to give the server. Right now, 8GB is the bare minimum, however 12GB is recommended. DO NOT GIVE MORE SHARED MEMORY THAN YOU HAVE ACTUAL RAM AVAILABLE. e.g. if you have an 8GB VPS, only use 8G for your shared memory.

sudo ./run.sh shm_size 8G

Open up the config file in your favourite text editor, nano is good for beginners:

nano data/witness_node_data_dir/config.ini

You should not run a seed if you are a witness, so change

p2p-endpoint = 0.0.0.0:2001

to

# p2p-endpoint = 0.0.0.0:2001

This disables the seed.

On a blank line, put the following:

witness = "YOUR NAME GOES HERE WITHOUT THE @ SIGN"
private-key = 5xxxxxxxxxxxxx

Put in your witness name, and your private key from earlier. Be aware the name needs quotes, while the private key doesn't. You use the private key (wif_priv_key) you generated earlier and put into notepad.

You will also need to adjust shared-file-size to whatever size you decided earlier for the "shared memory". There should already be a line with 12G, adjust that, if you need to do not make a new line for this.

shared-file-size = 8G

Save and close the file (if using nano, press CTRL-X, say yes to saving)

Next, we adjust the steem-in-a-box settings so that it's named correctly, and to disable port forwarding for seeds:

nano .env

The file will be blank. In the file put the following:

PORTS=
DOCKER_NAME=witness

Again, save and close the file with CTRL-X.

Now, we can start up the witness server

./run.sh replay

Check the logs with this command:

./run.sh logs

You should see something similar to this:

344773ms th_a       application.cpp:297           startup              ] Replaying blockchain on user request.
344774ms th_a       database.cpp:151              reindex              ] Reindexing Blockchain
344823ms th_a       block_log.cpp:130             open                 ] Log is nonempty
344823ms th_a       block_log.cpp:139             open                 ] Index is nonempty
344823ms th_a       database.cpp:159              reindex              ] Replaying blocks...
344834ms th_a       database.cpp:2571             show_free_memory     ] Free memory is now 11G
   0.77369%   100000 of 12925066   (12282M free)

If you see lots of red error messages, something went wrong. You can ask for help debugging it in the witness channel on
STEEMIT.CHAT
.

If it appears to be working, leave it for an hour or so. Check the logs every 10 minutes until you see something like this:

1299055ms th_a       application.cpp:507           handle_block         ] Got 14 transactions on block 12928269 by pharesim -- latency: 55 ms
1302427ms th_a       application.cpp:507           handle_block         ] Got 18 transactions on block 12928270 by xeldal -- latency: 426 ms
1305291ms th_a       application.cpp:507           handle_block         ] Got 26 transactions on block 12928271 by arhag -- latency: 291 ms
1308045ms th_a       application.cpp:507           handle_block         ] Got 20 transactions on block 12928272 by pfunk -- latency: 45 ms
1311092ms th_a       application.cpp:507           handle_block         ] Got 23 transactions on block 12928273 by bhuz -- latency: 92 ms

This means your witness is now fully synced.

Go to your profile on Steemit, click Wallet, then Permissions. Next to "Active Key" you should see "Login to show". Click that button and log in. Then press "Show private key", to reveal it. Make sure it begins with a "5".

Copy the key.

Now open the wallet with:

./run.sh wallet


(Image courtesy of @klye, copied from his old guide)

Set a password, unlock the wallet with the same password, then import your ACTIVE private key from steemit (NOT the one in notepad):

set_password "mysupersecurepass"
unlock "mysupersecurepass"
import_key 5zzzzzzzzzzzz

Finally, we can update/create the witness on the network. Replace the STMxxxx key with the public key you saved earlier in notepad, and replace YOURNAME with your witness name on Steemit.

update_witness "YOURNAME" "https://steemit.com/witness-category/@YOURNAME/my-witness-thread" "STMxxxxxxx" {"account_creation_fee":"0.200 STEEM","maximum_block_size":131072,"sbd_interest_rate":0} true

Assuming there are no big red messages, you're now a witness! :)

Go ahead, vote for yourself (and @someguy123).

How do I know what rank I am?

Check SteemDB: https://steemdb.com/witnesses or steemd: https://steemd.com/witnesses

What about a price feed?

As a witness, you're expected to run a price feed.

I recommend Steemfeed-JS, as it goes nicely with the docker set up.


Do you like what I'm doing for STEEM/Steemit?

Vote for me to be a witness - every vote counts.

Don't forget to follow me for more like this.


Have you ever thought about being a witness yourself? Contact me on STEEMIT.CHAT, or just ask in the witness channel. I'm happy to guide you! Join in shaping the STEEM economy.

Are you looking for a new server provider? My company @privex offers highly-reliable and affordable dedicated and virtual servers for STEEM, LTC, and BTC! Contact me on STEEMIT.CHAT for more information.

Are you looking for a Graphics designer for your project? Logos, PSD mockups, banners? Check out @MaliceRed - he posts about his life as a Freelance Graphics Designer, and is looking for work.

Sort:  

Nice sharing! But it just too complicated for me for those technical terms and command XD. And I think maybe someday I will be interested in doing so..but The first point is I need to be good enough XD. Anyway, thanks so much for your sharing! It give me some idea about it.

People using this Steem-in-box from scratch will have to update the run.sh file to make the wallet work.

remote_wallet() {
docker run -v "$DATADIR":/steem --rm -it steem cli_wallet -s wss://wallet.steem.ws

Just make sure to use a seed that is working. The current file comes with a seed that doesn't work anymore. The one below and above work.

wss://wallet.steem.ws

hey teamsteem, I got a question when I try to update/create my witness in network by running this code: update_witness "YOURNAME" "https://steemit.com/witness-category/@YOURNAME/my-witness-thread" "STMxxxxxxx" {"account_creation_fee":"0.200 STEEM","maximum_block_size":131072,"sbd_interest_rate":0} true

should I only change the part that represented by YOURNAME and my key?
or I actually need to edit my own post, and the address of it is - https://steemit.com/witness-category/@YOURNAME/my-witness-thread
and the whole web link needs to be changed.

and the following information like account_creation_fee, maximum_block_size, sbd_interest_rate, should I fill up my own real situation or just use the value in the command I show?

It will be great if you can give my any hint about this!

Thanks,
songcaoxian

You can link to one of your post or not but it would be preferable if you had a post link to your witness. You also need to change the block size and sbd rate.

You can find these here https://steemd.com/witnesses

The link to the witness post appear under URL.

Don't forget, it's the PUBLIC witness key that goes there not the private one.

Let me know if that helped.

Cool! Do thanks for your update on it!

Thank you for this amazing instruction I did it and finally got the Witness Wallet Working
Please, how do I monitor and keep the witness box running continuously, I discovered it may have​ stopped the box when I updated the wallet. How do I confirm, when blocks are been created and maintained

To see if the container is running

./run.sh logs

To see if you're missing blocks

https://steemit.chat/channel/witness-blocks

To see if your witness is online.

https://steemian.info/witnesses

I'm not sure what you meant by updating the wallet. Have you signed a block yet? What is the name of your witness?

Yes... Thanks for the guide. I've not signed a block. I think am way down the chain. I'm following you... Whats your witness name? My witness name is @doctorvee

Very cool and would definitely try this when i get the gist of it all.
It looks confusing but i will get the understanding or maybe someone can help me do this faster?

This is likely the next step for me as I spend every day on steem or working on something steem related.... thanks for the guide man! Bookmarked!

You are doing great work on Steem brother witness @someguy123, teaching others is very noble, keep it up, Steem needs knowledge.

Thanks for a very informative guide. I am just in the process of setting up a witness node, so this came at a perfect time... Still trying to figure out where to host it, so I will take a good look at @privex

Thank you for your help and support
We surely need you
Please follow @someguy123 he is great
I am your new follower
Best Regards Andrei

i really want bookmarking to come back to this. think i might take you up on a virtual server at some point!

upvoted because you mention this. Making it easier to know where to go to spend steem as well.

I recommend @privex - they accept STEEM, are affordable,

Priceless your Job here, thanks for doing that! Upvote! /wave

i was waiting for this :D awesome stuff man

upgrading tonight!

Coin Marketplace

STEEM 0.32
TRX 0.12
JST 0.034
BTC 64664.11
ETH 3166.18
USDT 1.00
SBD 4.11