Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file protocol #3

Closed
wants to merge 9 commits into from
Closed

file protocol #3

wants to merge 9 commits into from

Conversation

ryanxcharles
Copy link
Contributor

This is a protocol for files on the blockchain. It is the simplest possible protocol I can think of.

@ryanxcharles
Copy link
Contributor Author

ryanxcharles commented Jan 27, 2019

Idea:

The .bitcoin file format

This is a file that consists of a concatenated list of txids. Each txid has an opreturn with another file in it. The files may be a normal file, or another .bitcoin file.

A .bitcoin file is a way of storing very large files on the blockchain. You can convert, say, a movie to a bitcoin file by breaking it up into chunks that are less than 100 KB. Each chunk gets a file. You then list those chunks in a .bitcoin file.

For very large files, like a movie, there will be too many txids to fit in a single 100 KB txid. So you make one master .bitcoin file that stores a bunch of other .bitcoin files that in turn store the actual movie data one after the other.

  • top level: movie.mp4.bitcoin
  • second level: movie.mp4.1.bitcoin, movie.mp4.2.bitcoin, movie.mp4.3.bitcoin, ..., movie.mp4.1000.bitcoin
  • third level movie.mp4.1-1.bitcoin, movie.mp4.1-2.bitcoin, ... movie.mp4.2-1.bitcoin, movie.mp4.2-2.bitcoin, ...

The lowest level files are a series that contain 100 KB chunks of the movie in a row and can be reconstructed to form the actual movie.mp4 file.

@shadders
Copy link
Contributor

Is it assumed that the reconstructed file uses the same filename with the '.bitcoin' extension stripped off? If so I think it would be helpful for the spec to state that explicity. If that's the convention it saves needing another field.

I would suggest that to cover future cases where there may be many OP_RETURN outputs that list of txids should be a list of txid:vout that is byte[32]:unit32. To stick with bitcoin convention the uint32 would be little endian encoded. Another option to save a few bytes is to use CompactInt format. In the vast majority of cases this squashes 4 bytes to 1 byte. It comes with the disadvantage of making each entry variable length but that is easy to resolve during parsing.

@shadders
Copy link
Contributor

closed as there are more developed forms of this spec: #8

@shadders shadders closed this Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants