Making eth an application rather than a format #29
Description
This is the argument on why we should have eth-blocks not as a format and a multicodec, but a namespace and an application.
Note: Personally, I am fine either ways! I just want to make sure we make the right choice.
I tend to think that namespace work best in this particular cases, but of course, if we decide that the destiny of CID is to abstract on this, so that everything is an IPLD object, I am fine with this too (but the case for unixfs that I make below, is still valid)
This answers #27 (and https://github.com/unixfs/notes/issues/173) in a different way than the current proposal: application vs data format
Current state: Eth-block as a data format
Eth-block a data format for IPLD:
eth-blocks
will resolve in/ipld
eth-blocks
will need to reserve a multicodec number that will be prefixed their hasheth-blocks
will needipld-parser-eth
Process to transform eth-block
into IPLD:
- read
eth-block
hash - spot multicodec
- decode binary into IPLD
By having eth-block
to be a data format, we are overspecializing a format to only work with a particular application. What if there will be 100 new cryptocurrencies? Will we create new formats?
Proposed: Eth-block as an application
Parallelism with unixfs
Let me start with this unixfs on IPLD parallelism
tl;dr:
- unixfs takes IPLD objects and turn it into IPFS blocks (= IPLD binary)
- ethfs takes Eth blocks (IPLD binary) and turn it into IPLD objects
unixfs as a data format
Say that we treat unixfs as a data format for IPLD, then:
- unixfs would resolve under
/ipld
- unixfs will need to reserve a multicodec number that will be prefixed..
- unixfs needs a
ipld-parser-unixfs
Process to transform unixfs into IPLD
-
read hash, spot multicodec, transform IPLD objects into IPLD binary (= unixfs objects)
unixfs multicodec = 0xIP // /ipld/HASH // say that sharding was actually done this way { shard1: {blocks: [{ '/': h1}, { '/': h2}, { '/': h3}]}, shard2: ... } // /ipld/0xIPHASH Hello how is it going this is my long content...
unixfs as an application
Instead, for simplicity, instead of doing that, we made unixfs an application on top of IPLD, not a data format.
unixfs as an application:
- will need a namespace
/unixfs
/unixfs
will transform IPLD objects into IPLD binary (= unixfs objects) as shown before/unixfs
will serve IPLD binary
Process to transform IPLD to unixfs
- read path, spot namespace, find application mapping namespace, transform IPLD objects into IPLD binary (= unixfs objects)
Eth-block as an application
Eth-block as an application:
- will need
/eth
namespace /eth
will transform IPLD binary (which is Eth binary block) into IPLD objects/eth
will serve IPLD objects (traversable & so on)
Process to transform Eth-block (= IPLD binary) into IPLD object
- read path, spot namespace, find eth application, use eth application to transform a binary into an IPLD object
End of the story
At the end of the day, if you look at the process, it is essentially the same
Differences
- addressing: multicodec vs namespace?
- make binary into IPLD: parser level vs application level?
Other questions
- Isn't Eth-block too application specific to be a data format?
- Are we going to create data formats for every cryptocurrencies and future application specific formats?
- CID can point to different application specific object?
- multicodec has applications-specific format beyond data formats?