Hyperledger

Updating Records

Now let’s assume Alex moves to Canada. It’s cold in the Winter, so now Alex needs a hybrid instead of an all-electric Tesla. If Alex wants to buy Valeria’s Prius, we’ll need to update the blockchain to reflect this change.

 

Task: update car0 -> set owner: Valeria to Alex

  1. Application layer calls ( Smart Contract SDK ).changeCarOwner with the new object
  2. The SDK processes this object and generates a new transaction that issues a change of the color to red
  3. Now, the state database updates to include the new transaction, similar to the UTXO calculation in bitcoin, and updates the color to match the new transaction
  4. Then, once all of this is complete, the chaincode SDK will return a success response to the application layer

 

The payload would need to look like this:

We can then verify this by running node query.js again, and we’ll see that CAR0 now has an owner: Alex