With hive-engine coming out with their P2P validation layer recently, I thought it might be useful to make a guide in order to help users who want to get set up. While this isn't a true block production layer, it's better than nothing since it can help show if particular nodes are out of sync(though if everyone just uses the "official" node, then the p2p layer is kinda useless, so use other nodes developers).
<p dir="auto"><a href="https://ryamer.com" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Ryamer.<span>I decided to write a simple guide so that way anyone who wants to use the programs can do so. I'm assuming you know the basics of how to connect to a server, and how to do basic troubleshooting(if it says "error something's not installed, go ahead and install it) as well as basic security stuff for your server(PLEASE USE SSH KEYS AND NOT PASSWORD AT THE VERY LEAST INSTALL FAIL2BAN <a href="https://www.techrepublic.com/article/how-to-install-fail2ban-on-ubuntu-server-18-04/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://www.techrepublic.com/article/how-to-install-fail2ban-on-ubuntu-server-18-04/ ESPECIALLY SINCE YOUR IP IS PUBLIC). I'm also using Ubuntu 20.04 while writing this, if you are on other systems it might vary. You'll need a server with at least 4 gigs of ram (I recommend at least 8) and I'd recommend at least 4 cores and 500 GB of NVME. Your server must also have IPv6 connectivity. If you don't, you can tunnel to get the connectivity. If you are looking to rent a server, check out <p dir="auto">Doing this WILL REVEAL YOUR IP of the server to the world, since the witness enable command broadcasts the on the chain(its how the nodes find each other to talk to). <p dir="auto">Being a top engine witness does take a lot of RC as well. While testing, I delegated 500 HP to my engine witness and that wasn't enough. I'd recommend about 1,000 HP worth of RC. <p dir="auto">When you get your server you'll want to install a few basic things, including git, nodejs, mongodb and screen. <pre><code>sudo apt-get update -y sudo apt-get upgrade -y sudo apt install git -y sudo apt install screen -y sudo apt install npm -y sudo apt install ufw -y wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list sudo apt-get update sudo apt-get install -y mongodb-org <p dir="auto"><span>This should install the packages that we need. Next we'll need to change our mongo settings to use replication sets. If you have any problems, feel free to consult <a href="https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/. <pre><code>sudo nano /etc/mongod.conf <p dir="auto">On it you'll see a line that looks like <code>#replication: <p dir="auto">You'll want to change it so that you remove the # at the start and on the line below it, add two spaces and <code>replSetName: "rs0" and <code>security.javascriptEnabled: false on another line. The final result should look like: <pre><code>replication: replSetName: "rs0" security.javascriptEnabled: false <p dir="auto">Now save that, Press control + O, then control + X. <p dir="auto">Next we'll restart mongod. <pre><code>sudo systemctl stop mongod sudo systemctl start mongod <p dir="auto">Could also use restart here, but I like stop and start :) <p dir="auto">Now we want to activate replica sets on mongodb. <pre><code>mongo rs.initiate() <p dir="auto">You'll see a bunch of stuff and it should say something like "rs0"... at the bottom left. If thats all good, press control + D to exit. <pre><code>mongo --eval "db.adminCommand({setParameter:1, internalQueryMaxBlockingSortMemoryUsageBytes:2097152000})" <p dir="auto">You'll want to run this to increase the max memory used for sorting. The default is 100MB. This sets it to 2 GB. Make sure you have the RAM for this, drop the number if you need to. <p dir="auto">Now we'll want to update our version of nodejs. <pre><code>sudo npm i -g n sudo n 18 <p dir="auto">At this point please disconnect and reconnect to the server. It's the easiest way for the update to take place. <p dir="auto"><span>Now the following step you want to take ONLY IF YOU GOT A 2 GB RAM SERVER!!! While it won't hurt it if you do on a 4 GB server, it's not necessary. But it is required on a 2 GB server. This is making a swap file on your server, because mongo import takes more than 2 GB of ram. If you have any problems feel free to consult <a href="https://linuxize.com/post/create-a-linux-swap-file/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://linuxize.com/post/create-a-linux-swap-file/. We'll be making a 2GB swap file. <pre><code>sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile <p dir="auto">Now if you do <code>sudo swapon --show you should see some number and under size it should be <code>2048M showing you did it all correctly. <p dir="auto">The following steps are for everyone again. <p dir="auto"><span>We'll want to grab the latest snapshot for engine from a reliable source. I use <a href="https://snap.primersion.com/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://snap.primersion.com/ or my mirror <a href="https://snap.rishipanthee.com/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://snap.rishipanthee.com/. <pre><code>wget URL_ARCHIVE <p dir="auto">We wait for that to finish. Take note of the name of the file, here it is <code>hsc_20210203_b50993579.archive. If you grab one of a different name, you'll need to update what you do on the following step to match the name. <p dir="auto">Then we'll want to import in the snapshot onto mongodb. For this we use a screen so that way if you disconnect it still works as this is the longest part. If you got the bare minimum specs, it'll take about 20 minutes. <pre><code>screen -S reload mongorestore --gzip --archive=hsc_20210203_b50993579.archive <p dir="auto">If you know how to get out of a screen, you can do so and move onto other steps while waiting for this to finish. If you don't, just sit tight, you can wait a little bit. If you get disconnected from your server and need to reconnect to the screen you can type in <code>screen -r reload. Once it's done, you can press control + D to disconnect from the screen. <p dir="auto">Up next is getting the hive engine code. We use git to get this. Yes it is still called steem smart contracts. <pre><code>git clone https://github.com/hive-engine/hivesmartcontracts.git cd hivesmartcontracts <p dir="auto">Then we want to install the dependencies to the program as well as pm2 which we will use to run this in the background. <pre><code>npm ci sudo npm i -g pm2 <p dir="auto">If you aren't eturnerx, please skip the next line.<br /><span> <a href="/@eturnerx">@eturnerx It's npm ci, not npm i. And don't you dare npm audit fix. <p dir="auto">You'll want to then modify the config file to work with the import we got, to open it type in <code>nano config.json, as well as add or remove nodes. The list is pretty good right now, the only thing you'll want to change is the part after <code>"startHiveBlock": to be 0. Final result should look like: <pre><code> "startHiveBlock": 0, <p dir="auto">Make sure the comma after that is there. On the last line, there's <code>witnessEnabled which should say false for now, change that to true. Result should be like: <pre><code>"witnessEnabled": true <p dir="auto">There's stuff about light nodes and all that in there, but we wont' be dealing with that in this guide. <p dir="auto">Save the file and exit, control + O, control + X. <p dir="auto">Now we need to move the example env file to be a real one. <pre><code>mv .env.example .env nano .env <p dir="auto">Now this is all blank. You'll want to fill it in with your details, after the = on each line. For the domain, you can buy a domain and point it to your server. Set the AAAA record of the domain to the IPv6 address of the domain, and the A record to the IPv4 record of the server(if it has one). Here's an example of one: <pre><code>ACTIVE_SIGNING_KEY=5FreeKeysAreNotAThingb ACCOUNT=h-e NODE_DOMAIN=example.com <p dir="auto">Once you do that, control + O, control + X to save and exit. <p dir="auto">Almost there. Now we want to allow access to the ports that are necessary for this. <pre><code>sudo ufw allow ssh sudo ufw allow 5001 sudo ufw enable <p dir="auto">Now we start the node up. <pre><code>pm2 start app.js --name engwit --no-treekill --kill-timeout 10000 --no-autorestart <p dir="auto">Now we need to wait for it to sync. This can take some time. The older the snapshot that you use, the longer it takes. To monitor your progress, type in <code>pm2 logs. Once you see lines that look like <code>0|app | 2021-02-03 03:15:04 info: [Streamer] head_block_number 50994938 currentBlock 50994939 Hive blockchain is 0 blocks ahead you are good to go. The 0 blocks ahead part is very important. Otherwise you could miss blocks. You can disconnect while waiting at this point. To close the logs, press control + C. <p dir="auto">Once thats up and running, you might need to cd back into the folder <code>cd hivesmartcontracts if you exited the connection to the server. <p dir="auto">Then enable your witness <pre><code>node witness_action.js register <p dir="auto"><span>And you did it. You are now a witness. Be sure to vote for me for Hive witness (<a href="/@hextech">@hextech) as well as hive-engine witness(<a href="/@h-e">@h-e). To vote for hive engine witnesses, you can check out <a href="https://cdn.rishipanthee.com/enginewit.html" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://cdn.rishipanthee.com/enginewit.html or the official tool at <a href="https://tribaldex.com/witnesses" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://tribaldex.com/witnesses. <hr /> <hr /> <hr /> <hr /> <hr /> <p dir="auto"><span>Now that you've reached here, there's one more thing to say. I've worked on a little tool called EngineSpeed for helping you set up nodes quickly. You can find it here. <a href="https://github.com/Rishi556/EngineSpeed" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/Rishi556/EngineSpeed. Basically you use it on a fresh Ubuntu 20.04 server and it'll do 95% of the work for you. You just have to come back in a while to see if its ready and register your node. <p dir="auto">Usage for a fullnode: <pre><code>wget https://git.dbuidl.com/rishi556/EngineSpeed/raw/branch/main/install.sh chmod +x install.sh ./install.sh -w -a YOUR_HIVE_USERNAME_HERE -p YOURHIVEPRIVACTIVEKEYHERE <p dir="auto">And that's it. Or if you'd prefer a light node: <pre><code>wget https://git.dbuidl.com/rishi556/EngineSpeed/raw/branch/main/install.sh chmod +x install.sh ./install.sh -w -a YOUR_HIVE_USERNAME_HERE -p YOURHIVEPRIVACTIVEKEYHERE -l <p dir="auto">Super simple right? Once the scripts done processing(I recommend starting them in a screen so you don't have to stay connected while they do their thing), you can check the sync status using <code>pm2 logs engnode. Once it shows you as caught up, cd into the hivesmartcontracts directory, then use <code>node witness_action.js register -v and you are up and running. Super easy right? <p dir="auto">Now I don't recommend everyone do this. There might be bugs I haven't found, and troubleshooting this is harder since it will keep on proceeding step by step even if there's a problem. But for someone who's done this a ton, this script should help them set stuff up faster and they should know how to fix broken things. <p dir="auto"><center>If you are looking to rent a server, check out <a href="https://ryamer.com" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Ryamer.How To Set Up A Hive Engine Witness- Step By Step Guide
4 years ago in #engine by rishi556 (70)
$14.77
- Past Payouts $14.77
- - Author $7.49
- - Curators $7.27
178 votes
- v4vapid: $2.44
- enki: $2.40
- memehub: $1.77
- actifit: $1.31
- ausbitbank: $0.59
- forykw: $0.54
- edicted: $0.44
- actnearn: $0.43
- derangedvisions: $0.35
- apshamilton: $0.35
- eonwarped: $0.34
- slobberchops: $0.30
- steembasicincome: $0.29
- coininstant: $0.28
- dkid14: $0.17
- sbi2: $0.16
- ervin-lemark: $0.16
- jlsplatts: $0.15
- hamismsf: $0.15
- lacking: $0.14
- and 158 more
Just checked this while I was migrating my hive-engine node to a new machine and spotted this line below that doesn't make sense anymore. At no point in the guide does it mention any step where you would need to edit version number, is it missing a git checkout branch line ?
git checkout hive-engine
is mentioned in the guide. That branch is kept up to date so no need to checkout a specific version unless you want it for some reason.Hi, I have this error when run mongo. Could you help me, please?
Did you start mongo up?
sudo systemctl start mongod
Yes. I've stopped, restarted, reinstalled...
Mongo shell run until I change and put replSetName: "rs0" on the config file.
I don't know what more else I can do.
is that the huge key we need to import first when me setting up the mOngo? https://www.mongodb.org/static/pgp/server-4.4.asc here?
Yup thats covered by
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
.Wow, this looks like a awesome project! I know what i’m working on this weekend!
Definitely is. Engine is one of the most used tools on hive and decentralization of it is very important.
Great work!
This is just what I was looking for.
Any reason not to run a Hive-Engine witness on the same machine as a Hive witness?
IP gets revealed. Would not recommend. I'm going to add that to my post. Thanks for reminding.
Thanks. So you need to run it on an IP that is OK to be public.
So it could be on the same machine as a Hive full API node.
Can you hide it behind a reverse proxy like you can use jussi to hide an API node's actual IP behind?
When you broadcast to enable, it publishes the ip and ports that are open(see ex: https://hiveblocks.com/tx/14e6c348ced9d4211ce8392bf413ba290c754bb2). I guess if you manually broadcast the enable trx(I was told you could do it at https://tribaldex.com/witnesses) and you have a setup that forwards the requests to the proper ports on your engine witness I guess it could work. I'm not really too good with networking stuff though so maybe try it out on an ip you don't care about. I can give it a try this weekend to see how it goes.
@dynamicgreentk what do you think?
I think things on Hive are weird. I want to run a node for peerplays but I do not know if buying a new computer setup for something so far behind on development is worth wile. As it is @starkerz or @theycallmedan do not seem active on Hive either. They are the only reason I would buy a node setup to take this journey. I wanted to further incorporate that into a hive node but I am pretty concerned about the massive upbit consolidation of liquid hive.
Who knows will starkerz or theycallmedan get in touch maybe, I dont know. If they do and explain better the costs they are willing to pick up for running a peerplays node than maybe instead of buying bitcoin with my small inheritance in February, I might pick a new computer setup, starlink and a solar setup. Just will @dlux make our second layer decentralized? Just Hive seems way too risky of an investment past simply blogging and building communities.
I mean can we at least get an eth or btc bridge lol or coinbase listing before upbit grabs all the remaining liquid hive?
yup seems like there may be a movie made one day how 1 guy created a game and an exchange and had an entire blockchain of people fooled the entire time, he pulled the rug yet they were hypnotized by his college lectures and billionaire buddy tales...
🤣 🤣 🤣 This one time at vanguard investments I mean Harvard...
https://peakd.com/hive-193084/@jin-out/nzdfkcqm
Excellent guide! Thanks for generating the snapshots. It saves a lot of time, bandwidth, and node hammering.
The only issue I ran into is the firewall blocking RPC port 5000 by default.
Happy to have helped. Just shout if you need any help.
Let's wait for that
51022551
block now. 😉 !HYPNO !WINE0.100 WINECheers, @dannychain You Successfully Shared With @rishi556.
You Earned 0.100 WINE As Curation Reward.
You Utilized 1/3 Successful Calls.
WINE Current Market Price : 1.200 HIVE
Less than 12 hours to go now :)
So hive-engine is still functionally centralized?
Not exactly. We now have a way for nodes to verify the data against each other and get rewarded for it. But as of now, most of the tools using hive-engine are still using the api from api.hive-engine.com. True decentralization will come once other nodes start getting used. Even on hive if everyone just used api.hive.blog as their only API and skipped all other nodes, even if they existed it wouldn't be a decentralized system.
Hey @rishi556, here is your HYPNO ;)
Looking good, looking good!
Thanks
Awesome stuff... I might give it a try...
Do you have a sense on CPU and db growth over time?
DB growth will surpass CPU growth by a lot. CPU helps a lot on initial sync and serving as an RPC but then it doesn't take too much. DB's been growing by quite a bit in the last few days. My entire server is currently using 15726016 KB(just has this on it, no extras and no remaining archives). Let's wait a week and see what its at then to calculate growth.
Nice, thanks... this weekend will do a trial with a 4 core, 4 GB VM (disk I have plenty, but I wanted to understand how far can I plan something if committing). If that plays out nicely, I will be grabbing a new CPU/board/ram for a nicer thing.
15GB for a start is not that bad (assuming it has already all the previous history of hive-engine)... so, hopefully not going to be 30GB next week... that kind of growth would be already hard for me to sustain.
Thanks for the guide too... helps speed up stuff.
That should be more than enough. It ran fine on 2 cores and 2 gb + 2 gb swap while testing. Disk growth is probably biggest thing.
Thanks for the very concise instructions.
I suppose you can unregister your witness too? In other words, put it on hold temporarily?
I would like to check the procedure first at my home machine and if all goes well, repeat it on the real server.
Thanks!
!invest_vote
Yes you can. If you do
node witness_action.js unregister
that'll unregister you. Or if you prefer a UI, Tribaldex has that feature.Thanks. You got my h-e witness vote. It's not much, for now :)
Have a great weekend.
Every but helps, thank you. You too. Feel free to ask if you have any questions. If you use discord, you can also get help there: https://discord.gg/a2wkAmqu9j.
A couple adds to this one...
<p dir="auto">First... <p dir="auto">Add proper tools 🤣 <pre><code>sudo apt install vim nmon -y <p dir="auto">Secondly... if you happen to have in-house disks, use LVM stuff, divide your DB through several disks (in case you have them) to optimize for IO and bandwidth at the same time. Note, that if you can maintain a separate disk for the OS, then that's even better. SSDs are expensive when you are talking about several TB of storage. <p dir="auto">Also... if you have lots of memory, you can create a script to restore the db in memory (using a ramfs) and then shutdown the DB and copy it to disk. Saves a lot of time for big databases. <p dir="auto"><span>Great work <a href="/@rishi556">@rishi556 =) <p dir="auto">Note2... DB is quite OK for me... the problem of maintaining this kind of transactions is the FS snapshots I usually use to roll back once I have a problem. <p dir="auto">Still having a good "try" on this... as the weekend went caput...Ugh vim. Get that garbage out my face. My laptop defaults crontab to vim and I always forget and so when I try and do some nano stuff it doesn't work.
😃
Yeah... I blame old systems that didn't have any other editors as default, besides vi, and hence I had to master or face the consequences of spending extra hours fixing stuff.
nmon is cool though... Nigel (the IBM guy that built it) did very well in not allowing IBM to continue marketing the tool in a close project.
Test
test2
test3
test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4test4
Hi, hope you are doing great, i am just doing this step by step but getting not all the blocks updated to this date (07-04-2022).
Could you help me by let me know where can i find the last snapshot available to make it run into the node?
Thanks so much in advance.
https://snap.primersion.com/ is what I have been using.
HTTP is in use instead of HTTPS and no protocol redirection is in place. Be careful and do not enter sensitive information in that website as your data won't be encrypted.
It's also a good habit to always hover links before clicking them in order to see the actual link in the bottom-left corner of your browser.
`Service sponsored by @cryptoshots.nft`
- [!phishing command and universal script]
- [!scam, !unsafe and !info commands]
👉 Don't abuse them or you'll get heavy downvotes
- !phishing {link}
- !scam {link}
- !unsafe {link}
- !hacked @{user}
- !recovered @{user}
- !info
Thanks for the great explanation on how to set up the H-E witness node! Will give it a try as well!
In the meantime, I've just voted for you as Hive & Hive Engine witness! ;-)
Thank you and good luck. If you've got questions, feel free to reach out.
Will do! Thanks 😉🙏