Building the Smart Inventory Project

Smart Inventory is a decentralized application that tracks the history and life path of valuable items. Users can claim ownership of an item or transfer their owned items to another user. With each action, certain metadata is supplied that populates the dataset of an item. This enables users to analyze its history.

By Lemii

21 Jul 2020

building-the-smart-inventory-project-OG@2x.png

Why blockchain?

Second hand markets for valuable items are often fraudulent and it can be challenging to obtain a true and verifiable history. Substantial sums of money can be both made and lost, by manipulating historical data of certain goods.

Smart Inventory tries to solve this problem by tracking the complete history of an item. This data is then stored in a decentralized manner, making it difficult to tamper with. By avoiding the dangers of a centralized database, an item’s history can now be proven and therefore its value can be more easily guaranteed.

Use cases

For this proof of concept I decided to go with a smaller type of network that focuses on one particular type of item. This is not a technical limitation, but rather is done to increase the probability that the existing data is populated more sufficiently.

In other words, if more of the same identical items are registered, it is easier to generate comparison data. On the other hand, if you spread the types of items too sparsely, there won't be much to compare with.

Some use cases for a network are listed below:

  • Vintage synthesizers
  • Watches
  • Art (of any kind)
  • All kinds of rare or luxury goods

These are all valuable items that have their own “community” and “enthusiasts”. Each community can run their own network, focusing only on the goods that they are excited about.

However, as mentioned above, nothing is technically stopping you from listing everything, if that’s what you prefer.

As you can see in the front end, the network of choice for this proof of concept is vintage synthesizers.

How does it work?

Each item on the network is basically an "account" with a custom asset object. The properties of this object can be seen in the code snippet below:

smart-inventory-1.png

Please note that the "identifier" is used to let the frontend know what type of item it actually is. These identifiers are assigned beforehand in the client.

By sending a "RegisterItemTransaction" to an address, the custom properties of the asset object are added to the account, and the account is then transformed to an "ItemAccount".

smart-inventory-2.png

The properties of this asset can then be modified by sending a "TransferItemTransaction" to the account.

smart-inventory-3.png

As you can see only the owner of an asset can transfer an item.

By going through the transaction history of the account, specifically by filtering on these custom transaction types, you can analyze the history of the account (item), and in turn generate data from it.

Custom Modules

Smart Inventory makes use of the custom lisk-extended-api module (created by Moosty), to be able to effectively query the database. This addition makes it possible to search for values in the custom asset fields, something that is not yet supported natively.

For example, here it is being used to search the "owner" field:

smart-inventory-4.png

Smart Inventory In Action

Item registration

smart-inventory-5.gif

Item transfer

smart-inventory-6.gif

Item view

smart-inventory-7.png

You can try the proof of concept here.

Conclusion

I had great fun making this proof of concept and I hope this blog gave you some valuable insight as to how it was created. I encourage everyone to take a look at the source code and play around with the app. The relevant links are provided below.

If you have any questions, feel free to reach out on Discord (user lemii#0001).

Resources

If you feel inspired and want to build your own proof of concept blockchain application, check out the Lisk Builders program. More information about the program and the application procedure can be found on the Lisk webpage for the Lisk Builders program.

Disclaimer: This blog post was written by our community members, Lemii (Lisk.chat username: Lemii) as part of his participation in the Lisk Builders program.