The user guide for a newbie on how to build a private Steem blockchain for corporate projects - Part 2

작년

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 is 30 * 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 RATIO relates the liquid steem transferred with the delegation. A RATIO of 1 means that the steem transferred and the delegation have the same implications, the cost is the same. However, a RATIO of 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 the RATIO is 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

architecture.png

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

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!
STEEMKR.COM IS SPONSORED BY
ADVERTISEMENT
Sort Order:  trending

Thank you for your contribution.

  • Very interesting and useful tutorial for the community. Thank you for your work.

Looking forward to your upcoming tutorials.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

·

Thank you for your review, @portugalcoin!

So far this week you've reviewed 22 contributions. Keep up the good work!

·
  ·  작년

Thank you very much

Hey @jga
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @jga!
I would add an important observation: all the servers need to have synchronized clocks, using an NTP server.

  ·  작년

Hola Julian, es un gusto conocerte! Yo vivo en Panamá tambien, y no somos tantos aqui en Steemit =) Acabo de descubrir tu perfil gracias a bait002. Saludos !

·
  ·  작년

Hola Eve, un gusto. Que bueno tenerte por acá por steemit. @bait002 me comentó que usaste steemX para cambiar steem a dólares... a mí esto me interesa pero veo que funciona con paypal y no sé como pasar los dólares de paypal a mi banco local (banco general)... me podrías decir qué proceso seguiste?
Un saludo. Te sigo.

Congratulations @jga! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

·

Hi @jga! I'm Jose, senior analyst at AmaZix (https://www.amazix.com/ // https://www.linkedin.com/in/ze-macedo-15b1b175/). I'm working on a forum project based on the Steem blockchain and have benefitted and learned a lot from your posts on the inner workings of Steem. I'd love to talk to you and get your feedback about our current targeted implementation. Do you have an e-mail or Telegram you can be contacted on?

Best,

Jose

·
·
  ·  작년

Hi @jimmygatz, sure. Write me to joticajulian@gmail.com or joticajulian in telegram.