dat-ecosystem / dat

:floppy_disk: peer-to-peer sharing & live syncronization of files via command line
https://dat.foundation
BSD 3-Clause "New" or "Revised" License
8.24k stars 449 forks source link

Immutable Dat link #976

Closed aaronshaf closed 4 years ago

aaronshaf commented 6 years ago

Is it possible to link to a Dat version of content that is immutable?

mafintosh commented 6 years ago

You can make a versioned link, dat://{pubkey-or-host}+{revnum}/ - a versioned link is basically a readonly snapshot of a dat in time. is that what you need?

dhimmel commented 5 years ago

But what prevents the content associated with the revnum from being changed? Is it possible to also add a checksum to ensure version history hasn't been rewritten?

RangerMauve commented 5 years ago

@dhimmel If somebody decides to have diverging history it'll "corrupt" their Dat and they won't be able to write to it or realistically sync with the network.

I think there was some talk of adding a hash to the URL though. Can't find the link offhand.

RangerMauve commented 5 years ago

I think this? https://github.com/mafintosh/dat-link-checksum

dhimmel commented 5 years ago

Thanks @RangerMauve for the info. I'm new to Dat, so I've got a few more questions. Correct me anywhere I'm wrong.

If somebody decides to have diverging history it'll "corrupt" their Dat and they won't be able to write to it or realistically sync with the network.

My understanding is that appending to a dat requires access to the private key. So the only actors that can create diverging histories are ones with the private key. Let's assume the only person with the private key is the owner / creator.

Rewriting history only "corrupts" the dat in that other nodes may refuse to accept the rewritten history, but only if those nodes have mirrored the public key? Let's assume only the owner is hosting their public key, then they could rewrite history without causing any sort of divergence?

Back to the envisioned use case of the original poster, it could be helpful to be able to link to a specific revision number with a content-derived checksum to ensure integrity.

I think there was some talk of adding a hash to the URL though. I think this? https://github.com/mafintosh/dat-link-checksum

It seems to me that dat-link-checksum by @mafintosh is for adding a checksum to the public key to ensure it hasn't gotten munged. It doesn't have anything to do with checking the content associated with a specific revision.

RangerMauve commented 5 years ago

Let's assume only the owner is hosting their public key, then they could rewrite history without causing any sort of divergence?

Yes, if nobody has a copy of your data in the world, you can set the data to anything you want

... is for adding a checksum to the public key

Sorry, I got the wrong link. The hash of content thing is called "Strong Links" https://github.com/mafintosh/hypercore-strong-link

millette commented 5 years ago

@dhimmel See also this old comment (and thread): https://github.com/datprotocol/discussions/issues/7#issuecomment-352868518

cblgh commented 5 years ago

also related is @jwerle's work expanding on hypercore-strong-link: dat-deep-link

okdistribute commented 4 years ago

related #985