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, this payload would look like this:

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.
You can now push the record to the Hyperledger: 
node invoke.js
Verify by retrieving all cars:
node query.js