Repository
https://github.com/steemit/steem
What Will I Learn?
- How is a typical network architecture, and the ports involved
- How to change the initial supply
- How to change the post-payout period
- How to configure the fee for account creation
Requirements
Servers with:
- 1 CPU
- 4 GB RAM
- 500 MB of Hard Disk
- Ubuntu 16.04 installed
These are the minimum requirements for each machine, but they can grow as the blockchain grows.
Difficulty
- Intermediate
Tutorial Contents
This tutorial is the second part of the user guide for a newbie on how to build a private Steem blockchain for corporate projects, corresponding to the first task of the Blockchain Competence Centre of the European Commission. The intention is to amend errors of the last post, expand more configurations details, and present a network architecture.
Customize
As we saw in the last post, the config.hpp file contains several features to customize in the blockchain. Open it (located at steem/libraries/protocol/include/steemit/protocol) and search:
#define STEEMIT_CASHOUT_WINDOW_SECONDS
Each post and comment have a period of time from its creation where it receives votes until the final payout. This period is determined by this constant and it is expressed in seconds. By default, it is 1 week in the main net or 1 hour in the testnet.
#define STEEMIT_CASHOUT_WINDOW_SECONDS (60*60*24*7)
#define STEEMIT_CREATE_ACCOUNT_WITH_STEEM_MODIFIER
There are two ways to create accounts, with a delegation and without delegation. In each case, the fee has different implications. As we introduce in the last post, the account_creation_fee is set by the witnesses. This fee is modified by the constants MODIFIER and RATIO (which by default are 30 and 5 respectively) as shown below:
To create an account without delegation, it costs
MODIFIER * account_creation_fee. For instance, currently it is30 * 0.1 = 3, that is, 3 STEEM to create an account.To create an account with delegation two conditions must be met: 1)
steem >= account_creation_fee, and 2)delegation >= RATIO * (cost_without_delegation - steem).The
RATIOrelates the liquid steem transferred with the delegation. ARATIOof 1 means that the steem transferred and the delegation have the same implications, the cost is the same. However, aRATIOof 5 incentives the transfer of steem and penalizes the delegation with a bigger cost. Take as an example the current state of the blockchain: The cost without delegation is 3 STEEM, and theRATIOis 5. Then, an account can be created with one of the following options:- 0.1 STEEM + delegation of 5*(3 - 0.1) Steem Power = 0.1 STEEM + 14.5 SP
- 0.5 STEEM + delegation of 5*(3 - 0.5) Steem Power = 0.5 STEEM + 12.5 SP
- 1.5 STEEM + delegation of 5*(3 - 1.5) Steem Power = 1.5 STEEM + 7.5 SP
- 3.0 STEEM + delegation of 5*(3 - 3.0) Steem Power = 3.0 STEEM + 0.0 SP (cheaper)
The complete names for MODIFIER and RATIO in the file are:
#define STEEMIT_CREATE_ACCOUNT_WITH_STEEM_MODIFIER 30
#define STEEMIT_CREATE_ACCOUNT_DELEGATION_RATIO 5
#define STEEM_SYMBOL
Just to correct a missing point in the last post. The definition of the currency symbols must start with the precision, which by default is 3 of STEEM and SBD, and 6 for VESTS. Then, our chain looks like:
#define VESTS_SYMBOL (uint64_t(6) | (uint64_t('V') << 8) |
(uint64_t('E') << 16) | (uint64_t('S') << 24)|
(uint64_t('T') << 32) | (uint64_t('S') << 40))
#define STEEM_SYMBOL (uint64_t(3) | (uint64_t('E') << 8) |
(uint64_t('F') << 16) | (uint64_t('T') << 24)|
(uint64_t('G') << 32) )
#define SBD_SYMBOL (uint64_t(3) | (uint64_t('E') << 8) |
(uint64_t('U') << 16) | (uint64_t('R') << 24))
#define STEEMIT_INIT_SUPPLY
After some tests with the private steem blockchain, we realized that witnesses did not receive rewards after the hardfork 0.16 and that the total supply in its short life stopped at 693.000 ETFG. The reason of this is because after the hardfork 0.16 the blockchain starts to use the inflation defined in STEEMIT_INFLATION_RATE_START_PERCENT (by default 9.78% annual), that is, 0.000006 EFTG per block which is rounded to 0.000.
To solve this issue we have to increase the inflation rate or increase the initial supply. With STEEMIT_INIT_SUPPLY we can set an initial supply whose owner is initminer. The constant must include the decimal places. For instance, an initial supply of 250 million EFTG is defined as:
#define STEEMIT_INIT_SUPPLY int64_t(250000000000)
Architecture
The core of a blockchain is the descentralization, the replication of the information across different nodes. This figure shows a typical architecture and the ports involved in such communication: The witness node to create new blocks, a seed node to synchronize and broadcast transactions, a RPC node to create new transactions and to query them, and a condenser with the front-end to interact with the end user.
This set of nodes is connected to external peers to replicate and synchronize blocks and transactions. Finally, the figure shows an admin point to control and configure the different servers.
Firewall
As you can see, the witness, seed, and RPC nodes use the same port configuration. Install UFW (Uncomplicated Firewall) and configure:
sudo ufw default allow outgoing
sudo ufw default deny incoming
Allow ssh connections:
sudo ufw allow ssh
An alternative syntax is to specify the port number of the SSH service:
sudo ufw allow 22
Allow the ports for RPC querys and broadcast transactions:
sudo ufw allow 2001
sudo ufw allow 8090
And enable the firewall:
sudo ufw enable
On the other hand, reproduce the same configuration in the condenser without the 2001 port, and include HTTP/HTTPS connections:
sudo ufw allow http
sudo ufw allow https
An alternative syntax it to specify the port numbers:
sudo ufw allow 80
sudo ufw allow 443
Curriculum
Proof of Work Done
https://github.com/joticajulian/steem/tree/tutorial1
References
- 2018 Beginner's guide to setting up a steem witness and seed node (by
).
- The complete noob guide to steem witness setup (by
).
- Exploring Steem Scalability (by
).
- Steem pressure 3 - Steem node 101 (by
).
- How to start a test network (by
).
- Steem command line guide Part 1 - A learner's guide to using cli_wallet (by
).