This project started as a toolset for debugging and working with atproto. Things like resolving handles, downloading repos, parsing repos, etc. Eventually it turned into a PDS implementation.
Nowadays I spend most of my time working on the Rust version -> rustproto.
(Note: dnproto is an independent, community-driven project and is not affiliated with, sponsored by, or endorsed by Bluesky Social, PBC.)
CAR repo encoding and decoding:
- Repo.cs - repo parsing entry point, and explains repo structure ⭐
- DagCborObject.cs - decoding/encoding dag cbor ⭐
- CidV1.cs - decoding/encoding cid
- VarInt.cs - decoding/encoding varint
MST data structure:
- Mst.cs - MST
- MstNode.cs - represents one node in the MST
- MstEntry.cs - represents on entry in a MST node
PDS implementation:
- /xrpc/ - the XRPC endpoints
- Installer.cs - installing the PDS
- Pds.cs - PDS entry point
- PdsDb.cs - the database interface, where the repo is stored
- RepoMst.cs - converting MST into dag-cbor for use in repos
- UserRepo.cs - operations on the user's repo
Listening to a firehose:
General Bluesky WS calls:
- BlueskyClient.cs - calling the Bluesky API.
The following steps show how to use the command line tool on Windows in PowerShell. Requires .NET 10.
To get started, change into the root directory and build.
dotnet buildNext, change into the scripts directory, and list the files:
cd powershell
lsMost of the files in this directory represent one "command" of the tool. Here are some that I call most often:
# resolve actor info and retrieve did, did doc
.\ResolveActorInfo.ps1 -actor <handle or did>
# get plc dir history for actor
.\GetPlcHistory.ps1 -actor <handle or did>
# download the user's repo and store in the data directory
.\GetRepo.ps1 -actor <handle or did>
# print stats for the downloaded repo
.\PrintRepoStats.ps1 -actor <handle or did>
# print records for the downloaded repo
.\PrintRepoRecords.ps1 -actor <handle or did>
# print posts for the downloaded repo
.\PrintRepoPosts.ps1
# log in to the account. stores session locally
.\CreateSession.ps1 -actor <handle or did> -password <password>
# get unread count for logged in session
.\GetUnreadCount.ps1
# create new post for logged in session
.\CreatePost.ps1 -text "hello world"
# log out of account
.\DeleteSession.ps1 -actor <handle or did>
When you are using the command line tool, it uses a local directory to store cached data. By default, it uses the "data" directory in the repo. You can change this in the _Defaults.ps1 file.
When someone is having issues with their account, I like to run the following commands:
- ResolveActorInfo - just check their DID, DID doc, etc
- GetPdsInfo - lists things on their PDS
- GetPlcHistory - checks their PLC history - make sure that the account isn't active in multiple places
- StartFirehoseConsumer - make sure you can connect to their PDS (I've seen this fail)
- DescribeRepo - check that it looks ok
Also you can query the DID for moderation labels:
https://mod.bsky.app/xrpc/com.atproto.label.queryLabels?uriPatterns=USERS_DID
Is Linux supported? Yes! I run my dnproto PDS on Linux.