this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

day3 part one actual text

phil 5ddca38b 829020a7

+80 -22
+80 -22
shared/challenges_markdown/three/part_one.md
··· 1 - To recap: [records](https://atproto.com/guides/glossary#record) are kept in [repo](https://atproto.com/guides/glossary#data-repo)s on [PDS](https://atproto.com/guides/glossary#pds-personal-data-server)es. 1 + # Test-drive a CAR 2 2 3 - **Today we're looking at the repo!** Or at least its serialized format. 3 + When apps sync data from your PDS, it comes in a format called a [**C**ontent **A**ddressable a**R**chive](https://ipld.io/specs/transport/car/carv1/#format-description): a CAR file! 🚗 4 4 5 - The repo (repository) is a key-value store of repo-keys to records. The data structure used is called a Merkle Search Tree (MST), but we're not going to worry about that just yet. 5 + This archive can contain your entire "repo" (repository), which is your **[records](https://atproto.com/guides/glossary#record)**, their **keys** (the record's `collection` and `rkey` combined). <small>It also has some additional structural info [for the MST](https://atproto.com/guides/data-repos#data-layout), but we're not going to worry about that just yet!</small> 6 6 7 - Wait, "repo keys"?? Remember [yesterday](./2) how an at-uri is made of three parts, `at://<did>/<collection>/<rkey>`? The second two parts together, `<collection>/<rkey>`, make up the actual raw keys (repo keys) inside your atproto repository. 7 + ## YOU WOULDN'T DOWNLOAD A CAR 8 8 9 + &hellip;who are we kidding, 9 10 11 + <a id="download-car" href="" class="btn btn-primary btn-disabled">Loading (JS required) &hellip;</a> 10 12 11 - TODO blah blah merkle tree but not getting too distracted because this is about the CAR 13 + Your challenge: **find the `verification_code` hidden inside**. 12 14 13 - where do CARs come in? 15 + <details> 16 + <summary>Hint: atproto CAR tools (easy-mode)</summary> 14 17 15 - - nice neat serialization format 16 - - what you get when you export your repo 17 - - what apps get when they sync your repo 18 - - what PDSs send as proof for sync.getRecord 19 - - what gets sent over the firehose 18 + There are some nice web tools for poking around in a CAR: 20 19 21 - - header with root cid 22 - - blocks (cid, block) 20 + <ul> 21 + <li> 22 + <a href="https://satnav.rsky.dev/" target="_blank"> 23 + Satnav 24 + </a> from Blacksy 25 + </li> 26 + <li> 27 + <a href="https://boat.kelinci.net/repo-archive-explore" target="_blank"> 28 + Archive explore 29 + </a> on boat.kelinci.net 30 + </li> 31 + <li> 32 + <a href="https://pdsls.dev/car/explore" target="_blank"> 33 + Explore archive 34 + </a> at PDSls 35 + </li> 36 + </ul> 23 37 24 - - block content is dag-cbor (already covered a bit from day 2) 25 - - there are also MST blocks (also dag-cbor, you can ignore them if you want) 38 + Or, if you have the [goat](https://github.com/bluesky-social/goat?tab=readme-ov-file#goat-go-at-protocol-cli-tool) command-line utility installed, try running: 26 39 27 - OH YEAH terminology note: dag-cbor is out, i think we're all drisl now? drisl-cbor? 28 40 29 - - CIDs (ignorable) 41 + ```bash 42 + goat repo --help 43 + ``` 30 44 31 - ### Your CAR is ready 45 + </details> 32 46 33 - Click the button below for your very own CAR export of an atproto repository. Search the CAR for your verification code and submit it below. 47 + <details> 48 + <summary>CAR libraries (write some code)</summary> 34 49 35 - <a id="download-car" href="" class="btn btn-primary btn-disabled">Loading (JS required) &hellip;</a> 50 + If you're feeling adventurous, you can write a program to show the contents of a CAR file. Some libraries that can help: 51 + 52 + <ul> 53 + <li> 54 + <strong>python:</strong> 55 + <a href="https://atproto.blue/en/latest/atproto/atproto_core.car.car.html" target="blank"><code>atproto_core.car</code></a> 56 + (has sample code) 57 + </li> 58 + <li> 59 + <strong>javascript:</strong> 60 + <a href="https://github.com/mary-ext/atcute/tree/trunk/packages/utilities/repo" target="blank"><code>@atcute/repo</code></a> 61 + (advanced) 62 + </li> 63 + <li> 64 + <strong>golang:</strong> 65 + <a href="https://pkg.go.dev/github.com/bluesky-social/indigo@v0.0.0-20260318212431-cbaa83aee9dd/atproto/repo" target="blank"><code>indigo/atproto/repo</code></a> 66 + (advanced) 67 + </li> 68 + <li> 69 + <strong>rust:</strong> 70 + <a href="https://docs.rs/jacquard-repo/latest/jacquard_repo/index.html" target="blank"><code>jacquard_repo</code></a> 71 + (advanced) 72 + </li> 73 + </ul> 74 + </details> 75 + 76 + <details> 77 + <summary>Binary spelunking (bits &amp; bytes)</summary> 78 + 79 + Oh, you want hard-mode? Here: 80 + 81 + - [CAR format spec](https://ipld.io/specs/transport/car/carv1/#format-description) 82 + - [MST atproto spec](https://atproto.com/specs/repository#mst-structure) 83 + 84 + <details> 85 + <summary>Binary <span style="text-decoration: line-through">hint</span> cheat</summary> 86 + 87 + Text inside records is not compressed or weirdly encoded, and CAR just length-prefixes blocks without changing any bytes, so `strings` or even `hexdump -C` on your CAR might be worth trying&hellip; 88 + </details> 89 + 90 + </details> 91 + 36 92 37 93 <script> 94 + console.log("?????"); 38 95 (function() { 39 96 const button = document.getElementById('download-car'); 40 - const carData = atob("{{car_base64}}"); 97 + console.log("{{{car_base64}}}"); 98 + const carData = atob("{{{car_base64}}}"); 41 99 42 100 if (carData.length === 0) { 43 101 button.textContent = 'Log in to download'; ··· 45 103 } 46 104 47 105 button.classList.remove('btn-disabled'); 48 - button.textContent = 'Download your CAR file'; 106 + button.textContent = 'Download a CAR'; 49 107 50 108 const bytes = new Uint8Array(carData.length); 51 109 for (let i = 0; i < carData.length; i++) bytes[i] = carData.charCodeAt(i);