list all assets with X

+4 votes
I'm trying to make a simple demo in which I have an imaginary merchandise store that gives points (an open asset) to customers when they buy products. Those points can be exchanged for limited edition products (a closed asset).

I not sure what would be the best (or even possible) solution to make a page where only clothing items are shown or only cutlery like mugs. I was thinking about making assets that hold a list of all txids, name and amount left of a certain category (like clothing) so that I can show those on an index page, but it seems like I can't store an array in an asset.

any idea what a best practice could be for this scenario?
asked Aug 3, 2017 by anonymous

2 Answers

+2 votes

If you want to do complex querying of assets, e.g. based on certain characteristics of those assets, for now you would need to do this at the application level. MultiChain's listassets API can currenly only be restricted to a pre-specified list of asset names (or refs or issuance txids).

answered Aug 3, 2017 by MultiChain
+2 votes
You can create assets and give it a name. You can add metadata to hold info in the asset. Different types of assets can be created and interpreted by your app in different ways.
you can create streams and use keys and data in placed into streams that hold meaning..

but with saying that, blockchain isnt a replacement for a traditional database and applications data.
My advice is to think about the app without blockchain and accomplish your goals with an app and traditional database design. . Use the blockchain to share and extend your application and use blockchain to extend the areas that are good for change resistant features (immutability).

You can create addresses and issue assets to these addresses. you can normalize the txid back into your application db and your app lists the transaction id against rows in your db

Your database can hold products and have a reference number which you issue to an address in the blockchain. the address could represent a customer and you store that in your application database too.

ultimately, think of your app as a system and apply your design there first and then afterwards think of where your connections are to blockchain.

SQL is good for querying and getting products by type and other columns so use it to get a list of products from your own db.
answered Aug 4, 2017 by MaSsv
...