An Overview of Data Types on the SAFE Network
One of the SAFE Network Fundamentals is that we must store data in perpetuity. This is a key part of creating a web that prevents the alteration, manipulation or deletion of public data. Why? Because it means that it will then be impossible to rewrite history.
But instead of taking a broad-brush approach and only letting data be stored in perpetuity, we’ve looked at different use cases and thought about circumstances in which data needs to be stored differently. We have 8 different data types. Sounds overcomplicated? Don’t worry, it isn’t.
Let’s start breaking this down.
First up, at a very basic level, data will either be private (unpublished) or public (published). Private data is information you want to keep private on the Network or, perhaps, share on a very restricted basis. Private data can be deleted.
Public data is information that is published to the Network. Everyone can see it. We call this The Perpetual Web and it can’t be removed from the Network. HOWEVER, there are various types of public data which show previous versions (with different data types utilising a combination of edits and amends). Just like the Internet Archive today stores versions of websites even if they were published with mistakes, the whole life of websites (which is by definition, public data) will be available to view to all.
The main thing to remember: anything that is public is perpetual. That is, it can never be deleted.
So we have two categories, published and unpublished. But we’ve broken this down even further and we’ll explore each data type below. As you will see, some are exclusive to either public or private and some data types can have either property.
This data type can be either public or private. You can make changes or edits to the data and it’ll result in a new version - but you can’t change or edit the existing one. Hence the name AppendOnly as you can append the new versions.
So if you published a research paper for the public as AppendOnly data, the content of that paper could never be changed. BUT you could create/upload a new version that corrects or adds more information to the original paper. If you wanted the ability to delete this additional information, you would have to upload this as private data. This is a very important point to make. The Perpetual Web (Fundamental 8) means data should live in perpetuity…but, circumstances may require you to store private data so that you have the option of deleting it.
Next up is ImmutableData. Again, this can be either Published or Unpublished data — but ImmutableData cannot be changed in any way (hence the name immutable). This would be perfect for storing files on the Network such as public scientific reports where it is vital from a societal perspective that these can not be changed or manipulated (public) or for storing private files which can be deleted by the user if he or so chooses (private).
Then we have Mutable. MutableData can be altered, changed and manipulated. So it has to be in the unpublished category (since published data by definition cannot). It cannot be published on the Network. Perhaps you are a researcher who needs to adapt your argument during the course of your research. You need the ability to make alterations to your work. As this is private data, it can only ever be viewed by you and anyone you give permission to. You are also the only one who has the ability to make those changes.
Not a data type per se, but we also have Sequenced and Unsequenced data. This lets data be versioned, or ordered. This design is pertinent in understanding things like how online articles have been edited or corrected over time. This applies to all the data except for ImmutableData.
One more thing to note: within the unpublished data types, there is the ability to store unpublished data on the network and share it with a selected group of users. The user should be able to give permissions like read, write, append based on the use case.
So what does this look like?
To help make sense of this, we’ve plotted the different data types in the diagram with a brief description for each given below.
- SequencedPublishedAppendOnlyData: This is a data type that is ordered, public and only appends may be made — no edits and this data type cannot be deleted.
- UnsequencedPublishedAppendOnlyData: This is a data type is public (therefore cannot be deleted) and no edits can be made.
- SequencedUnpublishedAppendOnlyData: This is a data type that is versioned, private and no edits can be made.
- UnsequencedUnpublishedAppendOnlyData: This is a data type that is not versioned, private and appends can be made.
- PublishedImmutableData: This data is public and unable to be edited or altered or deleted.
- UnpublishedImmutableData: All you can do with this data set is basically upload, read and delete.
- UnpublishedSequencedMutableData: This is ordered data that is private and can be changed as much as the owner wants.
- UnpublishedUnsequencedMutableData: This is the same as above, but not ordered.
And what does that mean for a developer?
All these data types are all well and good but what does this actually mean? What does it enable a developer to do?
Let’s try some examples.
Say you wanted to create a music sharing or streaming application. You would need it to be public so people could see it, so it would fall into the Published bracket.
However, if you wanted a Snapchat-esque application in order to share messages with a private group of friends, you could choose UnpublishedAppendableData (so content can be deleted, just like SnapChat) or maybe MutableData.
So these are examples of one data type, the likelihood is the developer will need to use a combination of data types. Staying on a similar theme, imagine rebuilding Medium. You need somewhere to draft the post — so let’s use MutableData to cover the various changes you’d make in the editing process. You’d then need somewhere you can post the final content for the public: how about PublishedImmutableData? And finally, you want a place where readers can leave comments (so we’d suggest PublishedAppendableData).
Permissions play a big role here. So how can you create a forum with PublishedAppend that others can add things onto it, or how is that with UnpublishedAppendOnly my family can edit a doc even if it’s unpublished? This all relies on the permissions and ownership of the data. We won’t go into too much detail here, but for those of you who are interested in how this works, we recommend you check this post out which details out one of our key Front End milestones (Take Control of Your Data).
These might be oversimplified examples, but generally any combination of the 8 data sets can be built — all you need is a good idea.
There we have it: one SAFE Network, eight data types. The entirely autonomous network, which requires no human intervention where all published data on the Network will be immutable and available on the Network in perpetuity.