3

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.

deltu100
  • 581
  • 7
  • 26

1 Answers1

0

Hyperledger Fabric is based on key-value stores (LevelDB and CouchDB), so you 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 there is no such thing as joins.

What you can do is create indexes on your data for 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.

Sigmatics
  • 615
  • 4
  • 17