-
Notifications
You must be signed in to change notification settings - Fork 110
Enable multihash support for swarm root hashes & ENS #186
Comments
Is this surely needed for 0.3? |
I bundled all the backward compatibility breaking changes under the 0.3 label. |
let's not change the hashes that go into ENS twice. Once for BMT and once more for multihash. |
Ok, I get it, let's not break compatibility again after 0.3 if possible |
I'll repeat my comment from Issue 440 - because the --encrypt flag is new. With the advent of encrypted swarm uploads (swarm up --encrypt) requiring double length hashes, it is time to update swarm to use multi-hash. Adding the double-length encrypted swarm hashes to ENS would require a lot of changes. According to Arachnid: And if we are already in need of changing so much, this is the perfect opportunity to: "Instead of bytes32, we can use 'bytes', and start using multihash, so we can support Swarm, IPFS, and any other content-addressed system." |
Saying multihash does not seems to me enough to set a standard for URLs, because a multihash is a binary.
|
All well and good, but Keccak256 hashes were picked in order to provide seamless interoperability with the Ethereum blockchain (which uses keccak256). This allows better and easier integration with smart contracts for various purposes. And since Swarm is, after all, a core project of the Ethereum Foundation, this is highly unlikely to change. @homotopycolimit to veer back into your questions, there's a few considerations to give room for:
|
A few things to note: 1(one) I thought yes. 4(four) It doesn't. I'm just saying that it order to save to ENS the reference to an encrypted swarm upload, we have to change the ENS resolvers anyway. This all came about when Swarm Feeds were introduced. They were (are?) using multihashes. Do you know the current state of affairs there? edit: autoformatting messed up my numbering. |
I don't see how multihash is helping us except by complicating things around Swarm code. Swarm works using 32-byte hashes only, so why does it need to understand what type of hash it is reading out of ENS? It should just expect 32 bytes out of the resolver, and if those 32 bytes interpreted as a Keccak256 don't yield content after looking up, well, so that content does not exist.
I think you are confusing a hex representation of a byte array with how a byte array is stored. The Multihash for Keccak256 is actually prefixed with
What is the point of encrypting something and then publishing the decryption key somewhere like ENS where everyone can see it? When browsing such encrypted website, only the content hash should be in ENS, and the decryption key should be something you have in some sort of wallet. Perhaps the browser should prompt you for it like when you try to access a username/password protected URL. If you insist publishing the decryption key, then some sort of manifest should do the trick |
Swarm Feeds does not use multihashes anymore. It works like a key-value store in which the key is If, however, you choose to store in that arbitrary data something that looks like a multihash, then you can use that Feed in combination with Note that for the above scheme to work, the hash stored in the Feed would not need to be a multihash. It could be a straightforward regular Swarm hash if we make the necessary change. The whole |
one of the points of encrypting something is so that the storers don't know the contents of what they are storing. Indeed in future the encrypted upload might be the only one. No more plaintext. |
@ Javier, what it the best way forward for feeds? |
ok.
I would then store the encrypted key in a manifest. The hash of that manifest would go to ENS. That way no changes to ENS are required. This is a huge advantage. |
@homotopycolimit regarding what? Regarding multihash, Feeds does not use/have any multihash anywhere in its code. I posted above another comment about Feeds. Does that answer your question? |
I saw your comment and thus asked what is the best way forward? Shall we close this issue and change swarm feeds to just use regular swarm hashes? in regards to decryption keys -- the manifests are themselves encrypted. Everything is. You need a decryption key just to get started. (calling @nagydani - what do you make of unencrypted manifests containing references to encrypted content?) |
TL;DR. Yes Longer read: Just a clarification: Feeds does not "use" multihashes, it blindly stores arbitrary data. Whether that data is a multihash or not, Feeds does not know or care.
I would change |
I would add an additional manifest that points to the actually encrypted manifest+data, because even if you do not store the decryption key in Swarm you would then be storing it in ENS: nodes could also scan ENS for decryption keys too (?), so what is the point? |
I think using the same hashes for feeds as for regular content sounds good, but is not my decision to make. To clarify, one more point about encryption: every chunk in the chunk tree of a dataset is encrypted with a different key. Only the decryption key of the root chunk would be visible in ENS. You'd have to recursively download the entire trie in order to decrypt the data chunks. I particular, if you hold one chunk and do not know what dataset it belongs to, you cannot decrypt it. |
I am facepalming myself 😭
I remembered this but somehow missed the point where the length is written into the multihash. Again facepalm.
That's a bit of a problem actually because when you create an unencrypted manifest with that reference it would be possible to a node to intercept that manifest (it would probably fit into one chunk) and the decryption key could possibly leak. That would be the same case for retrieval requests as forwarding nodes could intercept decryption keys and encrypted references. @homotopycolimit I think that this issue is within an overlap with this issue (which will actually give a real solution to the problem. well. it won't solve storing decryption keys on ENS) #940 multihashes are just half of a solution since they just describe the type of the hashing algorithm, they don't describe the storage infrastructure on which the content hash resides on. Unless web3 storage and delivery providers (swarm, ipfs, storj) work out a convention to use between themselves on extending multihashes with Dstorage provider identifiers embedded into the multihash, this won't really solve anything. |
reverse indexing ENS is prettty simple thing to do. So only who does not want to know will not know. Now as for supporting multihash on |
Whoops, it seems that in the last few weeks the discussion has progressed in the provided EIP. See: New contract: https://github.com/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol @homotopycolimit I think we can close this issue |
Now as for supporting multihash on bzz, i am ok with that but find it a bit pointless, since if any client knows that 0x1b20.... hashes need swarm to resolve they can just as well trim this prefix before handing it to bzz ...
Given what I have read by exploring the links posted by @justelad regarding multiaddr, I think we should remove the whole multihash stuff from `bzz:`, since it is confusing people using Feeds, and any indicator that a hash is intended for Swarm will live in ENS anyway. This will reduce our complexity. If you agree, I'll open a PR to do this.
|
@jpeletier my vote is 👍for getting rid of multihashes at this point. they provide no real benefit in the codebase for our current use cases |
Ok. Let get rid of multihash in swarm and work towards using https://eips.ethereum.org/EIPS/eip-1577 for ENS. I will now close this issue. We can create new ones as needed. |
PR to remove multihash: ethereum/go-ethereum#18175 |
Goal: as described in #166 we want to be able to request swarm data using URLs of the form bzz://<multi-hash>/path/in/manifest.
The reason is that this will allow people to store multi-hashes in the ENS resolver contracts at "content" and thereby allowing swarm and ipfs and other systems to exists side by side.
This change also allows us to add to ENS Swarm content that has been uploaded with the
--encrypt
flag. In the current system that is not possible.The text was updated successfully, but these errors were encountered: