Research Article

Based on Consortium Blockchain to Design a Credit Verifiable Cross University Course Learning System

Algorithm 5

Chaincode for the teacher to add course grades to the student account.
(1)func (t Chaincode) AddGrade(APIstub shim.ChaincodeStubInterface, args []string) peer.Response {
(2) if len(args) ! = 2 {
(3)  return shim.Error(“Incorrect number of arguments. Expecting 2″)
(4) }
(5) studentAsBytes, _: = APIstub.GetState(args[0])
(6) student:= Student{}
(7) json.Unmarshal(studentAsBytes, &student)
(8) student.Grade = args[4].
(9) studentAsBytes, _ = json.Marshal(student)
(10) APIstub.PutState(args[0], studentAsBytes)
(11) return shim.Success(nil)
(12)}