Steem Pressure #7: Go Fork Yourself. Step by step guide to building and setting up a MIRA powered HF21-ready Steem consensus node.

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@gtg·
0.000 HBD
Steem Pressure #7: Go Fork Yourself. Step by step guide to building and setting up a MIRA powered HF21-ready Steem consensus node.
The date of the next, 21st HardFork, has been set, and it is approaching quickly.

There's plenty of info around the web on how to build a Steem node from scratch.
I also wrote a guide some time ago: [Steem Pressure #3: Steem Node 101](/@gtg/steem-pressure-3-steem-node-101).
But the trouble is that such tutorials are getting old and obsolete.

My previous one was made for version 19 at its early development stages.
Now, we have version 21 released, so it is a good opportunity for an update.

<center>
https://www.youtube.com/watch?v=7IkI6yVvzHI<sup>Video created for [Steem Pressure](https://steemit.com/created/steem-pressure) series.</sup>
</center>


# Hardware
Nothing fancy.
Actually we will use something reasonably modest and cheap.

Meet the **`mirabelle`**:
**Intel Xeon CPU W3530 @2.80GHz**
**16GB DDR3 ECC 1333MHz RAM**
**2x 240GB SSD**

# Operating system
Ubuntu 18.04 LTS

Clean, basic server install.
No fancy tweaks or customizations.
`/home` is **RAID0** because we need speed and space.
In the case of a failure, we just use a new one.

# Let's Go
Few steps needs to be done as `root`:

###### Make sure that your system is up to date:

`apt update && apt upgrade`

###### Use `ntp` or `chrony` to keep your system clock in sync:

`apt install ntp`

###### Create an account for steem purposes:

`useradd -s /bin/bash -m steem`

###### Set appropriate values for open files limits needed by MIRA:

```
cat << 'EOF' >> /etc/security/limits.conf
steem soft nofile 65535 
steem hard nofile 65535
EOF
```

![limits-conf.gif](https://cdn.steemitimages.com/DQmNdB8P3krYeCKN7nSW5EPTU2JcSRxLbSFRPgYX1qyv8CW/limits-conf.gif)

###### Install packages needed for building Steem:
```
apt install \
  automake \
  build-essential \
  cmake \
  doxygen \
  libbz2-dev \
  libboost-date-time-dev \
  libboost-chrono-dev \
  libboost-context-dev \
  libboost-coroutine-dev \
  libboost-filesystem-dev \
  libboost-iostreams-dev \
  libboost-locale-dev \
  libboost-program-options-dev \
  libboost-serialization-dev \
  libboost-system-dev \
  libboost-test-dev \
  libboost-thread-dev \
  libreadline-dev \
  libsnappy-dev \
  libssl-dev \
  libtool \
  ncurses-dev
```

###### Now we continue as a user `steem`:

`su - steem`

###### Clone the steem repository:

`git clone https://github.com/steemit/steem`

###### Checkout the latest release:

`cd steem`
`git checkout v0.21.0`

###### Create build directory:

`mkdir ~/build`

###### Configure steem build:

`cd ~/build`
```
cmake -DCMAKE_BUILD_TYPE=Release \
  -DLOW_MEMORY_NODE=ON \
  -DCLEAR_VOTES=ON \
  -DSKIP_BY_TX_ID=OFF \
  -DENABLE_MIRA=ON \
  -DSTEEM_STATIC_BUILD=ON \
  ../steem
```

![git-checkout-cmake.gif](https://cdn.steemitimages.com/DQmer9Kr9r3TgxJZVmoKTx4xPHuf8pZh3iYimrKULfjCGSL/git-checkout-cmake.gif)

##### Build `steemd`:

`make -j4 steemd`

![build-steemd.gif](https://cdn.steemitimages.com/DQmUGjqx58Q68SYQAYi3aGZksXuy3LNbzUmzpUG9TTta238/build-steemd.gif)

###### Build `cli_wallet`:

`make -j4 cli_wallet`

###### Create local bin directory for convenience:

`mkdir ~/bin`

###### Copy `steemd` and `cli_wallet` binaries to local bin directory:

`cp -v ~/build/programs/steemd/steemd ~/bin`
`cp -v ~/build/programs/cli_wallet/cli_wallet ~/bin`

###### Congratulations!

`~/bin/steemd --version`

Now you have required binaries.
Time to configure and run your node.

###### Create proper directory tree:

`mkdir -pv ~/.steemd/blockchain`

###### Create minimalistic config file for consensus node:

```
cat << 'EOF' >> ~/.steemd/config.ini
plugin = witness
plugin = condenser_api network_broadcast_api block_api
webserver-http-endpoint = 127.0.0.1:8090
webserver-ws-endpoint = 127.0.0.1:8090
EOF
```

![config-ini.gif](https://cdn.steemitimages.com/DQmfJxAnAk2jvJMEoo3U3ivLDhie3vPvXxmSU8RfFLMrYcQ/config-ini.gif)

Yes, you really don't need more than that for a very basic node defaults are OK.

To speed up reaching the head block:
###### Download blocks from a trusted source:

```
wget https://gtg.steem.house/get/blockchain/block_log \
  -O ~/.steemd/blockchain/block_log
```

![block_log.gif](https://cdn.steemitimages.com/DQmU7ctGwLErG6D3dTXyFeRgGxes3zXqq9KEXP52bvT1645/block_log.gif)

###### Now run:
`~/bin/steemd --replay`
and have fun!

This configuration is expected to reach the head block within 72 hours.

# Footnotes:
- You might want to run above inside `screen`.
- Once it replays all the blocks from `block_log`, it will sync with Steem p2p network up to the head block and continue running.
- Next time start `steemd` without `--replay`. You need to do that only if your changes will affect the state (such as adding or re-configuring plugins).
- You might want to add `account_by_key` (for `cli_wallet`’s `list_my_accounts` feature) and `account_history` (to track your own account history) but in this guide I wanted to focus on a simplest case.
- You need to wait for replay to complete before you can use API endpoint.


# Previous episodes of Steem Pressure series

[Introducing: Steem Pressure #1](/@gtg/introducing-steem-pressure-1)
[Steem Pressure #2 - Toys for Boys and Girls](/@gtg/steem-pressure-2-toys-for-boys-and-girls)
[Steem Pressure #3 - Steem Node 101](/@gtg/steem-pressure-3-steem-node-101)
[Steem Pressure: The Movie ;-)](/@gtg/steem-pressure-the-movie)
[Steem Pressure #4 - Need for Speed](/@gtg/steem-pressure-4-need-for-speed)
[Steem Pressure #5 - Run, Block, Run!](/@gtg/steem-pressure-5-run-block-run)
[Steem Pressure #6 - MIRA: YMMV, RTFM, TLDR: LGTM](/@gtg/steem-pressure-6-mira-ymmv-rtfm-tldr-lgtm)
Stay tuned for next episodes of Steem Pressure :-)

---
<sup>
If you believe I can be of value to Steem, please vote for me ([**gtg**](/@gtg)) as a witness on [Steemit's Witnesses List](https://steemitwallet.com/~witnesses) or set ([**gtg**](/@gtg)) as a proxy that will vote for witnesses for you.
***Your vote does matter!***
You can contact me directly on [steem.chat](https://steem.chat), as [Gandalf](https://steem.chat/direct/gandalf)
</sup>
<center>
https://steemitimages.com/DQmSheuDfCHizk1xvHPcrFjQNKfBzgun9UXDxdEp6JJCum9/steem_wide.png
[Steem On](/)
</center>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,