-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support identity CIDs #3289
Comments
Definitely looks like a bug. Ref. |
I confirm this is still broken in the latest js-ipfs: await ipfs.dag.get(new CID('bafkqaaa')) Identity CIDs are super useful for passing tiny amounts of data, confirmation that node works fine in webui and other places like tests (to speed them up by skippimng content routing where not in scope), so I'm bumping this in priority and adding to our maintenance project board so we can discuss this next week. I did not dig into js-ipfs internals, but: /dag/get.js delegates things to |
@lidel Heads up on strategy for addressing this: My intent was to mirror this strategy in JS -- the way golang handles identity hashes is it adds an extension to the blockstore that when checks if request CIDs are identity hashes, and if so, just returns a block made from the decoded hash. You can find the implementation here: https://github.com/ipfs/go-ipfs-blockstore/blob/master/idstore.go My goal was just to PR against js-ipfs-repo, with a similar implementation to augment the existing blockstore, and then to bubble that up through js-ipfs. |
You could change the repo to expose a facade that delegates to a datastore instance and do the identity CID check there but I think we need to look at the repo structure in the scope of protocol/web3-dev-team#47 An easier way would be to PR the block service - it's used by the block api and by IPLD, and delegates to either bitswap or the repo so you could do the check there. |
@achingbrain My intent was was to put the code in there, and I believe you shouldn't need to patch the interface datastore implementations, because this sits on top. The rationale was just to preserve the symmetry between go-ipfs & js-ipfs strategies, but I'm definitely open to doing it in the block service if you think it's important. |
Quite right, that'll teach me to go by memory - sorry for the confusion.
No, put it in the repo as proposed, I think @vmx will eventually refactor the block service away anyway. |
creates a layer on top of blockstore which makes the blockstore compatible with identity hashes. Based off of https://github.com/ipfs/go-ipfs-blockstore/blob/master/idstore.go fix ipfs/js-ipfs#3289
- Separate out typing for the blockstore interface - Implement `idstore` based on https://github.com/ipfs/go-ipfs-blockstore/blob/master/idstore.go - this leaves the original blockstore implementation unchanged but adds a composable layer applied on top to add compatibility with identity hashes (served as the same blockstore interface) - add `idstore` in construction of `repo.blocks` fix ipfs/js-ipfs#3289
- Adds support for identity hashes in ipfs-repo blockstore - Add core interface tests for block.get and dag.get when fetching identity hashes Refs: ipfs/js-ipfs-repo#297 Closes: #3289 Co-authored-by: Alex Potsides <[email protected]>
Version: 0.50.2
Platform: macos
Subsystem: dag api
Severity:
Low
Description:
I'm wondering how to work with "identity" CIDs. Tried some apis that I thought would intuitively work with them, but they seem to hang (more info below).
An identity CID is created by using the identity multihash which has codec
0x00
and the value of the hash is just the data itself. An example can be found here: https://cid.ipfs.io/#bafyqacnbmrqxgzdgdeauiIs there some other way that is recomended to work with identity CIDs than the normal dag api?
Steps to reproduce the error:
Both of these method calls just hang:
The text was updated successfully, but these errors were encountered: