-
Notifications
You must be signed in to change notification settings - Fork 50
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
Document on the IPFS Repo Spec, the things we store on Datastore #21
Comments
@diasdavid :There are four keys in the go-ipfs datastore leveldb database: key= /F5UXA3TTF4JCB5OTOYTDCBGWYFARRBGGIPJR4KKXVXBGOHK4C5MB47SOZHQM3LH6 The top two keys are unique to the repo and change each time init is run. The bottom two are static. The values for these keys seem to be encrypted. As an example, the data for the first key is: Y��9_)a���˹2�R�m�Ŗke�9���� Can you help me figure out how to decode the values? |
@SidHarder why did you close this issue? |
The last two are not encrypted, i believe these are hashes to look into the blocks. The first two may be routing records. also likely an object hash. |
We in 0.4.3 (I think) shifted from binary keys which were getting corrupted by our sanitation operations to base32 encoded keys. |
@Kubuxu I believe you just changed that in |
no, datastore too as it was also problem with IPNS records where keys are hashes of public key. |
OK, I am making some progress: The value for the key '/local/filesroot' is the hash of the root folder. The value is binary. The go function is core/core.go:563. The value of this key should match the result of the command: 'ipfs files stat --hash /', (however, I have not been able to make this work yet) |
@dignifiedquire I'm sorry I didn't mean to close it. |
Yes, the value is binary CID, v1 probably in new version and v0 in an older ones. |
The "/local/pins" key: go-ipfs reference: pin/pin.go:450 |
Im trying to verify the /local/filesroot key, when I use the js-ipfs-cid class as below the result I get is: 2Dkx8D3WqjChhe3ZGUvQ2Jkj5LT428yvFGzv3KD6c1Pz which doesn't match the result of "ipfs files stat --hash /" which is QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn. Not sure what I'm doing wrong. var levelup = require('levelup') var ops = [{ var db = levelup('../../.ipfs/datastore', ops, function (err, db) {
}) |
@Kubuxu Can you help me understand why when I retrieve the value for the "/local/filesroot" key and convert it to base58 I get this: 2Dkx8D3WqjChhe3ZGUvQ2Jkj5LT428yvFGzv3KD6c1Pz instead of QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn which is the result of "ipfs files stat --hash /". Also, I am retrieving the key/value pair and converting it using Node. |
I just dumped this key from go-ipfs: |
Also the key you sent has quite a weird pattern at the end hex |
@Kubuxu It must be how level up is retrieving the value. I see if I can figure it out. Thanks for your help. |
OK the code below will extract the /local/filesroot key and base58 encode it. The extracted value matches the result of ipfs files stat --hash. The "valueEncoding: binary" is really important. const level = require('level') db.get('/local/filesroot', function (err, value) { |
awesome progress @SidHarder :) Wanna start making the PR that adds that levelDB store and tests? |
@diasdavid I'll get started. |
@diasdavid Does it make sense to have a datastore.js module in js-ipfs-repo/src/stores? This module could be used during the init process to add the necessary keys and values. |
@SidHarder absolutely. Just have in mind that it needs to be LevelDB for nodejs and indexedDB for when in the browser |
We still need this list, @SidHarder could you PR to the README the current keys that ipfs uses to store things in the repo? |
@diasdavid the keys that Go IPFS stores in the Datastore are: key= /F5UXA3TTF4JCB5OTOYTDCBGWYFARRBGGIPJR4KKXVXBGOHK4C5MB47SOZHQM3LH6 I'm sorry but I don't understand what you mean by PR to the README. |
The first two records are:
|
@SidHarder Would you like to wrap this task and add the findings to the Readme? |
//cc @pgte |
No description provided.
The text was updated successfully, but these errors were encountered: