Created
July 5, 2018 23:46
-
-
Save nosequeldeebee/4623fd79479790cd0a899b22a534652f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (s *SmartContract) changeCarOwner(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { | |
if len(args) != 2 { | |
return shim.Error("Incorrect number of arguments. Expecting 2") | |
} | |
carAsBytes, _ := APIstub.GetState(args[0]) | |
car := Car{} | |
json.Unmarshal(carAsBytes, &car) | |
car.Owner = args[1] | |
carAsBytes, _ = json.Marshal(car) | |
APIstub.PutState(args[0], carAsBytes) | |
return shim.Success(nil) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment