# Shipping With Genesis States 2021/03/12 Author: @prestonvanloon **Problem**: Prysm generates a genesis state by observing eth1 deposit transaction logs. In some cases, such as mainnet, this process can take several hours. In some testnets, there may not be any initial deposits to bootstrap and clients must use a genesis.ssz file. **Solution**: In this design, we offer 3 proposals with a hybrid approach of all three at the end of the document. ## Proposal 1: Hardcode genesis.ssz files Hard coding genesis state files will provide fast access to genesis states at the cost of increased binary file size. ```go var ( //go:embed prater.ssz.snappy praterRawSSZCompressed []byte // ~18Mb //go:embed pyrmont.ssz.snappy pyrmontRawSSZCompressed []byte // ~8.3Mb //go:embed mainnet.ssz.snappy mainnetRawSSZCompressed []byte // ~1.8Mb ) ``` Supporting these 3 networks would increase beacon chain binary size by nearly 30Mb. This would represent a 40% increase in filesize and the problem would only get worse as more testnets are added in the future. ## Proposal 2: Fetch genesis from URLs Prysm can ship with the sha256 of genesis states and a set of URLs to fetch them. When the client starts, it may download the appropriate genesis state, verify its hash, and use it as a bootstrap state. ```go var ( praterGenesisState = downloadableState{ hash: "9befa011720f616ce2f08e19f01e453257127fb175dc9ab8ceda346f19b70155", urls: []string{ "https://prysmaticlabs.com/uploads/genesis/prater.ssz", "https://github.com/eth2-clients/eth2-testnets/raw/master/shared/prater/genesis.ssz", }, } // pyrmont here // mainnet here ) ``` The main downside here is that these downloads may be censored or break. In the event that a download fails, the next URL will be fetched. If all URLs fail, the client will fallback to the original logic to generate the genesis state from deposits, if possible. ## Proposal 3: Load genesis.ssz from command line flag With a flag `--genesis-file=/path/to/genesis.ssz`, users could specify a particular genesis.ssz file to bootstrap. Note: This flag exists as `--interop-genesis-state`. The existing logic could be reused or aliased to make the feature more clear that it is not just for interop testing. ## Hybrid Approach: All three proposals All three proposals solve the problem, some with additional benefits. With these proposals, I am proposing the following: - Mainnet.ssz is embedded into the application - Well known testnets can be fetched via URL with hash - Support for `--genesis-file` flag allows for future testnets and rapid iteration without issuing new binaries ping