code: def from_genesis(cls,
                       base_db: BaseAtomicDB,
                       genesis_params: Dict[str, HeaderParams],
                       genesis_state: AccountState=None) -> 'BaseChain':
          
          genesis_vm_class = cls.get_vm_class_for_block_number(BlockNumber(0))
  
          pre_genesis_header = BlockHeader(difficulty=0, block_number=-1, gas_limit=0)
          state = genesis_vm_class.build_state(base_db, pre_genesis_header)
  
          if genesis_state is None:
              genesis_state = {}
  
          # mutation
          apply_state_dict(state, genesis_state)
          state.persist()
  
          if 'state_root' not in genesis_params:
              # If the genesis state_root was not specified, use the value
              # computed from the initialized state database.
              genesis_params = assoc(genesis_params, 'state_root', state.state_root)
          elif genesis_params['state_root'] != state.state_root:
              # If the genesis state_root was specified, validate that it matches
              # the computed state from the initialized state database.
              raise ValidationError(
                  "The provided genesis state root does not match the computed "
                  "genesis state root.  Got {0}.  Expected {1}".format(
                      state.state_root,
                      genesis_params['state_root'],
                  )
              )
  
          genesis_header = BlockHeader(**genesis_params)
          return cls.from_genesis_header(base_db, genesis_header)
docs: Initializes the Chain from a genesis state.