Bootstrapping The EOS BlockchainsteemCreated with Sketch.

in #cryptocurrency3 years ago (edited)

After the recent announcement to break out into BP groups to do trial runs of booting the EOS Blockchain, we have been hard at work going through the process of ensuring everything goes smoothly.

In this post, we describe the exact steps you need to take to bootstrap EOS Blockchain for a trial run within the Trinity Testnet launch.

Prerequisites

This tutorial assumes you have the latest EOS branch compiled and all binaries installed.

1. Generate key pair to be used for eosio user:

cleos create keys

You should get some keys...

Private key: 5J5PzFsLMsbU8XK3qGPm69hqvMHfho8D9WiSkAi7rfB32rnMtRQ
Public key: EOS6RAzfeEDBu6uKEo1XbVgTw7UxqFXLC5KwcLT441DLG7AuD554q


*Be sure to save your keys in secure place!

2. Run nodeos once to generate sample genesis file, and set initial_key to generated public key from step 1:

{
 "initial_timestamp": "2018-03-01T12:00:00.000",
 "initial_key": "EOS6RAzfeEDBu6uKEo1XbVgTw7UxqFXLC5KwcLT441DLG7AuD554q",
 "initial_configuration": {
   "base_per_transaction_net_usage": 100,
   "base_per_transaction_cpu_usage": 500,
   "base_per_action_cpu_usage": 1000,
   "base_setcode_cpu_usage": 2097152,
   "per_signature_cpu_usage": 100000,
   "per_lock_net_usage": 32,
   "context_free_discount_cpu_usage_num": 20,
   "context_free_discount_cpu_usage_den": 100,
   "max_transaction_cpu_usage": 10485760,
   "max_transaction_net_usage": 104857,
   "max_block_cpu_usage": 104857600,
   "target_block_cpu_usage_pct": 1000,
   "max_block_net_usage": 1048576,
   "target_block_net_usage_pct": 1000,
   "max_transaction_lifetime": 3600,
   "max_transaction_exec_time": 0,
   "max_authority_depth": 6,
   "max_inline_depth": 4,
   "max_inline_action_size": 4096,
   "max_generated_transaction_count": 16,
   "max_transaction_delay": 3888000
 },
 "initial_chain_id": "00000000000000000000000000000000000000000000000005472696e6974790a"
}

You can generate initial chain id using text to hex conversion:

>> echo "Trinity" |  xxd  -c 256 -ps

That should give you an ID like this: 5472696e6974790a

3. Copy genesis.json to data directory and create initial config.ini file with eosio keys:

get-transactions-time-limit = 3
  genesis-json = "genesis.json"
  block-log-dir = "blocks"
  max-reversible-block-time = -1
  max-pending-transaction-time = -1
http-server-address = 0.0.0.0:8000 p2p-listen-endpoint = 0.0.0.0:9000 p2p-server-address = <domain-name>:9000
mongodb-queue-size = 256 agent-name = "<Agent name>" allowed-connection = specified log-level-net-plugin = info max-clients = 25 connection-cleanup-period = 30 network-version-match = 0 sync-fetch-span = 1000 enable-stale-production = true required-participation = 33 peer-private-key=["EOS6RAzfeEDBu6uKEo1XbVgTw7UxqFXLC5KwcLT441DLG7AuD554q","5J5PzFsLMsbU8XK3qGPm69hqvMHfho8D9WiSkAi7rfB32rnMtRQ"]
private-key=["EOS6RAzfeEDBu6uKEo1XbVgTw7UxqFXLC5KwcLT441DLG7AuD554q","5J5PzFsLMsbU8XK3qGPm69hqvMHfho8D9WiSkAi7rfB32rnMtRQ"] producer-name = eosio
plugin = eosio::producer_plugin plugin = eosio::chain_api_plugin plugin = eosio::account_history_plugin plugin = eosio::account_history_api_plugin plugin = eosio::net_api_plugin plugin = eosio::net_plugin

4. Use start.sh - start script that looks something like the following:

#!/bin/bashDATADIR=/path/to-eos/data-dirnodeos --data-dir $DATADIR --config-dir $DATADIR > $DATADIR/stdout.txt 2> $DATADIR/stderr.txt & echo $! > $DATADIR/eosd.pid

5. Start nodeos process for eosio ./start.sh and monitor stderr.txt for any errors.

6. Start the wallet service:

nohup keosd start

7. Create default wallet for eosio user:

cleos -u http://localhost:8888 wallet create

*Save the default wallet password!

Example: PW5JAuNFDHWz1q3tQMV4wxTNJLW3tcrpGTL8A1LbCtCL4UxgbqS1L

8. Unlock default wallet and import eosio private key:

cleos -u https://localhost:4003/ wallet unlock --password

Example: PW5JAuNFDHWz1q3tQMV4wxTNJLW3tcrpGTL8A1LbCtCL4UxgbqS1L
cleos -u https://localhost:4003 wallet import

Example: 5J5PzFsLMsbU8XK3qGPm69hqvMHfho8D9WiSkAi7rfB32rnMtRQ

9. Install bios contract:

cleos -u http://localhost:8000  set contract eosio /opt/eos/build/contracts/eosio.bios -p eosio

10. Collect public keys with corresponding account names from participating BPs and add each account:

cleos -u http://localhost:8000 create account eosio eostribe [owner-public-key] [active-public-key]

In the above example the same public key is used for both owner and active public keys for simplicity. In a real production scenario those keys might be different.

Example:
EOS81fkevoxZiwa2BarrX8MgBm4f6zVZux5u9Rt8uaAuVpQtMJGDi
EOS81fkevoxZiwa2BarrX8MgBm4f6zVZux5u9Rt8uaAuVpQtMJGDi

11. Then create setbp.json file with all block producer keys listed:

"version": "042918","producers": [{"producer_name":"eostribe", "block_signing_key":"EOS81fkevoxZiwa2BarrX8MgBm4f6zVZux5u9Rt8uaAuVpQtMJGDi"},{"producer_name":"edenx", "block_signing_key":"EOS5Fji6x8dgSPHzpi7NpYxQT8V1gxC7cEjKnan2CivHBikS4etyC"},{"producer_name":"cryptolions", "block_signing_key":"EOS4uD43rw6sB46AKWkU5rtXZnnRJeYhAtpwvHszJ8QD3Eqbgg7TE"},{"producer_name":"eosrio", "block_signing_key":"EOS7XYenowtgqicTieLaxiTvF3TsCctEN7g5k8ZyAPkfuvusuycnE"},{"producer_name":"eoscannon", "block_signing_key":"EOS7xhXqvZq9ptfrHaXh5KeDLpu7Pik62sbyTfRpkEPu3v3GLrQDW"},{"producer_name":"hkeos", "block_signing_key":"EOS4tiVonwbmT6w5jZjxaWx8p1CkejsBtcwtn6YaqZRteKyYGQZAE"},{"producer_name":"eosgravity", "block_signing_key":"EOS6Z5843PLPjjEP3vmm7eim8rHxyTsGnKGXPnvzdQj8NyoyAC7Eb"},{"producer_name":"eosasia", "block_signing_key":"EOS8g5uqMKwBGyHAS8zdR6WZksYjKxqrBUMr9VRbakMeufCkmGk2y"},{"producer_name":"topone", "block_signing_key":"EOS5ja2TA8wXeJ8zMAWPomrbmoxsB7AdeT1xu8vgooVQpcFZZSJQo"},{"producer_name":"viabtc", "block_signing_key":"EOS589V9T9EBqMZoE8urrtDzaCu6YWwg7ZhY6HKgxtqWRPH19ABGA"},{"producer_name":"eosamsterdam", "block_signing_key":"EOS643Fo4Wm5qEQuhJjQZMibhbMvUg9FJ9qQQ2vigV7MgyRyoPwDc"},{"producer_name":"eossocal", "block_signing_key":"EOS8MkTExpdAN2h5zp2h3iu4HvwXaeeykSyDdx3cNdrx93SGAzWVz"},{"producer_name":"eospace", "block_signing_key":"EOS7JXDhxJzHXLhcG4TEUnCLNEmtjrFUAWmcg2Rrr58qCxGnkRerS"},{"producer_name":"eoseco", "block_signing_key":"EOS85fDTxvb2P6cXuz5nQyaDwTPbemwcw6KyVDmHHZaGFNog5fBCK"},{"producer_name":"tokenika", "block_signing_key":"EOS8FMoqXSXMZ1LhgEgMxsEunckz28KvRqLk7ioHkmfVY8JnvyenT"}]}

12. Finally add block producers to the bios contract:

cleos -u https://localhost:4003 push action eosio setprods "$(cat setbp.json)" -p [email protected]

13. Add following lines in config.ini to restrict connections from only producers specified:


peer-key = "EOS81fkevoxZiwa2BarrX8MgBm4f6zVZux5u9Rt8uaAuVpQtMJGDi"peer-key = "EOS6GTbcoG4Hum9JaC1kjH3ujuj7VNQh3b9Mh3oiAUy7WvLFXFR6V"peer-key = "EOS5Fji6x8dgSPHzpi7NpYxQT8V1gxC7cEjKnan2CivHBikS4etyC"peer-key = "EOS4uD43rw6sB46AKWkU5rtXZnnRJeYhAtpwvHszJ8QD3Eqbgg7TE"peer-key = "EOS7XYenowtgqicTieLaxiTvF3TsCctEN7g5k8ZyAPkfuvusuycnE"peer-key = "EOS7xhXqvZq9ptfrHaXh5KeDLpu7Pik62sbyTfRpkEPu3v3GLrQDW"peer-key = "EOS4tiVonwbmT6w5jZjxaWx8p1CkejsBtcwtn6YaqZRteKyYGQZAE"peer-key = "EOS6Z5843PLPjjEP3vmm7eim8rHxyTsGnKGXPnvzdQj8NyoyAC7Eb"peer-key = "EOS8g5uqMKwBGyHAS8zdR6WZksYjKxqrBUMr9VRbakMeufCkmGk2y"peer-key = "EOS5ja2TA8wXeJ8zMAWPomrbmoxsB7AdeT1xu8vgooVQpcFZZSJQo"peer-key = "EOS589V9T9EBqMZoE8urrtDzaCu6YWwg7ZhY6HKgxtqWRPH19ABGA"peer-key = "EOS643Fo4Wm5qEQuhJjQZMibhbMvUg9FJ9qQQ2vigV7MgyRyoPwDc"peer-key = "EOS8MkTExpdAN2h5zp2h3iu4HvwXaeeykSyDdx3cNdrx93SGAzWVz"peer-key = "EOS7JXDhxJzHXLhcG4TEUnCLNEmtjrFUAWmcg2Rrr58qCxGnkRerS"peer-key = "EOS85fDTxvb2P6cXuz5nQyaDwTPbemwcw6KyVDmHHZaGFNog5fBCK"peer-key = "EOS8FMoqXSXMZ1LhgEgMxsEunckz28KvRqLk7ioHkmfVY8JnvyenT"

14. Share genesis file and your peer:

<domain-name>:9000 (with block producers)

15. Monitor logs while prock producers join the network.

Note: consider switching your RPC interface to SSL protocol ASAP!
You can learn how to do that via this great resource by EOS RIO


Connect With Us




EOS Tribe - The Bulding Blocks of a Decentralized Future
Sort:  

EOS Canada created this project for smooth launch utils.
https://github.com/eoscanada/eos-bios

It implements the following:

Booting a mainnet
Booting testnets
Booting local development environments
Booting consortium or private networks
Orchestrates launches with many participants through the Network Discovery Protocol.

Thank you for sharing relevant post!
We are sharing steps we took as part of pre-launch exercise for Trinity testnet (group #3).
And hence it serves as a public record of technical testing and knowledge sharing.
There are still some outstanding issues we need to address before the real launch of EOS main net, and thus the launch procedure will most likely change.

I love step-by-step process walk-throughs like this! Let’s be honest it is a complicated space and tech, yet this is well done and easy to follow. 👏 Hit me up if you guys start doing videos, I would love to be of service.