How to setup a leader node for DTube chain on Ubuntu Server
Repository
https://github.com/dtube/avalon
What Will I learn?
- You will learn about syncing the system clock with ntp servers
- You will learn about interacting with Avalon blockchain through CLI
- You will learn how block production on Avalon blockchain works
System requirements
- Linux server running Ubuntu 16.04 and above
- Relatively modern quad core CPU
- 2GB RAM
- 20GB SSD
- Low latency internet connection
Since Avalon was newly launched (at the time when this was posted), the system requirements are low for running a leader node. As the blockchain grows, the requirements for running one will increase over time.
Other requirements
- Prior knowledge in Linux command line interface (CLI)
- Participation in DTube community and development
Difficulty
Basic
Required dependencies
- ntpd
- NodeJS version 10 LTS (version 12 may be buggy)
- nvm
- MongoDB
- Screen
- Git
Overview
In this video, we will be looking at setting up a leader node for Avalon, the blockchain for DTC tokens in DTube 0.9 and above. Avalon is a DPoS blockchain written in NodeJS, using MongoDB as chain database backend. Just like Steem, Avalon blockchain leaders produces blocks every 3 seconds, and leaders are rewarded with DTC or vote tokens for every block produced (to be determined later when main net launches). Currently, block production is done by the top 7 voted leaders (stake weighted). Leaders outside the top 7 will not get to produce any blocks.
We will be installing all required dependencies using package managers before running Avalon.
Syncing the clock
It is important to have the system clock synced so that the node will produce blocks with the correct timestamp such that it will be accepted by other nodes. This is to keep the block timestamp within the accepted range according to the time slot to prevent any missed blocks.
We will be using ntp
to sync the system clock with the nearest ntp servers.
Running Avalon
After installing all required dependencies and getting the mongo
daemon running and system clock synced with ntp
, it is time to sync up the blockchain and get a leader node running. We will be running Avalon in a screen
session, which allows you to have a terminal session running in the background.
After cloning the Avalon repository, we start by configuring the leader node by modifying start.sh file located in scripts
folder. Here we insert the peers to connect to, and the public and private key associated with the leader account (that has block signing ability). After saving the file, make the start.sh
executable by running chmod +x start.sh
, then start the Avalon blockchain by running ./start.sh
.
After syncing the blockchain, you need to broadcast your leader node details onto your Avalon account profile to announce your intent to be a leader on Avalon.
node src/cli.js profile -K <key> -M <user> '{"node":{"ws":"ws://yourip:yourport"}}'
Note: If you have anything in your profile (such as profile URL, avatar etc), you need to merge the existing JSON in your profile with the JSON object above.
Correction: profile
and node
are two separate keys for the JSON, not that node
is within profile
key. The entire JSON, including the profile
and node
keys are considered as a "Profile" by the CLI wallet, but technically it's just the JSON metadata of the account. So this means you need to copy from the opened curly bracket before the word "profile" up to both closed curly brackets when combining the JSONs. Thank you @tibfox for pointing this out!
Once that's done, you may vote for yourself (and techcoderx) here. At this point, make an Avalon leader announcement post to gain some votes!
DTube video tutorial
NOTE: I have accidentally leaked some passwords, which I have only realized after uploading the video to IPFS. They have already been changed.
Resources
Avalon blockchain documentation: https://github.com/dtube/avalon/blob/master/README.md
NTP pools: https://www.ntppool.org/en/
Managing screen terminal sessions: https://help.ubuntu.com/community/Screen
MongoDB documentation: https://docs.mongodb.com/manual/
MongoDB installation guide: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Online JSON combiner tool: https://tools.knowledgewalls.com/onlinejsonmerger
GitHub account
▶️ DTube
▶️ IPFS
Hello @techcoderx,
Thank you for your contribution to the video category in Utopian.
I can see that you have a put a lot of effort in the tutorial and we appreciate that.
Here are some suggestions for you to improve on the next video tutorial:
the font size of the video needs to be larger. Right now, the coding is very small and it is hard for people to follow. Try to zoom into the related codes so that the font size is bigger.
you need to add more structure to your presentation for people to follow easily. It is good to label some points so that people know how you are moving from one point to the next.
With English as a second language, you need to learn to phrase your sentences so that people can hear the flow of your speech.
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Chat with us on Discord.
[utopian-moderator]
Thank you for your review, @rosatravels! Keep up the good work!
dude, thank you for this, super awesome! :)
I'm glad I found your channel. Lots of awesome information here keep up the great work.
I won't lie
This is all Greek to me
But I did want to say thank you for what you do for us :D
hey there, i'm wanting to build a startup script for when i reboot my instance so that everything powers up again. what's the best way to do that? do you have any ideas or pointers? (for the dtube avalon server i have running currently)
For
screen
sessions, this might help: https://serverfault.com/questions/233084/how-do-i-use-crontab-to-start-a-screen-sessionYou can also run Avalon with PM2 instead of
screen
since this is a Node.js application, and add it to PM2 startup.oh perfect. thanks man. great tips. will start there.
Man!!
i was thinking about running my node for again @dtube
thank you for sharing this tutorial ;)
Thanks a million for this great tutorial! I will follow those steps and join the leader team soon :)
Peace!
Let me know if your node is up 😉
I will :)
the node is running now :) Thank you again for your help!
any chance you would do a video for setting up MIRA ready witnesses on say something like digital ocean cloud? i'd love to see that.
Perhaps once I actually get a Steem witness running with @d00k13 I will make a guide for that. Thanks for the request!
no worries. would love to see the guide! cheers!
I'm even confused totally on how to ise the dtube uploader 0.9. Please who can put me through.
Posted using Partiko Android
The new version accepts video URLs of centralized platforms (honestly I wouldn't use that because if my channel gets shut down by them, or if they go bust one day it will end up with dead links).
Please do the formal dtube site works? Send me the direct link please. I'm fed up. Thank you bro.
Posted using Partiko Android
Of course d.tube is up. What do you mean?
It taking me to the new interface. I can only login to steem not dtube. It said I should create another dtube account, HW will I go through that.?
Posted using Partiko Android
There should be an alert so that you can claim your account. If you cannot find it then here is the direct link. Follow the instructions to create your account, and make sure you update your profile so that your old videos will show up on your channel.
Okay. Thanks. I'm on it now.
Posted using Partiko Android
I did the first step. The 2nd didn't work.
Posted using Partiko Android
I won't mind if you can create for me. Thanks
Posted using Partiko Android
$rewarding 100% 14min