Code example of a smart contract

To give you an idea of what a smart contract looks like from a code perspective, here is a simple example of assigning an accident to a case worker:

/** * Assign an Case woker to the accident report * @param {nl.amis.registry.accidents.AssignToCaseWorker} assignToCaseWorker - the particular accident that you want to assign to a responsible case worker * @transaction */function AssignToCaseWorker(assignToCaseWorker) {  if (assignToCaseWorker.accident.status !== 'OPEN')     throw new Error('Case already assigned to an Case worker.');  else {    assignToCaseWorker.accident.status = 'ASSIGNED';    assignToCaseWorker.accident.assignee = assignToCaseWorker.assignee;  }   return getAssetRegistry('nl.amis.registry.accidents.Accident') ...

Get Blockchain across Oracle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.