Steem Developer Portal - Quickstart
Getting started to develop robust and feature rich Steem applications couldn’t be easier. Accessing steem data is easy from various options depending on your infrastructure and objectives.
Applications that interface directly with the Steem blockchain will need to connect to a
steemd node. Developers may choose to use one of the public API nodes that are available, or run their own instance of a node.
The simplest way to get started is by deploying a pre-built dockerized container.
Dockerized p2p Node
To run a p2p node (ca. 2GB of memory is required at the moment):
Dockerized Full Node
to run a node with all the data (e.g. for supporting a content website) that uses ca. 14GB of memory and growing:
Normally syncing blockchain starts from very first,
0 genesis block. It might take long time to catch up with live network. Because it connectes to various p2p nodes in the Steem network and requests blocks from 0 to head block. It stores blocks in block log file and builds up the current state in the shared memory file. But there is a way to bootstrap syncing by using trusted
block_log file. The block log is an external append only log of the blocks. It contains blocks that are only added to the log after they are irreversible because the log is append only.
Trusted block log file helps to download blocks faster. Steemit Inc, provides public block log file which can be downloaded from here and there is also option from community witness
@gtg which can be downloaded from here.
block_log files updated periodically, as of May 2018 uncompressed
block_log file size ~110 GB. Docker container on
stable branch of Steem source code has option to use
USE_PUBLIC_BLOCKLOG=1 to download latest block log and start Steem node with replay.
Block log should be place in
blockchain directory below
data_dir and node should be started with
--replay-blockchain to ensure block log is valid and continue to sync from the point of snapshot. Replay uses the downloaded block log file to build up the shared memory file up to the highest block stored in that snapshot and then continues with sync up to the head block.
Replay helps to sync blockchain in much faster rate, but as blockchain grows in size replay might also take some time to verify blocks.
There is another trick which might help with faster sync/replay on smaller equipped servers:
while : do dd if=blockchain/block_log iflag=nocache count=0 sleep 60 done
Above bash script drops
block_log from the OS cache, leaving more memory free for backing the blockchain database. It might also help while running live, but measurement would be needed to determine this.
Few other tricks that might help:
For Linux users, virtual memory writes dirty pages of the shared file out to disk more often than is optimal which results in steemd being slowed down by redundant IO operations. These settings are recommended to optimize reindex time.
echo 75 | sudo tee /proc/sys/vm/dirty_background_ratio echo 1000 | sudo tee /proc/sys/vm/dirty_expire_centisecs echo 80 | sudo tee /proc/sys/vm/dirty_ratio echo 30000 | sudo tee /proc/sys/vm/dirty_writeback_centisecs
Another settings that can be changed in
flush - it is to specify a target number of blocks to process before flushing the chain database to disk. This is needed on Linux machines and a value of 100000 is recommended. It is not needed on OS X, but can be used if desired.
docker run \ -d -p 2001:2001 -p 8090:8090 --name steemd-default \ steemit/steem docker logs -f steemd-default # follow along
docker run \ --env USE_WAY_TOO_MUCH_RAM=1 \ -d -p 2001:2001 -p 8090:8090 --name steemd-full \ steemit/steem docker logs -f steemd-full
Steem blockchain software is written in C++ and in order to modify the source code you need some understanding of the C++ programming language. Each Steem node runs an instance of this software, so in order to test your changes, you will need to know how to install dependencies which can be found in the Steem repo. This also means that some knowledge of System administration is also required. There are multiple advantages of running a testnet, you can test your scripts or applications on a testnet without extra spam on the live network, which allows much more flexibility to try new things. Having access to a testnet also helps you to work on new features and possibly submit new or improved pull requests to official the Steem GitHub repository.
By following official build steps and enabling the
BUILD_STEEM_TESTNET flag during compilation, you should be able to run the Steem Testnet locally on your workstation and join the development testnet. Docker can also be used to get started quickly. Compilation generates the
steemd executable which is the main daemon for the Steem network. Additional
cli_wallet can also be compiled to test/connect to an instance of
steemd and request some data from the network, but it is not necessary to run a node.
The development testnet requires a certain minimum set of hardware requirements, depending on the type of compile flags that have been enabled. Because it is a mirror of the live network, private keys are the same for accounts up to the point of the snapshot timestamp of the testnet.
Joining/Running the development testnet requires around 10 GB for block log on an SSD and 8 GB RAM. The CPU requirements are the same.
Testnet has the following parameters by default (as of this writing):
- Initial supply (250 billion) -
- Max number of blocks to be produced -
- Address prefix, prefix on public addresses -
- Chain id name, used for chain id -
- Chain id, unique id hash of chain -
- Public key of genesis account -
- Account creation fee -
There are a number of other subtle changes that we don’t need to focus on right now.
- Address prefix:
- API node:
Anyone can join the Live testnet and start testing their node and applications, become a witness, and provide API (RPC) node for public use.
In order to create a custom testnet, separate from the development one, we need to modify a few parameters mentioned in the previous section.
In the file named
steem/libraries/protocol/include/steem/protocol/config.hpp, we can see the first few lines dedicated to the Testnet section. The line starts with
Let’s say we want to create a custom testnet with an initial supply of 1,000,000 STEEM. We can change
STEEM_INIT_SUPPLY 1,000,000 and by changing
STEEM_CHAIN_ID_NAME "testnet", testnet to mytestnet we will automatically get a unique Chain ID for our testnet. The address prefix can be set to something like MTN and of course, we need to change the public and private keys to the genesis account. Note that the genesis account will receive the entire pre-mined supply of 1,000,000. That way, you can execute a setup script to fund any newly created accounts. Such a custom testnet will not have any additional hardware requirements to run.
A minimum of 8GB RAM should be sufficient to run a custom testnet. Currently, Steem only has Linux and Mac compiling guides to build. A testnet can either be hosted locally, on a rented AWS, or dedicated bare metal servers so one can start testing functionality, explore different APIs, and start developing.
One more crucial point to modify is to change the number of witnesses required to accept hardforks for a custom testnet, by default it is set to 17, we can change it to 1
STEEM_HARDFORK_REQUIRED_WITNESSES 1 so that only one node instance would be sufficient and the network will be still functional and fast.
Another thing to note is that you can start a new chain with all previous hardforks already accepted, by changing the file named
steem/blob/master/libraries/chain/database.cpp with the following function:
void database::init_genesis( uint64_t init_supply ) inside
try add this line:
set_hardfork( 19, true );
This would mean that 19 hardforks have been accepted by witnesses and the new chain will start with all previous forks included.
After these changes, all we have to do is compile the source code and get the
steemd executable. And once we fire up the custom testnet we can start testing and experimenting.
If you want to port some data from Steem main network you can use Tinman, also developed by Steemit, to help with taking snapshots of the main network.
Custom live testnet
- Address prefix:
- API node:
The above testnet is powered by community member @almost-digital and doesn’t have a snapshot of the main network.