Progressive Data Management

Through these methods it is possible to write, update and invalidate data within the blockchain.

write(password, metadata, collection = '', refID = '', protocol = '', key = '')

It allows you to write an indefinite amount of data within your address. This data will be processed by IdaNodes and can be read by invoking APIs.

Here are the parameters you can set:

  • password:the password to decrypt the identity payload.

  • metadata: the data to be written, in the form of a string. There is no character limit because multiple transactions are concatenated. It is clear that the greater length involves a greater expenditure than LYRA. It should be emphasized, clearly, that linking a large number of transactions is not recommended as even the failure of a single transaction would render the entire data invalid.

  • collection: a parameter that allows you to catalog data within a collection. Useful for structuring data, this parameter can be used as a filter when reading data from IdaNodes.

  • refID: a parameter that allows to give a single reference to the data, a sort of additional ID that can be filtered, always by IdaNodes.

  • protocol: another type of filter, it is used to define protocols and therefore the type of data entered. For example, Scrypta used the protocols E: // for encrypted data, I: // for identity, etc. There is no constraint of any kind in the use of protocols.

  • key: the identity payload to be used; if omitted, that of localStorage is used.

The method will return an object containing a series of information:

  • uuid: the unique identifier (uuid/v4) generated by the IdaNode to identify the specific data.

  • address: the address where the information was written.

  • fees: the total amount of fees used.

  • collection / refID / protocol: the parameters passed previously.

  • dimension: the final size of the entered data.

  • chunks: the quantity of concatenated transactions.

  • stored: the raw data that was actually written in blockchain.

  • txs: the txid of the transactions actually sent.

Below is a concrete example:

{ "uuid":"9022b33e.a4e8.401e.b32b.a2b75b012554", "address":"LLLjx7yV4nhUzSapBAHogb5BdgUR6VCB3o", "fees":0.010000000000000002, "collection":"", "refID":"", "protocol":"", "dimension":702, "chunks":10, "stored":"*!*9022b33e.a4e8.401e.b32b.a2b75b012554!*!!*!!*!*=>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis risus auctor, eleifend neque sit amet, ultricies nulla. Suspendisse condimentum nisi ut nunc mattis, vel congue velit congue. Aliquam sit amet pharetra tellus. Etiam tellus lacus, pretium vel commodo a, tempor nec ante. Aenean turpis nisi, pulvinar eget vehicula at, dapibus at dui. Cras vitae dictum massa. Sed in orci lorem. Nullam ut mattis lacus. Mauris ut mattis tellus. Donec et posuere lorem, id elementum ligula. Aliquam eu mollis neque, eget venenatis erat. Aenean vestibulum nunc diam, et luctus massa porttitor ac. Morbi tempor eleifend bibendum. Curabitur sed diam leo.*!*", "txs":["2432e4f57d355122d6c55331593ac3fc1c0095b2c9bcd7ba7c6e65fcf4cf07c7","c6d592889105c2989c43df50197f3b0d35449497001be69842602b9a72306a03","cf52acfc5384813ea65741354066962e10c33db826e575d300326850f0761c7f","b3d38ee224f8f82bbf0c4f878740dea5664ce3b90c2f5fea38e53ee1caa3a5d8","915ff12007dc738761c4746087fca2d03c17cefb272504d04f3378d3038816d1","76e3d9427575a82550e3461dad453d006c1d79bb59fd64eadcd6ce2f884ca582","d7650a8357fe031eec3672210c4d96bc41383375eeeac87062efb7c273daf924","27a00bc5478d6e50e04375271066c6ad7e0ac923d5553ab41358643942baf859","bedec596bf4117cea73095ec32361aef2425a65b9f1be23fd842181552c7d00e","6b4959c76eb57e3e913965901bf627f3e82e6c1332ae34d571f1222c68a24d49"]}

This same information can be retrieved and filtered by the IdA Node. The example can be consulted at the following link: https://proof.scryptachain.org/#/uuid/2b33e.a4e8.401e.b32b.a2b75b012554

Here is the example that produced the result just described:

const scrypta = window.ScryptaCorevar metadata = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis risus auctor, eleifend neque sit amet, ultricies nulla. Suspendisse condimentum nisi ut nunc mattis, vel congue velit congue. Aliquam sit amet pharetra tellus. Etiam tellus lacus, pretium vel commodo a, tempor nec ante. Aenean turpis nisi, pulvinar eget vehicula at, dapibus at dui. Cras vitae dictum massa. Sed in orci lorem. Nullam ut mattis lacus. Mauris ut mattis tellus. Donec et posuere lorem, id elementum ligula. Aliquam eu mollis neque, eget venenatis erat. Aenean vestibulum nunc diam, et luctus massa porttitor ac. Morbi tempor eleifend bibendum. Curabitur sed diam leo.'var password = 'AStrongPassword'var collection = ''var refID = ''var protocol = ''​let written = await scrypta.write(password, metadata, collection, refID, protocol)

update(password, metadata, collection = '', refID = '', protocol = '', key = '', uuid)

This method calls the previous one and is an alias, but in this case the "uuid" field is mandatory and is useful to verify that a given "duplicate" is not actually created.

IIn fact the operation that is done is that of sequential updating of the data. In case of updated data, the IdA Node will always and in any case return the last (in chronological order) even if the history can be retrieved by passing the parameter history = true when reading.

invalidate(password, key = '', uuid)

This method, like the one above, always refers to the write operation. In this case the written data is always composed of the UUID and the END information. This will be interpreted by the IdA Node as a datum not to be shown during reading. As already specified, the information cannot be deleted from the blockchain and can be retrieved from the IdA Nodes themselves by passing the parameter history = true when reading.