Skip to content
Snippets Groups Projects
Commit b2968282 authored by inertia's avatar inertia
Browse files

Merge branch 'setup-testnet' into 'develop'

refactored to hive

See merge request !43
parents 343dab03 ab7ddd50
No related branches found
No related tags found
2 merge requests!44deploy to production,!43refactored to hive
......@@ -2,7 +2,7 @@
title: Setting Up a Testnet
position: 1
description: |
"Quick-start" for deploying a Steem-based Testnet.
"Quick-start" for deploying a Hive-based Testnet.
exclude: true
layout: full
canonical_url: setting-up-a-testnet.html
......@@ -24,7 +24,7 @@ But in this tutorial, we will go over the **no docker** approach which will crea
If you want full details on setting up a testnet using Tinman, head over to that github:
https://github.com/steemit/tinman
https://gitlab.syncad.com/hive/tinman
Otherwise, let's do the complete Quick Start:
......@@ -32,7 +32,7 @@ Otherwise, let's do the complete Quick Start:
* [Minimum Requirements](#minimum-requirements)
* [Installing Tinman](#installing-tinman)
* [Building `steemd`](#building-steemd)
* [Building `hived`](#building-hived)
* [Snapshot](#snapshot)
* [Configure Tinman](#configure-tinman)
* [Actions](#actions)
......@@ -45,11 +45,11 @@ Otherwise, let's do the complete Quick Start:
### Minimum Requirements<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
This tutorial assumes Ubuntu Server 18.04 LTS 2GB RAM and 200GB SSD/HDD.
This tutorial assumes Ubuntu Server 18.04 LTS 16GB RAM and 300GB SSD/HDD.
Running a testnet can be done on minimal hardware, but in order to build a snapshot of accounts, you should already be running your own local Steem node because getting the snapshot is time consuming and if this process is interrupted, you'll have to start over.
Running a testnet can be done on minimal hardware, but in order to build a snapshot of accounts, you should already be running your own local Hive node because getting the snapshot is time consuming and if this process is interrupted, you'll have to start over.
Not only are we going to use `tinman` to build the snapshot, we also need to compile `steemd` and configure it to run our testnet.
Not only are we going to use `tinman` to build the snapshot, we also need to compile `hived` and configure it to run our testnet.
### Installing Tinman<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
......@@ -63,16 +63,16 @@ virtualenv -p $(which python3) ~/ve/tinman
source ~/ve/tinman/bin/activate
mkdir -p ~/src
cd ~/src
git clone --branch master https://github.com/steemit/tinman.git
git clone --branch master https://gitlab.syncad.com/hive/tinman.git
cd tinman
pip install pipenv
pipenv install
pip install .
```
### Building `steemd`<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
### Building `hived`<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
Next, let's build `steemd`. Note, we are using the `develop` branch but you can use whatever branch you want. To see a list of branches that are currently being worked on, refer to: https://github.com/steemit/steem/branches/active
Next, let's build `hived`. Note, we are using the `develop` branch but you can use whatever branch you want. To see a list of branches that are currently being worked on, refer to: https://gitlab.syncad.com/hive/hive/-/branches/active
```bash
sudo apt-get install autoconf automake autotools-dev bsdmainutils \
......@@ -81,27 +81,27 @@ sudo apt-get install autoconf automake autotools-dev bsdmainutils \
python3-pip nginx fcgiwrap awscli gdb libgflags-dev libsnappy-dev zlib1g-dev \
libbz2-dev liblz4-dev libzstd-dev
cd ~/src
git clone --branch develop https://github.com/steemit/steem.git
cd steem
git clone --branch develop https://gitlab.syncad.com/hive/hive.git
cd hive
git submodule update --init --recursive
mkdir -p build
cd build
STEEM_NAME=steem-tn
HIVE_NAME=hive-tn
cmake \
-DCMAKE_INSTALL_PREFIX="~/opt/$STEEM_NAME" \
-DCMAKE_INSTALL_PREFIX="~/opt/$HIVE_NAME" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_STEEM_TESTNET=ON \
-DBUILD_HIVE_TESTNET=ON \
-DLOW_MEMORY_NODE=OFF \
-DCLEAR_VOTES=ON \
-DSKIP_BY_TX_ID=ON \
-DSTEEM_LINT_LEVEL=OFF \
-DHIVE_LINT_LEVEL=OFF \
-DENABLE_MIRA=ON \
..
mkdir -p ~/opt/$STEEM_NAME
mkdir -p ~/opt/$HIVE_NAME
make -j$(nproc) install
```
**A note on `steemd` branches:** Selecting a branch depends on why you're running a testnet. If you are doing blockchain development, you're likely going to select your own branch where you've done some work that needs to be verified. If you're a witness, you're likely going to select `develop` or `master` to check stability. If you're an application developer, you should probably select the `stable` branch because you want to test your app more than test the blockchain. Application developers might also select `develop` to try out blockchain features that have not been released yet.
**A note on `hived` branches:** Selecting a branch depends on why you're running a testnet. If you are doing blockchain development, you're likely going to select your own branch where you've done some work that needs to be verified. If you're a witness, you're likely going to select `develop` or `master` to check stability. If you're an application developer, you should probably select the `stable` branch because you want to test your app more than test the blockchain. Application developers might also select `develop` to try out blockchain features that have not been released yet.
### Snapshot<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
......@@ -110,12 +110,12 @@ The snapshot is a copy of all accounts on the blockchain plus some other propert
```bash
cd ~/src/tinman
source ~/ve/tinman/bin/activate
tinman snapshot -s http://mainnet-steem-node:8090 | pv -l > snapshot.json
tinman snapshot -s http://mainnet-hive-node:8090 | pv -l > snapshot.json
```
In the above example, we assume that `http://mainnet-steem-node:8090` is our Steem node on our local network. If you use a public node to build the `snapshot.json` file instead (not recommended), just remember that this process could take quite a while and can be interrupted or rate-limited. You should consider running your own node.
In the above example, we assume that `http://mainnet-hive-node:8090` is our Hive node on our local network. If you use a public node to build the `snapshot.json` file instead (not recommended), just remember that this process could take quite a while and can be interrupted or rate-limited. You should consider running your own node.
As of September 2019, assuming the Steem mainnet node is local, this process takes approximately 15 minutes to produce a 3 GB output file.
As of August 2020, assuming the Hive mainnet node is local, this process takes approximately 20 minutes to produce a 3.6 GB output file.
### Configure Tinman<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
......@@ -126,7 +126,7 @@ cd ~/src/tinman
cp txgen.conf.example txgen.conf
```
We can optionally adjust `total_port_balance` to adjust the supply on the testnet. But keep in mind, there is a blockchain limit defined by `STEEM_INIT_SUPPLY`.
We can optionally adjust `total_port_balance` to adjust the supply on the testnet. But keep in mind, there is a blockchain limit defined by `HIVE_INIT_SUPPLY`.
### Actions<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
......@@ -143,13 +143,13 @@ Building the actions is pure data-processing that doesn’t communicate with the
### Configure Bootstrap Node<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
```bash
STEEM_NAME=steem-tn
HIVE_NAME=hive-tn
BOOTSTRAP=~/data/bootstrap
STEEMD=~/opt/$STEEM_NAME/bin/steemd
$STEEMD --data-dir=$BOOTSTRAP
HIVED=~/opt/$HIVE_NAME/bin/hived
$HIVED --data-dir=$BOOTSTRAP
```
At the startup banner, press `^C` (Ctrl+C) to exit `steemd`. As a side effect, a default data-dir is created. Now we can purge the empty blockchain and create `config.ini` as follows:
At the startup banner, press `^C` (Ctrl+C) to exit `hived`. As a side effect, a default data-dir is created. Now we can purge the empty blockchain and create `config.ini` as follows:
```bash
rm -Rf $BOOTSTRAP/blockchain
......@@ -173,26 +173,26 @@ webserver-http-endpoint = 0.0.0.0:18751
webserver-ws-endpoint = 0.0.0.0:18752
```
Save `config.ini` and start `steemd`:
Save `config.ini` and start `hived`:
```bash
$STEEMD --data-dir=$BOOTSTRAP
$HIVED --data-dir=$BOOTSTRAP
```
### Bootstrap Node<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
Note, the secret can be any string. In this tutorial, we are using `new-steem-rocks` as the secret. Keep in mind that any person with knowledge of the secret will be able to transact using any account on your testnet.
Note, the secret can be any string. In this tutorial, we are using `hive-is-alive` as the secret. Keep in mind that any person with knowledge of the secret will be able to transact using any account on your testnet.
```bash
STEEM_NAME=steem-tn
GET_DEV_KEY=~/opt/$STEEM_NAME/bin/get_dev_key
SIGN_TRANSACTION=~/opt/$STEEM_NAME/bin/sign_transaction
HIVE_NAME=hive-tn
GET_DEV_KEY=~/opt/$HIVE_NAME/bin/get_dev_key
SIGN_TRANSACTION=~/opt/$HIVE_NAME/bin/sign_transaction
cd ~/src/tinman
source ~/ve/tinman/bin/activate
( \
echo '["set_secret", {"secret":"new-steem-rocks"}]' ; \
echo '["set_secret", {"secret":"hive-is-alive"}]' ; \
cat bootstrap-init.actions \
) | \
tinman keysub --get-dev-key $GET_DEV_KEY | \
......@@ -211,14 +211,14 @@ Once the bootstrap is complete and we no longer need fastgen to import actions,
We need to keep the Bootstrap Node running, so do the following in a new shell session:
```bash
STEEM_NAME=steem-tn
HIVE_NAME=hive-tn
SEED=~/data/seed
STEEMD=~/opt/$STEEM_NAME/bin/steemd
GET_DEV_KEY=~/opt/$STEEM_NAME/bin/get_dev_key
$STEEMD --data-dir=$SEED
HIVED=~/opt/$HIVE_NAME/bin/hived
GET_DEV_KEY=~/opt/$HIVE_NAME/bin/get_dev_key
$HIVED --data-dir=$SEED
```
Again, at the startup banner, press `^C` (Ctrl+C) to exit `steemd`.
Again, at the startup banner, press `^C` (Ctrl+C) to exit `hived`.
```bash
rm -Rf $SEED/blockchain
......@@ -246,10 +246,10 @@ echo "witness = \"init-$N\"" >> $SEED/config.ini
done
```
Add their private keys as well, note we are assuming the secret is `new-steem-rocks` for this tutorial:
Add their private keys as well, note we are assuming the secret is `hive-is-alive` for this tutorial:
```bash
for K in $($GET_DEV_KEY new-steem-rocks block-init-0:21 | cut -d '"' -f 4)
for K in $($GET_DEV_KEY hive-is-alive block-init-0:21 | cut -d '"' -f 4)
do
echo "private-key = $K" >> $SEED/config.ini
done
......@@ -290,33 +290,33 @@ witness = "init-18"
witness = "init-19"
witness = "init-20"
witness = "init-21"
private-key = 5JDt8ydrkcr1DpgKychydc3iHYLAkHAw4gvKNTuqAFhd71tj6ZQ
private-key = 5KcCrHxKAMJ9kzLzkELSxJBuC2D7sTeab4Ne9SksLkacBFic5pj
private-key = 5J6RRNLd8LcL2ZuHGzKFukc4EqhvgHWRkMQHjnQCz528ubL27Y8
private-key = 5HqwZyAenu16JV4GLHDdKAXGprdGpAqLGZ6ryK1s3rmkUYxRMSv
private-key = 5Kg6doMKYJyPqgc6Xq6qXmGdLBfZATEGoTLWpWuAGvGHUtABWH2
private-key = 5Hw7B3vVSg3mMiRBXie8AUmTphJTThA6trDjQ4M36vU77Xodz8g
private-key = 5KUZUiLHqHj9Yd37EEqrj4QHmuJqi4jc1Vhf8KhH7uxP2BwJFgL
private-key = 5Je57g7PartUHQi9k7pZMbZmBe4M1DvJPz6seC2hqcWLjauh9Jh
private-key = 5J9vVvc3kWBwuqwmN8veAmxXbGwndjVZCRuWZWnLdo19Xa5eLZQ
private-key = 5KGyprgawwQXcUDnEukfRdc6QZpwdp8Y8DNswPBd9kNApHuFWbC
private-key = 5J6Jw9cn1ikkstG2NTMt116Ugg7RnsQd4DziiUsAgXVoRqdkGKD
private-key = 5Jt3EZnPoeWvG1Not9tNZ32MornR7Np6v2RAv1c4hwHbgJ1bQPr
private-key = 5KBCLqV2RPwoaUFhFjVwz4Jfq9WzMVVFDxvaeW7ZC6v1PKVZdRU
private-key = 5KaqFR7dbkhFAs5qZ63wjiXZSDviaRkDoE216v889hQoxwwHUsB
private-key = 5JQdnLjjdVMBdNwBgHHEKsUtXirXGdUfJZhVqUBsxCs3Ubn7dcq
private-key = 5K5puF2p8M5svXRGuJqCjwSk1Z41MZ5GtqCktSSX5vhFSWffy3r
private-key = 5Jno5L7jYMxQVehuGy2kAM9rtCdkRyrk97eokMzLro1Rm8CUDUx
private-key = 5KPEWXQnipNHaKaWjjKQ3K3yF5e22eFhu9ozALPhtGaBAfUxckp
private-key = 5JMcAJkWv9Nvy5Pt9vBZmzTymHxrmKgYXB6ekSF9sBgMHyYE2TC
private-key = 5JksFmSJLrFyq3YzdvRWcWzbqKQv4vrFaNEg8ix2zwCmR9JeTW3
private-key = 5JrMAjLaM48dwBco5khuB6FuGasaSxWenwbpqEBL6u4bqTtBgYY
private-key = 5J1giwxi3QwU56N7J4WMaJiRaRmfnp5F27QPZ7itnW4o7ePuUs2
private-key = 5KV3k9PJzrE6h7gvnZcrfXBjazZZ6UdCQjfePfv7hxbmWMFtZ1r
private-key = 5JypUTzFq4zuyowWCjUJwsmph2Gwx49hUMVpAYT1PzbnmUDG4sh
private-key = 5JqvwS7jQDY5wyCeQ9wBKAx6XgoLBf4hZZz6Cd3rb5NCP3pMiZ7
private-key = 5JWQaGiV8Z9ssNCCTm5Hx2VdhEV8G82nV6RwSwAWBYQWfoM3Dzf
private-key = 5KW5fY5gpTBYt7YJNBnfPWc2BzE1o6GJiLB8Hc2YaZ7sz71VFtc
private-key = 5K8aRoTDwELSyZJZLkv6mPQy2tQRQ3p2cqNVxK2tMQZfrZThg2R
private-key = 5KCVYYBwkDt2TY7Eaw3TJvLRhEdxR3ruMVqyN6RPcbbCSLhDTbu
private-key = 5Jf1sxJhTo4ZEog5LDxfeA8ZFsFCivtMb2HXmx7ndw7mgq15Qqk
private-key = 5Ki39i3NL6TyxRXN7d2aJFPD2PEb4WXx1t7KrXc6KQqm5Zfame2
private-key = 5K2B9RhzdxhpuMxXCPszXgjJYqPD6PC66zmour3cfmGoLLRcNfa
private-key = 5J2sv5ELyuumaVeXpBJFE92dphvnyjmkLi2AyY28hr2iYPZ7Qh6
private-key = 5JZjV98gnLGm7AxVdRbiDT5DU6pibmzUUu7bxACR87nxawj1gNC
private-key = 5JFDyVEEVHAyang92s35cVH7t27GoeBg4uthWghV3yDdvj3GPcX
private-key = 5KTJe4qmj7jcubLGxKQ4WB52akWkRC98sJGbNRsxjj9yN73GGTy
private-key = 5KKxuTpqXWRsxzbJKdQCfK3mLJ4wqZ9eTswqtaQQ7bEaqEqGzHh
private-key = 5KV3ynnzdun28k9kJFxJZYvKUv8rPoq3bNVWajucvkCy9S9bMCv
private-key = 5JBD9uVVFD6NcRo6nZnAjFKYf2RqfPRZHd8PWGJNzEnfmmcqi8K
private-key = 5JiT5h3dxmiwUmfserh5yW8fjuc4zSSTkLL7t72SioqWKRJ7Sd3
private-key = 5JdVzBLVucfHpfh9gupu5j4aQT5oCSuRLhcJSs2bqvNjEVMRmSt
private-key = 5JogZpTZurEK67skra7YkAJ7hHNBuoyScowDr82nbWoYXndeWRH
```
Save `config.ini` and start `steemd`:
Save `config.ini` and start `hived`:
```bash
$STEEMD --data-dir=$SEED
$HIVED --data-dir=$SEED
```
At this point, our Seed Node will sync blocks from the Bootstrap Node.
......@@ -332,9 +332,9 @@ Congratulations! Your testnet is running!
If you'd like your testnet to mirror mainnet transactions as they happen, you should run the gatling module. Make sure your Seed Node is fully sync'd before running gatling. Also make sure you use the same secret.
```bash
STEEM_NAME=steem-tn
GET_DEV_KEY=~/opt/$STEEM_NAME/bin/get_dev_key
SIGN_TRANSACTION=~/opt/$STEEM_NAME/bin/sign_transaction
HIVE_NAME=hive-tn
GET_DEV_KEY=~/opt/$HIVE_NAME/bin/get_dev_key
SIGN_TRANSACTION=~/opt/$HIVE_NAME/bin/sign_transaction
cd ~/src/tinman
source ~/ve/tinman/bin/activate
......@@ -342,7 +342,7 @@ source ~/ve/tinman/bin/activate
cp gatling.conf.example gatling.conf
( \
echo '["set_secret", {"secret":"new-steem-rocks"}]' ; \
echo '["set_secret", {"secret":"hive-is-alive"}]' ; \
tinman gatling -c gatling.conf -f 0 -t 0 -o - | tinman prefixsub \
) | \
tinman keysub --get-dev-key $GET_DEV_KEY | \
......@@ -354,7 +354,7 @@ tinman submit --realtime -t http://127.0.0.1:8751 \
### Troubleshooting<a style="float: right" href="#sections"><i class="fas fa-chevron-up fa-sm" /></a>
**Problem:** Got an error while trying to compile `steemd`:
**Problem:** Got an error while trying to compile `hived`:
`c++: internal compiler error: Killed (program cc1plus)`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment