code: func (kern *Kernel) LoadState(genesisDoc *genesis.GenesisDoc) (err error) {
  	var existing bool
  	existing, kern.Blockchain, err = bcm.LoadOrNewBlockchain(kern.database, genesisDoc, kern.Logger)
  	if err != nil {
  		return fmt.Errorf("error creating or loading blockchain state: %v", err)
  	}
  
  	if existing {
  		kern.Logger.InfoMsg("Loading application state", "height", kern.Blockchain.LastBlockHeight())
  		kern.State, err = state.LoadState(kern.database, execution.VersionAtHeight(kern.Blockchain.LastBlockHeight()))
  		if err != nil {
  			return fmt.Errorf("could not load persisted execution state at hash 0x%X: %v",
  				kern.Blockchain.AppHashAfterLastBlock(), err)
  		}
  
  		if !bytes.Equal(kern.State.Hash(), kern.Blockchain.AppHashAfterLastBlock()) {
  			return fmt.Errorf("state and blockchain disagree on app hash at height %d: "+
  				"state gives %X, blockchain gives %X", kern.Blockchain.LastBlockHeight(),
  				kern.State.Hash(), kern.Blockchain.AppHashAfterLastBlock())
  		}
  
  	} else {
  		kern.Logger.InfoMsg("Creating new application state from genesis")
  		kern.State, err = state.MakeGenesisState(kern.database, genesisDoc)
  		if err != nil {
  			return fmt.Errorf("could not build genesis state: %v", err)
  		}
  
  		if err = kern.State.InitialCommit(); err != nil {
  			return err
  		}
  	}
  
  	kern.Logger.InfoMsg("State loading successful")
  
  	params := execution.ParamsFromGenesis(genesisDoc)
  	kern.checker = execution.NewBatchChecker(kern.State, params, kern.Blockchain, kern.Logger)
  	kern.committer = execution.NewBatchCommitter(kern.State, params, kern.Blockchain, kern.Emitter, kern.Logger, kern.exeOptions...)
  	return nil
  }
docs: // LoadState starts from scratch or previous chain