Instructions for building your own Steem Testnet

in steem •  2 months ago

Testnet.png


I've recently setup my testnet for Steem and I noticed that there isn't much documentation on how to do that, so I decided to write a quick guide.

Requirements

Ubuntu: 16.04
8GB+ RAM
10GB+ Diskspace

I've got a seperate boot-partition with Linux, but docker would work as well (however I will not cover docker in this guide.)

Instructions


Step 1: Install Packages

sudo apt-get install -y autoconf automake cmake g++ git libssl-dev libtool make pkg-config python3 python3-jinja2 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 libsnappy-dev libbz2-dev doxygen libncurses5-dev libreadline-dev perl

Step 2: Clone Steem

git clone https://github.com/steemit/steem # or https://github.com/SteemCommunity/steem
cd steem
git checkout master # or another branch
git submodule update --init --recursive

Step 3: Build Steem

mkdir build && cd build/
cmake -DENABLE_COVERAGE_TESTING=ON -DBUILD_STEEM_TESTNET=ON -DLOW_MEMORY_NODE=OFF -DCLEAR_VOTES=ON -DSKIP_BY_TX_ID=ON -DCHAINBASE_CHECK_LOCKING=OFF ..
make -j$(nproc) steemd cli_wallet
make -j$(nproc) chain_test # optional for tests

Step 4: Edit Config

# Start and stop steemd once to create the default config
./programs/steemd/steemd -d testnet/

# You'll see something like this
# ------------------------------------------------------
#
#            STARTING TEST NETWORK
#
# ------------------------------------------------------
# initminer public key: TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4
# initminer private key: 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n

# COPY the private key
nano testnet/config.ini

After you've copied the private key and opened up the config.ini, change the following lines

# name of witness controlled by this node (e.g. initwitness )
witness = "initminer"

# WIF PRIVATE KEY to be used by one or more witnesses or miners
private-key = 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n

# Enable block production, even if the chain is stale.
enable-stale-production = true

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = 0

# Local http endpoint for webserver requests.
webserver-http-endpoint = 127.0.0.1:8090

# Local websocket endpoint for webserver requests.
webserver-ws-endpoint =127.0.0.1:8091

Step 5: Start Steemd

Once you've configured the config.ini, start steemd.

./programs/steemd/steemd -d testnet/

It will take roughly half a minute and then you should see initminer producing blocks.

Which means: you have now a testnet running. Congratulations!

(Optional) Step 6: Start CLI_Wallet

./programs/cli_wallet/cli_wallet --server-rpc-endpoint="ws://127.0.0.1:8091"

# set_password & unlock
import_key 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n
create_account "initminer" "testaccount" "" true

(Optional) Step 7: Run Tests

If you haven't build them before:

make -j$(nproc) chain_test

Afterwards, you can run all of them or a specific one with the -t flag.

./tests/chain_test # -t "basic_tests"

More info about testing and different types of tests: https://github.com/steemit/steem/blob/master/doc/devs/testing.md

Also make sure to check out the developer resources: https://developers.steem.io/testnet/index


And that's it.

I hope this helps with setting up your own testnet and if there are any questions or something else, let me know in the comments below!

I'll get back to coding.

@therealwolf


If you believe that I'm of value for Steem, then please vote for me as witness. You can also set me as a proxy and I'll vote on great witnesses for you. You can learn more about me and my witness infrastructure on therealwolf.me.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

thanks for the instructions :)

Solid.

Great write-up! Is a testnet like this directly starting with HF20 or does it also gradually activate different HFs on predefined blocks?

Is it possible to create something like steemittest.com which would run on testnet but users would be able to log in and interact with blockchain? Would probably require taking snapshot of the main chain.

Uhm, so what does a testnet do? lol

Superb bro thanks for the information. ....

Posted using Partiko Android

Thank you so much @therealwolf! Great contribution 👍