Scenario - need to store on blockchain specific data related to users.
- potentially very large number of users
- data should not be changed in the future, and that's the whole point to make it immutable
- smart contract should have ability to check it for any user at any time
- data size to store per user is small
- the data should not be easy to find or interpret on blockchain for general public
From my understanding there are 2 ways:
Store in transaction's data
- cheaper to store
- if user personal information is stored in a offchain database, the data on blockchain can reference it by primary key. Database can store all transactions for specific user for fast search
Questions
- Does having part of data stored offchain beat the purpose of using blockchain in terms of if database is somehow lost/corrupt then data stored in a contract becomes useless?
- Is there a point of using Swarm/IPFS instead of regular database? what benefits it would have?
- Can a smart contract easily access a transaction's data? is it free or not?
Store in smart contract's data
- expensive to store
- info is easy to find within contract's data structures
Questions
Since contract's data can be modified, it looses the immutability benefit? can the changes to contract's data be tracked on blockchain?