code: func ExportChain(blockchain *core.BlockChain, fn string) error {
  	log.Info("Exporting blockchain", "file", fn)
  
  	// Open the file handle and potentially wrap with a gzip stream
  	fh, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm)
  	if err != nil {
  		return err
  	}
  	defer fh.Close()
  
  	var writer io.Writer = fh
  	if strings.HasSuffix(fn, ".gz") {
  		writer = gzip.NewWriter(writer)
  		defer writer.(*gzip.Writer).Close()
  	}
  	// Iterate over the blocks and export them
  	if err := blockchain.Export(writer); err != nil {
  		return err
  	}
  	log.Info("Exported blockchain", "file", fn)
  
  	return nil
  }
docs: // ExportChain exports a blockchain into the specified file, truncating any data
  // already present in the file.