Intro to Private Blockchains

Creating Records



A car dealership isn’t much without being able to track cars. In order to add new cars to the database, we’ll need to use invoke.js with a slightly different payload. If we wanted to add a new Purple Tata Nano owned by someone named Alex, we would need to update the invoke call slightly.

Update Invoke.js

The rest of the script can remain unchanged since it’s just going to pass this payload to the server. One thing to keep in mind here is that in this case, we’re passing the ID “CAR10”, which we wouldn’t have without first querying the database to see what the last car in the list was numbered.

>_

Run the command

alex@ubuntu: ~/fabric-samples/fabcar/ $ node invoke.js // push a record
alex@ubuntu: ~/fabric-samples/fabcar/ $ node query.js // verify after creation