1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
The CAR format used for repository exports is compatible with IPLD. This means
the generic `ipfs` command-line tool (aka,
[kubo](https://docs.ipfs.tech/reference/kubo/cli/#ipfs-dag)) can be used to
import and explore the tree contents.
NOTE: The nested '/' on CID references in the `ipfs dag get` output below seems
to be a representation of the CBOR "tag" for CID types. There is not actually a
nested map/object with a key "/". This is confirmed by inspecting the raw CBOR
using a python CBOR library (later on below).
$ ipfs dag import example_repo.car
Pinned root bafyreibqsl5vgfxmyngl6xdacp2mlc2j4u55jncocxdkcdwmq6xxtoqomq success
$ ipfs dag stat bafyreibqsl5vgfxmyngl6xdacp2mlc2j4u55jncocxdkcdwmq6xxtoqomq
Size: 4430, NumBlocks: 36
$ ipfs dag get bafyreibqsl5vgfxmyngl6xdacp2mlc2j4u55jncocxdkcdwmq6xxtoqomq | jq .
{
"root": {
"/": "bafyreigxijbdrrybjetiaesyijvyheyfhvqak5iytpdsmpgmxgnwzqwpay"
},
"sig": {
"/": {
"bytes": "p+ZJTt63M0WFLy/KVeSmmG6kYuq2cvRbEBZPzHqeJe2IQfOkPl5G6x5P6ckggQ28eyc6q4FcKKHIjC8lS45pdA"
}
}
}
# /root
$ ipfs dag get bafyreigxijbdrrybjetiaesyijvyheyfhvqak5iytpdsmpgmxgnwzqwpay | jq .
{
"auth_token": null,
"data": {
"/": "bafyreidrm6a2yucvumvug253af5fuxxwatgzid2wlq5c23kn5fvztwlbxi"
},
"meta": {
"/": "bafyreib2pmfqcvbcpl6gtjgnaegvd4chn24cnat74pw3vrmfqr2jwd4n7m"
},
"prev": {
"/": "bafyreidoekwhnzs2czs275nttwegy5j56foauwwjyr7qqfehyx5xnjctmy"
}
}
# /root/meta
$ ipfs dag get bafyreib2pmfqcvbcpl6gtjgnaegvd4chn24cnat74pw3vrmfqr2jwd4n7m | jq .
{
"datastore": "mst",
"did": "did:plc:mj35frj7bgu6c2wszbtakt3e",
"version": 1
}
# /root/data
$ ipfs dag get bafyreidrm6a2yucvumvug253af5fuxxwatgzid2wlq5c23kn5fvztwlbxi | jq .
{
"e": [
{
"k": "app.bsky.follow/3jg4dmbn5y22a",
"p": 0,
"t": null,
"v": {
"/": "bafyreiegjavmgolbmo5yh54dy2ywkk2t3hg4ou7qugdggfdq4hedetddwm"
}
},
{
"k": "post/3jg4f3m6xas2a",
"p": 9,
"t": null,
"v": {
"/": "bafyreicaxix5adqs6e2yjmp4hui2ugfrn2ahquzrcdzb4b6j5l4xskansa"
}
},
{
"k": "com.example.thing/3jg4frpqngk2a",
"p": 0,
"t": null,
"v": {
"/": "bafyreieznv5quj54itdo7slq2rncjotmfxxtdnw3uwu7hi35euahp5a6im"
}
},
{
"k": "rk7a22a",
"p": 24,
"t": null,
"v": {
"/": "bafyreieznv5quj54itdo7slq2rncjotmfxxtdnw3uwu7hi35euahp5a6im"
}
}
],
"l": null
}
# app.bsky.post/3jg4f3m6xas2a record
$ ipfs dag get bafyreicaxix5adqs6e2yjmp4hui2ugfrn2ahquzrcdzb4b6j5l4xskansa
{
"text": "blah"
}
Can also fetch raw MST nodes and records:
# app.bsky.post/3jg4f3m6xas2a record
$ ipfs block stat bafyreicaxix5adqs6e2yjmp4hui2ugfrn2ahquzrcdzb4b6j5l4xskansa
Key: bafyreicaxix5adqs6e2yjmp4hui2ugfrn2ahquzrcdzb4b6j5l4xskansa
Size: 11
# app.bsky.post/3jg4f3m6xas2a record
$ ipfs block get bafyreicaxix5adqs6e2yjmp4hui2ugfrn2ahquzrcdzb4b6j5l4xskansa > post.cbor
# MST node
$ ipfs block get bafyreidrm6a2yucvumvug253af5fuxxwatgzid2wlq5c23kn5fvztwlbxi > mst_node.cbor
Load CBOR records in python (`python3-cbor`):
import cbor
cbor.load(open("./post.cbor", "rb"))
# {'text': 'blah'}
cbor.load(open("./mst_node.cbor", "rb"))
#{'e': [{'k': 'app.bsky.follow/3jg4dmbn5y22a',
# 'p': 0,
# 't': None,
# 'v': Tag(42, b'\x00\x01q\x12 \x86H*\xc39ac\xbb\x83\xf7\x83\xc6\xb1e+S\xd9\xcd\xc7S\xf0\xa1\x86c\x14p\xe1\xc82Lc\xb3')},
# {'k': 'post/3jg4f3m6xas2a',
# 'p': 9,
# 't': None,
# 'v': Tag(42, b'\x00\x01q\x12 @\xba/\xd0\x0e\x12\xf15\x84\xb1\xfc=\x11\xaa\x18\xb1n\x80xS1\x10\xf2\x1e\x07\xc9\xea\xf9y(\r\x90')},
# {'k': 'com.example.thing/3jg4frpqngk2a',
# 'p': 0,
# 't': None,
# 'v': Tag(42, b"\x00\x01q\x12 \x99m{\n'\xbcD\xc6\xef\xc9p\xd4Z$\xbal-\xef1\xb6\xdb\xa5\xa9\xf3\xa3}%\x00w\xf4\x1eC")},
# {'k': 'rk7a22a',
# 'p': 24,
# 't': None,
# 'v': Tag(42, b"\x00\x01q\x12 \x99m{\n'\xbcD\xc6\xef\xc9p\xd4Z$\xbal-\xef1\xb6\xdb\xa5\xa9\xf3\xa3}%\x00w\xf4\x1eC")}],
# 'l': None}
Bigger set of records (showing more of MST structure):
$ ipfs dag import bigger.cbor
Pinned root bafyreifo6tgkutpfdub7s24whpjosgvh2wk2woezzs7udz23mt4exspzzi success
# /root/data
$ ipfs dag get bafyreicou4t4riqlb3ipda27uhbcmdesh363ir6rsnozrk4aimqvblhh3y | jq .
{
"e": [
{
"k": "app.bsky.post/3jg6amq5bbs2a",
"p": 0,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "niss2a",
"p": 21,
"t": {
"/": "bafyreigmfcmuca3j3llcwtranptvx6ndygnrva3k3xixjyc7lqgmg7c3gu"
},
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "w6ius2a",
"p": 20,
"t": {
"/": "bafyreiatpb2iwp2ajsk6lqy5cqqdkny6lhj5dltwjq3tb7il3zpyyx23yu"
},
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
}
],
"l": {
"/": "bafyreicg4wvrelokgneuylmckcp2ykxc67q4dqmcxjrfcmidjevn3qv53y"
}
}
$ ipfs dag get bafyreigmfcmuca3j3llcwtranptvx6ndygnrva3k3xixjyc7lqgmg7c3gu | jq .
{
"e": [
{
"k": "app.bsky.post/3jg6amr5pek2a",
"p": 0,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "md5c2a",
"p": 21,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "s4zd22a",
"p": 20,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "nxcs2a",
"p": 21,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "t4ccc2a",
"p": 20,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "n7cs2a",
"p": 21,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "u3mas2a",
"p": 20,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "mszs2a",
"p": 21,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "v4rrk2a",
"p": 20,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "n66s2a",
"p": 21,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
}
],
"l": null
}
$ ipfs dag get bafyreicg4wvrelokgneuylmckcp2ykxc67q4dqmcxjrfcmidjevn3qv53y | jq .
{
"e": [
{
"k": "app.bsky.post/3jg5zkr322c2a",
"p": 0,
"t": null,
"v": {
"/": "bafyreig2aqlsg4arslck64wbo2hnhe6k2a4z3z2sjfzh3uapv3a4zjld7e"
}
},
{
"k": "6amijiis2a",
"p": 17,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "oy3tc2a",
"p": 20,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
},
{
"k": "pkfrc2a",
"p": 20,
"t": null,
"v": {
"/": "bafyreia4ggyqf23jyd3tspghzqlusqd7ob4hvjjfp6xkescosrc6telxdq"
}
}
],
"l": null
}
|