Steem Pressure #3 - Steem Node 101

avatar
(Edited)

Everything you’ve always wanted to know about your first Steem Node but were afraid to ask.

Our goal for today

We will set up the system, build steemd manually, configure a simple Steem seed node, run it and sync it with the current head block.

What is that "simple Steem seed node"?


Video created for Steem Pressure series.

A consensus node.

Every Steem node is at least a consensus node.
In its simplest form, a consensus node is simply a node that is connected to the Steem network for the sole purpose of getting and sending blocks and transactions.

The more Steem nodes are running, the more decentralized and resilient the Steem network is.

A consensus node is also called a “Low Memory Node” - the name comes from the compile-time option LOW_MEMORY_NODE=ON, which is used to build steemd in such a way that data and fields not needed for consensus are not stored in the object database.

A low memory node is all that is needed (and therefore recommended) for seed nodes, witness nodes, and nodes run by exchanges.

A full node.

Running a low memory node is enough in many cases, but we still need full nodes to be able to use certain plugins and their APIs.

Importantly, a full node means here something different than in the Bitcoin realm, where Bitcoin full node is pretty much something that a Steem consensus node can do.

Here, on Steem, the word “full” doesn’t refer to anything related to the blockchain - it refers to the fully featured set of APIs enabled within steemd.

For example, the Condenser that powers up steemit.com site uses those APIs to display posts, comments, votes, feeds, and tags.

Many of those calls don’t need to be served by steemd, and in the future they will be served by various microservices.

Full nodes have significantly higher resource requirements, but this issue will not be covered in this episode.

Setting up the hardware

In the previous episode Steem Pressure #2 - toys for boys and girls, I gave you some tips about the hardware you might need.

In this episode, I will use an entry-level dedicated machine:
Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz on an Ivy Bridge with 32GB DDR3 1333MHz RAM and 3x 120GB SSD

OS setup

I’m currently using Ubuntu 16.04 LTS.
You can assume that it’s a default clean install.

It’s up to you how you will set up your system to suit your needs and best utilize its hardware components. Every case is different, so there’s no ultimate solution here. In the end, if you run Steem node as a public service, you are expected to be qualified enough for sysadmin tasks.

In this example, the performance of each of the three disks is good on “Gandalf’s scale” ;-) i.e. it can perform Trivial benchmark presented in previous episode in less than 8 seconds.

I’ve used a 12GB swap partition on each of those drives with the same priority
/ and /boot partitions are configured as software RAID1 on all three drives.
/home is configured as software RAID0 on all three drives.

It’s OK to use RAID0 in my case, because I’m not going to use it to store anything important (anything I can’t afford to lose in the event of a power or drive failure), and that makes it able to pass the test in around 4 seconds.

Software prerequisites

Let's prepare our system so that we can build and run steemd.

Add a steem user:
useradd -s /bin/bash -m steem
Update the list of packages:
apt update
Make sure that your packages are up to date:
apt upgrade
Make sure that you have a reliable time source:
apt install ntp

If you wish to use tmpfs for the shared memory file (which is an optional solution), prepare enough free space on the target tmpfs device, create a directory and set ownership:
mount -o remount,size=48G /run
mkdir /run/steem && chown steem:steem $_

Building steemd

To use a docker or not?

Use it. It’s way faster and easier and it protects you from many possible errors that you will likely make by not following the manual very carefully.

Manual way

I'm not going to use a docker now, because I want you to get more familiar with the steemd building process.

Install packages needed to build steemd:

apt install \
    autoconf \
    automake \
    cmake \
    doxygen \
    g++ \
    git \
    libboost-chrono-dev \
    libboost-context-dev \
    libboost-coroutine-dev \
    libboost-date-time-dev \
    libboost-filesystem-dev \
    libboost-iostreams-dev \
    libboost-locale-dev \
    libboost-program-options-dev \
    libboost-serialization-dev \
    libboost-signals-dev \
    libboost-system-dev \
    libboost-test-dev \
    libboost-thread-dev \
    libncurses5-dev \
    libreadline-dev \
    libssl-dev \
    libtool \
    make \
    perl \
    pkg-config \
    python3 \
    python3-jinja2 \
    wget

apt install

This list is likely to change in future releases, but you can always take a look at Dockerfile to get an idea what is needed…. Or just go and use the docker instead (we will cover this question in one of the upcoming episodes).

From now on, you can perform all steps as the user steem:
su - steem

Clone Steem from GitHub:
git clone https://github.com/steemit/steem

Checkout stable branch and update submodules:

cd steem
git checkout stable
git submodule update --init --recursive

git checkout

Create two directories: one for the build process and one for the resulting binaries:
mkdir ~/build ~/bin

Use cmake to configure steem for the build process:

cd ~/build
cmake -DCMAKE_BUILD_TYPE=Release \
      -DLOW_MEMORY_NODE=ON -DCLEAR_VOTES=ON \
      ../steem

Setup build

Finally, build steemd:
make -j$(nproc) steemd
And copy it to ~/bin for convenience:

cp ~/build/programs/steemd/steemd ~/bin
cd;~/bin/steemd --version

building.gif

Congratulations! You have your own steemd.

Configuring a simple node.

How simple could that be?

Create a directory for data:
mkdir testdata

Create a simple configuration file:
cat > testdata/config.ini

p2p-endpoint = 0.0.0.0:2001
seed-node = gtg.steem.house:2001
public-api =
enable-plugin = witness

[log.console_appender.stderr]
stream=std_error

[logger.default]
level=info
appenders=stderr

I have configured it to listen on all interfaces (0.0.0.0) on port 2001.
You need to provide at least one seed node (address and port) - in this example I’m using my own public seed node: gtg.steem.house:2001
doc/seednodes.txt is recommended as an authoritative source of reliable seed nodes. You can use this one-liner to add them to your configuration file:

while read s; do echo seed-node = ${s%% *}; done < ~/steem/doc/seednodes.txt >> config.ini

I have not enabled any public APIs. You need to explicitly put an empty list. Otherwise the default setting will be used, which contains the login, database and account_by_key APIs.
I have enabled the witness plugin. You might find this surprising, but it has nothing to do with being a witness. It will allow your node to have an idea about bandwidth restrictions, which is part of the witness plugin. It is not required, but it is recommended, so it’s a good opportunity to highlight this option.
The remaining lines are related to logging; the levels info and higher will go to stderr. In this way, we won’t be flooded by p2p debug messages or get bored by the lack of messages during resync.

You might point shared-file-dir to a /run/steem, if you configured that earlier or explicitly set shared-file-size to a value other than default.

Please note that this configuration works well for the current stable release, which is v0.19.2 (and its minor changes, i.e. will be obsolete for appbase)

Run steemd, run!

So once we are configured, it’s time to start synchronization, which will take quite a lot of time depending on the configuration.

~/bin/steemd -d testdata

Run

That’s it

My example node synced 20M blocks in slightly less than 9 hours, reaching the current head block 100 minutes later.

If you see something like this:

Getting blocks

It means that your node is fully synced and you are getting blocks produced by witnesses.

There are ways to speed things up, like putting the shared memory file on ramfs (pros: ram is fast, cons: ram is expensive and it can quickly run out) or tmpfs (pros: it will use swap when out of ram, cons: it will run swap when out of ram), or using a local copy of block_log to replay what we already have inside it and sync what we are missing up to the current head block.

What’s next?

In the next episode, I will show you the performance differences between various setups and how quickly they can replay up to 20M blocks to give you some reference data.


If you believe I can be of value to Steem, please vote for me (gtg) as a witness on Steemit's Witnesses List or set (gtg) as a proxy that will vote for witnesses for you.
Your vote does matter!
You can contact me directly on steem.chat, as Gandalf



Steem On



0
0
0.000
66 comments
avatar

Wow it sure is a long post.

Thanks for taking your time to educate us.

0
0
0.000
avatar

I have a certain number of hours in a day allocated to studying crypto and blockchain technology. Last two weeks, I read a whitepaper through a link a friend in my steemit community shared and it tried to describe that term "full node" . I was utterly confused as the explanation I got was completely different from what I read in a blog decicated to bitcoin discussions. Since then, the term has consitently been a pont of confusion to me and nearly discouraged me. I am glad that you pointed this difference out in this post.

Here, on Steem, the word “full” doesn’t refer to anything related to the blockchain - it refers to the fully featured set of APIs enabled within steemd.

A new lesson learnt ion March 5th!
Confusion terminated!

0
0
0.000
avatar

There is a broken URL in the text (https://steem-pressure/@gtg/steem-pressure-2-toys-for-boys-and-girls):

Trivial benchmark presented in previous episode in less than 8 seconds.

missing steemit.com

0
0
0.000
avatar

Thank you, fixed. Actually it was missing / at the beginning (my intent was to make a link relative to the site, so it will get people to the previous episode within same site, i.e. if you are on Steemit you will see target episode on Steemit, but if you are on busy.org you will continue reading there, instead of going to Steemit.

0
0
0.000
avatar

Omg this is a whole lot to digest. Yesterday @teamcliff gave a run down of his own node and now you. It's amazing how you guys come up with this and I must say I am really impressed. Keep up the good work you are doing for this community ....you gat my support.

0
0
0.000
avatar

And how exactly you do that? :-)
By keeping your fingers crossed?
Because clearly not by upvoting my post. And not by upvoting his post.
But you you have upvoted your own comments under each of our posts.
You are also not voting for either of us as witnesses.
It's up to you of course but given all that I just have an impression that it's all about your self promotion here.

0
0
0.000
avatar
(Edited)

Your wish is my command...gtg and timcliff for witness it is. On it right away.

DONE

0
0
0.000
avatar

I guess there is a binary message based protocol that bitcoin uses for when nodes that can verify transactions (low-memory and full-nodes) talk to each other, like in Bitcoin. Is that right?

0
0
0.000
avatar

I really appreciate this detailed explanation. I have been wondering a bit about setting up a node for a while now, and here I have very specific instructions on how to do it--so thanks.

0
0
0.000
avatar

My pleasure :-)

0
0
0.000
avatar

Great post! Consider to participate to one of the following contests!
Below is a list of some contests/giveaways on Steemit that you should definitely participate in.
The list isn't in any particular order and it isn't exhaustive.

1. Meme Challenge by
fibra59 / https://steewit.com/@fibra59


A entertaining and popular contest to tickle your funny bones, it is sponsored by several Steemians and it'll certainly put you under the meme spotlight.
Tag - memechallenge

2. Open Mic Week by
luzcypher / https://steewit.com/@luzcypher
/
pfunk / https://steewit.com/@pfunk


This contest will allow you to get your musical juices flowing. Make a musical video and submit it now.
Tag - openmic

3. Wild and Strange Contest/Steem-Pocalypse by
papa-pepper / https://steewit.com/@papa-pepper


Two very interesting contests running into their 5th and 3rd seasons respectively, you don't want to miss grabbing a spot on the next edition.
Tag - wildnstrange / steem-pocalypse

4. STEEM Cup Series/Steemit Scramble by
ats-david / https://steewit.com/@ats-david


If you are a sport enthusiast or otherwise, don't miss out on participating in these sporting event related contests.
Check out the latest contest here.

You don't need to be an artist to join. Just interpret an artwork that is posted in your own words.
Tag - artchallenge

0
0
0.000
avatar

I think you might be a victim of a scam / phishing, and above comment was written by a malicious user to lure people into giving up their passwords on a 3rd-party site.
Please change your password immediately.
Others - please do not click on any of above links.

0
0
0.000
avatar

why is flag problem? @gtg

0
0
0.000
avatar

First of all you are posting plagiarized content without even mentioning a source, but that's just a side story (and you decided to flag my posts at -100% flags ... well)

What's more important is that I believe you might be responsible or at least connected to latest phishing/scam incidents. If that will be confirmed you will have more troubles than just few -1% flags for plagiarism.

0
0
0.000
avatar

son 3 paylaşımım benimdir çalıntı değil neden araştırmadınız ben düzeltim hatalarımı ve özgün içerik paylaşmaya dikkat ediyorum.

0
0
0.000
avatar

When Master Gandalf teaches a class lesson...

0
0
0.000
avatar

😂😂😂😂😂😂😂👍👍👍👍

0
0
0.000
avatar

To be candid, I tried to make sense of what this article is all about but I just couldn't. Forgive me.

0
0
0.000
avatar

It really is a detailed explanation. I had a lot of questions answered. Thank you. You are a great person

0
0
0.000
avatar

I guess this week is going to be among the best ones .....i am learning alot ...yesterday and now today about the node ......thanks @gtg .....you people are like the boss here..know everything and we are like searching for if someone will utter a word and we will absorb it...a life more like parasite......thanks

0
0
0.000
avatar

Hold on one moment.

"Dennis! Dennis! Get in here!"

Dennis is the Empire's IT guy.

Gtg, can you repeat everything you just said? Please speak very slowly. Dennis is a bit of a moron.

0
0
0.000
avatar

Short version, especially for you:
"Run steemd, run!"

Unfortunately it can't be slower. Running is something that is expected to be fast.

You can, however, run '--replay' as many times as you want :-)

0
0
0.000
avatar

Great work Gandalf! Although I'm not much a technical guy at my best, I can recognize the potential you are showing to us! Well done my friend, you have my vote for your effort!

0
0
0.000
avatar

Thank you :-)

0
0
0.000
avatar

Sorry if I interrupt your convenience,

You are my inspiration.

I believe you are a good person who will help schoolchildren and starving children @gtg

Last year my friend and I created a community of Charity For Children of the World Generation, which is engaged in social education for children and hunger in order to keep learning for the future,

I have posted on my blog about the Charity For Childrens Community of the World's Generation community. In that post I mentioned your name as my motivator,

If you do not mind, you can appreciate my block for suggestions and feedback so that the Charitable Generation community for Children of the World Generation can continue to help the children.

You are my inspiration.

hopefully you can judge my writing and advise me to keep walking and more children saved from ignorance. I want you to be my teacher.

Thank you...

0
0
0.000
avatar

Inspiration? How on earth you were inspired by me to send such copy&pasted comment? And how's that related to this post?

0
0
0.000
avatar

Congratulations @gtg, this post is the eighth most rewarded post (based on pending payouts) in the last 12 hours written by a Superhero or Legend account holder (accounts hold greater than 100 Mega Vests). The total number of posts by Superhero and Legend account holders during this period was 40 and the total pending payments to posts in these categories was $3762.37. To see the full list of highest paid posts across all accounts categories, click here.

If you do not wish to receive these messages in future, please reply stop to this comment.

0
0
0.000
avatar

Hello @gtg I love this Post please how do I add a wallet and sign/update my witness to this. I succesfully set up a steemd using the above tutorials. its very informative was unhappy when I missed a block using a docker box

0
0
0.000
avatar

Witness basic duties and playing with cli_wallet are not in the scope of this episode and you can find it already on a various tutorials, but from a point described here it's fairly simple: first of all to get cli_wallet you need to build it (above builds only steemd), then run it, set your own password, unlock a wallet, import your active key (required for updating witness parameters), then update with
update_witness "witnessid" "https://steemit.com/" "STM1111111111111111111111111111111114T1Anm" {"account_creation_fee":"0.100 STEEM","maximum_block_size":65535,"sbd_interest_rate":0} true replacing witnessid with your id and that null public key with your own public signing key.
At some point I will release some post with witness 101 and exchanges 101 but for now you need to go through other tutorials that cover such subjects.

0
0
0.000
avatar

Thanks for sharing this, it has helped me

0
0
0.000
avatar
(Edited)

@gtg ... sorry if my question is a bit off topic ... But, how does one broadcast a raw+signed tx to the STEEM blockchain? Is there any way one can do this via HTTP RPC using public api servers? Or, will I need to:

  • setup my own Steem Node in the cloud
  • open ports to receive data
  • use Steemd to broadcast?
0
0
0.000
avatar

Well, just a bit. It's about nodes after all, so don't worry :-)

Yes, all you need is an RPC endpoint (at one of the public API nodes).

What's very on topic is that, in fact, it's enough to use consensus node for such broadcasting (as long as it provides RPC endpoint). In our universe, those nodes that provide such endpoints are most often "full nodes".

Here's an old, but very good read from @xeroc: Steem transaction signing in a nutshell

0
0
0.000
avatar

Yes, all you need is an RPC endpoint (at one of the public API nodes).

Excellent, thank you! So, I assume I can do this with Steemit's API then? I was just worried that all the call methods were read-only.

Would you happen to have any curl examples for broadcasting a tx? If not, that's ok, I'll just go hunting for it. Or, I'll just look through the source code to figure out what parameters the api wants.

Thank you very much for the assistance fellow wizard! :)

0
0
0.000
avatar
(Edited)

Ah! I think I found what I was looking for.


It seems like the hard part is just going to be constructing the message and getting the signatures as Xeroc described ...

0
0
0.000
avatar

Exactly, that would be a hard part but we have few libraries that can help you deal with signing.
The easy part looks like:

{"id":1,"jsonrpc":"2.0","method":"call","params":["network_broadcast_api","broadcast_transaction_synchronous",[{"operations":[["vote",{"voter":"fulltimegeek","author":"gtg","permlink":"steem-pressure-3-steem-node-101","weight":10000}]],"extensions":[]}]]}

but then you need to sign it and even before that to add reference block number and block prefix along with expiration time and to all that you add a signature which the call something like this:

{"id":1,"jsonrpc":"2.0","method":"call","params":["network_broadcast_api","broadcast_transaction_synchronous",[{"ref_block_num":123,"ref_block_prefix":1234567890,"expiration":"2018-03-08T12:34:56","operations":[["vote",{"voter":"fulltimegeek","author":"gtg","permlink":"steem-pressure-3-steem-node-101","weight":10000}]],"extensions":[],"signatures":["signaturesignaturesignaturesignaturesignaturesignaturesignature"]}]]}

That would be hard if you would like to script that signing in bash but existing libraries will do that for you without need of re-inventing the wheel.

0
0
0.000
avatar
(Edited)

@GTG, you are one sexy bastard! lol ... Those curl snippets are a huge aphrodisiac to me ...

Thank you again for all you do and your help. I have looked into libraries, as you mentioned, but I'm trying to do this natively in Android so I don't need any dependencies. I think I have it all figured out now.

Expect some dank apps from me sometime this year :D

0
0
0.000
avatar

Thank you for your explanation. @gtg, and I also appreciate this very detailed explanation, I become more understanding about steemd and after I read this article, my knowledge is increasing. Hopefully this will be useful for steemit development in the future.

Best Regard @ airil280708

0
0
0.000
avatar

Very interesting. I just wish I had the technical skills to actually do this.

0
0
0.000
avatar

Hi, is there a way to get virtual ops with less RAM/Disk usage?

api.steemit.com is very slow. The get_ops_in_block takes 10 seconds. I guess there is a DDOS prevention machanism. It leads that my piece of software cannot process blocks every 3 seconds. Therefore I'm looking for own steem node, but requirements are relativelly high

0
0
0.000
avatar

Not yet, but soon(-ish) I guess:
https://github.com/steemit/steem/issues/2099

Currently you can try to run somewhat limited node suited for your specific needs (for example without tags and follows plugin and filtered account history)

0
0
0.000
avatar

thank you for the infonya Mr. @ gtg .. your review is very clear, complete and solid..

0
0
0.000
avatar

Thanks for this great post keep it up and have a great weekend

0
0
0.000
avatar

Whahahaha... Great writeup Thubs up But i guess its too much for me to handle.
Great share :) Catch my vote

0
0
0.000
avatar

Thanks for this very detailed explanation such a great really useful thanks alot

0
0
0.000
avatar

I hope people here will work for steemit a little while, and people will see the beauty of it

0
0
0.000
avatar

Steem node....wow...so much to learn still...

0
0
0.000
avatar

Hello steemit witness mr. Gandalf. Im Sharil from Malaysia. Actually my team and i are creating big community in Malaysia. Since blogging is part of hobby among Malaysian community, we would like to create community to use steemit platform as blogging carrier. An unique of our direction is using steemit in Malay language. Because 80% of our citizens is Melayu that using Malay language. A lot of content will be post, comment and curating especially in Art, music, unique tradition, and etc. We have to attract our community in Malaysia by using Malay language and it will be happen like facebook, instagram and twitter adoption among our citizens.

0
0
0.000
avatar

Kindly give some advice or delegated way to grow our community especially newbies. Beside, our team will be part of curating team in Malay language. If you interest about our project.We can provide detail workpaper planning.

0
0
0.000
avatar

Hello Sharil, welcome to Steem! :-)
The biggest challenge for every community is to focus on an original, high quality content.
Rewarding real talented authors and fighting plagiarism is really important for every community. Especially, for non-English content it is crucial for local communities to take over those duties (general public couldn't 'e-steem-ate' effectively such content).
You might want to contact @acidyo about OCD.

0
0
0.000
avatar

@gtg excuse me for so brutal invasion and offtopic. I want attemp attention for issue of whaling by aboriginal and find way for change this. As a way I think that support and curation by crypto whales to whales animal could become stop whaling. Please see my introduce post and thank you for any feedback.
https://steemit.com/introduseyourself/@uberwhales/we-can-be-more-than-just-steemian-s

0
0
0.000
avatar

While Steem is a great platform, I don't think that your proposal is a viable use case.
First of all, reward pool is to distribute rewards among authors that produce original, high quality content.
I don't believe that many whalers can do that. And if they can, then they will be rewarded for their content, not because they are nice enough to stop killing whales.

Stating "for preserve national identity and culture" as a reason for killing whales is enough to think that it would not work. Tricky part here is, that if it would... then they are lying anyway and their reasoning is not valid.

0
0
0.000
avatar

Hello. Thanks for the Steem Pressure series so far.

I'm investigating setting up a local node to generate a local copy of the steem blockchain to in turn create a database. I had initialy tried using steem python to generate a .json file of the blockchain using the public api, but that was evidentaly not ideal due to the time it would take to complete. Would you be able to give me an idea of the hardware, and the node plugins, that would be required to achieve this? I have so far not came accross a tutorial which provides instruction as to this, and would be greatful for any help you could provide.

0
0
0.000
avatar

Yes, definitely having a local steemd node will improve performance of such data gathering. As for configuration/plugins needed it all depends on which API calls you will be using to get that you need.
In worst case it would be a "full node" i.e. one with full bells and whistles (there should be some post about it where I provided my config for a full node, it's old but no much things have changed).
However, it's possible for you to optimize the config by choisng only those plugins you need (or maybe even ops filtering for account history).
Full node can currently run with 128GB RAM (or even 64GB) if you have very fast storage backend (for swap), but the more RAM, the faster your node will be able to answer your requests.

0
0
0.000
avatar

Thanks for taking the time to answer :) What I had in mind would require a record of all transfers from and to an account as well as rewards received as a minimun.

I'm not sure if this is something you may have tried, but what would be the likely result of trying to run a full node with less RAM (perhaps 32GB or 16GB)? Would the node fail to run, or would it just be much slower?

0
0
0.000
avatar

It would so slow that at some point it wouldn't be able to process blocks faster than they are coming, spending all its time on I/O operations.

0
0
0.000
avatar

Hola! ¿Como estas @gtg? Realmente aprecio esta informacion, gusto de saludarte.

0
0
0.000
avatar

hi @gtg, as mentioned in chat i was going to visit each of these posts so i can learn a little more. Thank you for putting them together. I have learned a lot ( but a lot more to go)

You did refer to a follow up post using docker, but I have not found that? Running docker is easy enough, maybe if you are considering doing a post, it would be more about 'understanding docker' than running docker, its just to easy to copy a piece of code and have no clue what it means or does.

Im also wondering now that some time has passed since this series, how much if any have the above specs changed.

Finally, with HF20 on the way, will you be doing a post around the update?

Kind Regards

Paula
@steemcommunity witness

0
0
0.000
avatar

Oh, I definitely want to continue Steem Pressure series I've even collected some materials for updates but writing posts takes me a lot of time.
I will try to improve frequency.

0
0
0.000