code: func getKeyModificationFromTran(tranEnvelope *common.Envelope, namespace string, key string) (commonledger.QueryResult, error) {
  	logger.Debugf("Entering getKeyModificationFromTran()\n", namespace, key)
  
  	// extract action from the envelope
  	payload, err := putils.GetPayload(tranEnvelope)
  	if err != nil {
  		return nil, err
  	}
  
  	tx, err := putils.GetTransaction(payload.Data)
  	if err != nil {
  		return nil, err
  	}
  
  	_, respPayload, err := putils.GetPayloads(tx.Actions[0])
  	if err != nil {
  		return nil, err
  	}
  
  	chdr, err := putils.UnmarshalChannelHeader(payload.Header.ChannelHeader)
  	if err != nil {
  		return nil, err
  	}
  
  	txID := chdr.TxId
  	timestamp := chdr.Timestamp
  
  	txRWSet := &rwsetutil.TxRwSet{}
  
  	// Get the Result from the Action and then Unmarshal
  	// it into a TxReadWriteSet using custom unmarshalling
  	if err = txRWSet.FromProtoBytes(respPayload.Results); err != nil {
  		return nil, err
  	}
  
  	// look for the namespace and key by looping through the transaction's ReadWriteSets
  	for _, nsRWSet := range txRWSet.NsRwSets {
  		if nsRWSet.NameSpace == namespace {
  			// got the correct namespace, now find the key write
  			for _, kvWrite := range nsRWSet.KvRwSet.Writes {
  				if kvWrite.Key == key {
  					return &queryresult.KeyModification{TxId: txID, Value: kvWrite.Value,
  						Timestamp: timestamp, IsDelete: kvWrite.IsDelete}, nil
  				}
  			} // end keys loop
  			return nil, errors.New("key not found in namespace's writeset")
  		} // end if
  	} //end namespaces loop
  	return nil, errors.New("namespace not found in transaction's ReadWriteSets")
  
  }
docs: // getTxIDandKeyWriteValueFromTran inspects a transaction for writes to a given key