Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (4.1k points)

I am wondering how to model my assets, participants, transactions en events. I have already looked on documentation on how to do it syntax wise, but I was wondering if there is a structured way to do it. Just like the way normalization is done on relational databases.

If someone has principles about blockchain data storage, i would love to hear it.

1 Answer

0 votes
by (14.4k points)
edited by

Hyperledger Fabric is based on key-value stores like LevelDB and CouchDB. Therefore, don't really gain any benefit from normalizing data. In relational databases, you do it for easy indexing and joins, but in key-value stores joins do not exist.

What you can do is create indexes on your data. This will enable faster querying. 

This is covered in the Marbles tutorial chaincode (l.108+):

let indexName = 'color~name'

let colorNameIndexKey = await stub.createCompositeKey(indexName, [marble.color, marble.name]);

For modeling your assets in Hyperledger Composer you can use .cto definitions.

Know more about Blockchain in detail. Enroll in IBM Blockchain Certification now to take that first step.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...