Skip to content

Genesis Ingestion

Bootstrap a New Network with Existing Data

Users may wish to bootstrap a new blockchain network with existing data. This can be accomplished using the Genesis Ingestion Tool, which initalizes the genesis block on the new chain with existing data to insert into smart contracts on our new chain.

Use Genesis Ingestion to Bootstrap a Private Chain

We often use the Genesis Ingestion Tool to bootstrap a new private network with a list of starting participants in the governance.sol contract.

We start by creating a participants.json file in the following format, which we save in the root of strato-getting-started

The Genesis Registry Tool will expect the JSON file in the following format, where the member key is the is the eNode address and the value is the starting account balance. A chain label will be used as a formality, but is not required.

[
  {
   "user_address": "0xA44B848937677197AcE933ff034B77e38fE60854",
   "user_email": "[email protected]",
   "user_name": "Steve Jobs",
   "group_name": "Apple",
   "Node_url": "enode://[email protected]:30303?discport=30301"
  },
  {
   "user_address": "0x8E66AD7Fc6bF13Bd64737Cad96a8C68FD7a23864",
   "user_email": "[email protected]",
   "user_name": "Mr. Bill",
   "group_name": "Microsoft",
   "node_url": "enode://[email protected]:30303"
  },
  {
   "user_address": "0xcC0326412D00E57c445d07Be11AC49D0C6740812",
   "user_email": "[email protected]",
   "user_name": "Mark",
   "group_name": "Facebook",
   "node_url": "enode://[email protected]:30303"
  }
]

From the root of strato-getting-started, user will run ./strato.sh, which will input the participant list to the genesis-file.json, complete all the steps to run the genesis-ingestion tool, and will result in a new main chain being created that stores a contract which contains a mapping of addresses to eNode addresses.

Quickstart

A new main chain may be bootstrapped by initializing a genesis block with a list of address/eNode address pairs.

The user must supply the following files to the Genesis Ingestion Tool:

participants.json as records_file

The following files can be pulled from a library, as they will remain the same:

genesis_file
source_file 
bytecode_file

The following files will be produced during the generate-genesis process:

output_file

Genesis Ingestion Tool Usage

Starting Data

Here, the user is prompted to initialize a genesis block on the new chain by adding some initial members, defined by their address, eNode address, and starting account balance.

generate-genesis --genesis_file=genesis-template.json \
                 --bytecode_file=governance.bin-runtime \
                 --source_file=governance.sol \
                 --records_file=participants.json \
                 --output_file=genesis-block.json \

Starting Contract

A governance contract may be passed as source code to the Genesis Ingestion Tool as source_file. The source file will serve as the empty governance contract which allows only the address of the creator of the genesis block to add/remove/update members in the registry. We may modify this in the future to accept a user input for governance rules, but for now the rule will be strictly set to accept main chain registry modifications from only the genesis creator address.

Finally, the output_file flag must correctly identify the location to save the file to. This may depend on the user’s STRATO configuration: if running a local node, this file should be saved to the root of strato-getting-started as genesis-block.json. Alternatively, this file could be saved within a docker image in the /var/lib/strato directory.

Now, if genesis-block.json is stored correctly in the user’s STRATO directory, it will be eligible to be uploaded as an actual genesis block for each new chain created from that directory.