code: def namedb_history_save( cur, opcode, history_id, creator_address, value_hash, block_id, vtxindex, txid, accepted_rec, history_snapshot=False ):
      
  
      assert 'op' in accepted_rec, "Malformed record at ({},{}): missing op".format(block_id, accepted_rec['vtxindex'])
      
      op = accepted_rec['op']
     
      record_data = op_canonicalize(opcode, accepted_rec)
      record_txt = json.dumps(record_data, sort_keys=True)
  
      history_insert = {
          "txid": txid,
          "history_id": history_id,
          "creator_address": creator_address,
          "block_id": block_id,
          "vtxindex": vtxindex,
          "op": op,
          "opcode": opcode,
          "history_data": record_txt,
          'value_hash': value_hash
      }
  
      try:
          query, values = namedb_insert_prepare( cur, history_insert, "history" )
      except Exception, e:
          log.exception(e)
          log.error("FATAL: failed to append history record for '%s' at (%s, %s)" % (history_id, block_id, vtxindex))
          os.abort()
  
      namedb_query_execute( cur, query, values )
      return True
docs: Insert data into the state engine's history.
      It must be for a never-before-seen (txid,block_id,vtxindex) set.
      @history_id is either the name or namespace ID
  
      Return True on success
      Raise an Exception on error