The Complete Guide to Setup Steem Development Environment in Ubuntu

in #steem8 years ago (edited)

There are several guides to setup steem mining/development but some instructions are missing so I gathered information and tips from here and there.
I recommend you using Ubuntu version 15.10 or 16.04. (14.04 doesn’t have boost library so it takes too much time to build boost.). I use 16.04.

- Public RPC Nodes

Actually, you don’t need to build you own local RPC node if you just want to make a tiny script.
Fortunately, there are public nodes which is served by @jesta and @xeroc.

You can find information and RPC node address in here.

But, if you need to make serious applications with your team or to service products, I recommend you build your own RPC node on your server or local network. You can get faster access from RPC node than remote nodes. It’s worth it.

- If you don’t want to build the steem on your machine

Also, fortunately @mahnunchik serves steem binaries by OS. So, You can use it instead.
https://github.com/mahnunchik/steem/releases

1. Dependency

This is full dependency list to compile steem binary and setup if you use Ubuntu 16.04

sudo apt-get install screen autoconf autotools-dev build-essential cmake g++ git libboost-all-dev libboost-dev libbz2-dev libdb++-dev libdb-dev libicu-dev libreadline-dev libssl-dev libtool openssl python-dev uuid-dev ncurses-dev doxygen qt5-default gcc-4.9 g++-4.9 cmake make libbz2-dev unzip

2. Setting swap space

If your machine has small RAM space especially in cheap vps, you should add swap space on your system. Otherwise, you might get compile error.(e.g. g++: internal compiler error: Killed (program cc1plus)). I recommend at least 2GB.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile 
sudo mkswap /swapfile
sudo swapon /swapfile 

3. Building Steem Binaries

Type this five lines of script.

git clone https://github.com/steemit/steem
cd steem
git submodule update --init --recursive
cmake -DENABLE_CONTENT_PATCHING=OFF .
make

Maybe it takes more than 15 minutes so just take a coffee break.

4. Downloading blockchain snapshot

Now the size of Steem blockchain is about 2.4G. Syncing previous blocks on the steem program takes half day to full day. @dab serves offline snapshot on his server.

wget http://steemd.ru/files/steem-blocks-and-index-2016-08-23-04-00.zip

The other is http://www.steemitup.eu/ by @steemychicken1 but this is not working now. The snapshot stopped at Aug 10.

Download and place the extracted witness_node_data_dir folder to same directory with steemd binary (You can find binary in here : steem/programs/steemd/).
../steemd/
|->steemd
|->witness_node_data_dir/

5. Modifying configuration file

Execute the steemd binary and exit(Ctrl + C) after 15 seconds. Then you can see config.ini file in the witness_node_data_dir folder. Open it with vim or nano.

- Add seed nodes
Add seed nodes refer to this website. Choose seed nodes near with your server.

seed-node = seed.steemed.net:2001 
seed-node = seed.steemd.com:34191 
seed-node = 52.4.250.181:39705 
seed-node = seed.zapto.org:2001 
seed-node = seed.jesta.us:2001 
seed-node = seed.cubeconnex.com:2001 
seed-node = 212.47.249.84:40696 
seed-node = 104.199.157.70:2001 
seed-node = 46.252.27.1:1337 

- Setup your RPC endpoint

rpc-endpoint = 127.0.0.1:8090

- Add public api and plugins

public-api = database_api login_api network_broadcast_api follow_api market_history_api
enable-plugin = witness account_history tags follow market_history

6. Now it’s time to start your own node

Setup is done so it’s time to run our node. You can use screen command which makes a virtual terminal.

screen -dmS steem ./steemd 

This command makes steemd start to run on the virtual terminal. This virtual terminal will not be closed when you logout. And you can leave the terminal with Ctrl + A D.

screen -r steem

You can recover the session with this command.

If you start the steem first time, blockchain will be synced. And then your node will start to communicate with other nodes.

Now you can connect to your node, like this if you use Python(piston)

from steemapi.steemnoderpc import SteemNodeRPC

rpc = SteemNodeRPC("ws://127.0.0.1:8090")

That’s it. Let the code work for you!

Thank you for reading.

Programmings

If you are Python based
-> https://steemit.com/piston/@xeroc/this-piston-rocks-public-steem-steem-api-for-piston-users-and-developers

If you are Node.js based
-> https://steemit.com/steem/@svk/steem-rpc-library-for-javascript-steem-rpc

Steem RPC Guide
-> https://steemit.com/steem/@furion/developers-guide-to-steem-s-blockchain

References

https://steem.io/documentation/how-to-build/
https://status.steemnodes.com/
https://steemit.com/steemws/@jesta/steem-ws-the-public-steem-api-cluster
https://steemit.com/steem/@mahnunchik/steem-for-mac-os-and-linux-v0-13-0-binaries-wallet-and-miner
https://steemit.com/steemit/@superthepooper/steem-compiled-under-ubuntu-tutorial
https://steemit.com/miner-category/@clayop/steem-miner-setup-in-ubuntu-15
https://steemit.com/steem/@furion/developers-guide-to-steem-s-blockchain

#steem #steem-dev #kr #programming

Sort:  

Hi! So I am pretty new to this and try to set up steem on my PC in order to program a bot and some other stuff. I am using a Mac, so this will not work for me right? Are there any guides how to do it on a mac? I did this: https://steemit.com/steem/@teego/homebrew-package-updated-to-version-0-12-2 but I guess this is not what I need. I found severall other stuff on github but no information what I need or how to run it. Can you help me @woung717?

I just see it. Sorry to late.
You can find binaries for Mac OSX(Darwin) at here:
https://github.com/mahnunchik/steem/releases
Then, you don't need to build and just configure it.

For fix error with g++-4.9 :

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9