Off-chain data
The operator can store information on-chain or off-chain. Off-chain storage has two main use cases:
- Data that may need to be deleted, such as personal data that a person can ask you to erase.
- Data too large to be stored on the chain.
The principle: the application stores the data in clear, and only a digest of the data is anchored on-chain. Anyone given the clear data can later check that it matches the anchored digest.
Get the digest of your data
Suppose you want to anchor the identity of the debtor off-chain:
{ "lastName": "Durand", "firstName": "Pierre" }
You send this data to the operator, which answers with the digest of the data:
{
"digestData": {
"ABCD1234": {
"__salt__": "123456AB",
"lastName": "Durand",
"firstName": "Pierre"
}
},
"digest": {
"digest": "ABCD1234",
"type": "json",
"encoding": "canonical",
"digestAlg": "sha256"
}
}
digestDatais the data to keep in your application, indexed by its digest. It contains a random__salt__, so that the digest cannot be guessed from the data alone.digestdescribes the digest to anchor.
The operator guarantees the exact string that represents the JSON. It handles whitespace and sorts the keys (canonical encoding), so that the same JSON always gives the same digest.