Post

Avatar
๐ŸŒŸ WhiteWind TechTalk ๐ŸŒŸ We're thrilled to announce the launch of new article series: WhiteWind TechTalk! ๐Ÿš€ In our very first edition, dive into the fascinating world of atproto - get to know the key players and their roles in an engaging overview. whtwnd.com/whtwnd.com/3... #atproto #atdev
Introduction to atproto 1: What is PDS๏ผŸ What Features Does It Have๏ผŸ | whtwnd.comwhtwnd.com
Avatar
This is the best way to showcase the service as well. Love it.
Avatar
If you're setting up tutorials, I'd love one on how to go from a CAR (like one may get from the firehose) to extracting images, thread parents, user full profiles, etc.
Avatar
Interested in this too. ๐Ÿง
Avatar
You can read a CAR like github.com/interfect/sk... but that just gives you a mapping from CIDs to blocks, so then you have to beg borrow or steal a Merkel Search Tree implementation github.com/interfect/sk... and then you can look through the "collections" of skeets in its string-keyed namespace.
Avatar
Might also help to learn to spell "Merkle"
Avatar
Avatar
In conclusion we need *way* more tutorials for this stuff.
Avatar
You can also presumably just call `get_post` atproto.blue/en/latest/at... and make the server do the search for you, but where's the fun in that????
Avatar
Then you have to: * Parse the URI * Maybe resolve a handle in it to a DID with atproto.blue/en/latest/at... * Get the latest commit in that person's repo atproto.blue/en/latest/at... * Take the CID from that and use it as the root of a Merkle Search Tree. Search the tree for the right key.
Avatar
So say you want a post's thread parent. If you decipher the Lexicon schema for skeets or look at some, it turns out they have a "reply" field, which has "root" and "parent" fields, each of which has both a "uri" and a "cid". It looks like your SDK has objects like that: atproto.blue/en/latest/at...
app.bsky.feed.postatproto.blue
Avatar
Or, really, it looks like `CAR` already decoded all the blocks to dicts for you in the firehose example. And the CAR object has a blocks field: atproto.blue/en/latest/at... So just look at all the values in that dict and some of them ought to be skeets.
Avatar
So if you are getting blocks, you can decode each block's bytes as CBOR, handling the special Bluesky tag 42 which they use to represent the CIDs of other blocks. It looks like your SDK there has atproto.blue/en/latest/at... to do this.
Avatar
The blocks that are skeets will be CBOR-encoded things following the `app.bsky.feed.post` Lexicon schema at github.com/bluesky-soci... which is written in the Lexicon language that the Bluesky folks invented. The actual useful documentation for what a post is is at docs.bsky.app/docs/advance...
Posts | Blueskydocs.bsky.app This is an in-depth dive into how creating a post works on Bluesky. We'll use Python below, without a SDK, so you can see how it works behind the scenes.
Avatar
The blocks make up a Merkle Search Tree as described in atproto.com/specs/reposi... Some of the blocks are the actual CBOR-encoded skeets or likes or whatever. Some of the blocks are nodes in the tree and are there for looking up CIDs for the actual skeets from `post/3kprdgmc4hv2w` type keys.
Repository | AT Protocolatproto.com Self-authenticating storage for public account content
Avatar
If you decide you need more blocks you would fetch them with calls like `get_record`/`get_repo`/`get_block` under `com.atproto.sync`: atproto.blue/en/latest/at...
Avatar
It looks like the firehose will give you commits to people's repos, but only as new blocks: atproto.blue/en/latest/at... I *think* that those blocks will be a path from the root of the tree to the new thing, so you might be able to just follow that slice of the tree down.
Avatar
Rally good and simple explanation :-)
Avatar
Avatar
This is a great explanation, thanks!