last time i completed the BitTorrent handshake and my client started speaking the peer protocol.
past 2 days i went deeper and stated building the actual peer communication flow
tcp -> handshake -> interested -> bitfield/Have -> unchoke -> request -> piece
after tcp connection and handshake my client now sends INTERESTED and reads the message coming back. i added handling for bitfield, have, choke and unchoke along with maintaining peer's state.
bitfield tells us which pieces a peer has , with some bit manipulation magic i can check whether a piece is available or not . and the peer sent a HAVE message finally
then came UNCHOKE part , which means peer is allowing us to request pieces. also got blasted with lots of bugs cause i thought the messages would arrive in exact order but these protocols don't care about me so i had to make the client keep processing incoming messages and maintains its states properly.
also before i even realized my main.go had become a complete mess cause i threw every fucking thing logic into it lol. now made everything separate .feels good :)
next ?
request -> piece
lots of more bugs incoming lol
last time i completed bitTorrent handshake, now my client can actually speak peer protocol
what does a BitTorrent message actually look like on wire ?
-> length (4 bytes) : how many bytes after length field
-> id : what does it mean
-> payload : optional data
there are 9 main message id's :
choke, unchoke, interested, uninterested, have, bitfield, request, piece, cancel . each of length 1 byte
there are 2 operations happening :
1) serialize
message -> length+ID+payload -> []byte -> tcp
2) ReadMessage
tcp -> read message -> extract id and payload -> message
and connected everything.
now my client sends : interested : to peer
and the peer responded with : have : message
next step ?
bitfields -> figure out exactly which pieces the peer have and requesting pieces
gud nyt :)
Dhirendra retweeted
Designed Google Maps from scratch.
Map tiles, Contraction Hierarchies, HMM map matching, Flink traffic aggregation, bidirectional routing on 500M nodes.
Full HLD breakdown.
Dhirendra retweeted
Here we go again tried best to expalin maths that make gradient boosting works softmax.ai.studio/#14-why-is…
Dhirendra retweeted
I spent the last month building this.
A complete beginner's guide to System Design. Everything on HLD and LLD, from the ground up. Real examples, actual code, and a step by step roadmap to start practicing (No assumed knowledge).
Dhirendra retweeted
did the fan-in and fan-out pattern in Go
fan-out spreads work from one source across multiple worker goroutines so they can run concurrently while fan-in merges those worker outputs back into a single channel so the caller only has to deal with one stream
the order of the results coming back is non-deterministic
it's useful for batches of independent and parallelizable work so one slow job doesn't stall the others
Dhirendra retweeted
System Design has always felt intimidating for beginners. HLD, LLD, and a dozen new terms thrown at you all at once.
That's exactly why I wrote this guide. Everything explained from scratch, with real examples and code.
Added it to my repo of 67 technical articles, all focused on system design, backend engineering, and more.
github.com/harshit3011/Techn…
Dhirendra retweeted
Limitra project update,
So far i implemented and tested 2 rate limiting algos using redis,
i also checked how they work when many requests come at once and used lua scripts to make critical redis operations atomic
i never though this project is going to be that fun, now i am going to implement token bucket algo and we are done with the project
made progress on GoSwarm : bit torrent client in Go
completed bencode encoder, now my bencode can decode and encode data
because bencode requires dictionary keys to be sorted lexicographically and there is no ordering in go maps , i had to extract keys , sort them and then encode in right order. this will help me get exact bencoded "info" dictionary to calculate torrents info hash.
also was inactive due to sih internal round prepartions.
got selected :)
next -> parsing .torrent files and converting metadata in go structure.
gud nyt~
completed bencode parsing in GoSwarm
now it can parse all 4 bencode types and also can handle nested structures + error handlings.
tested for different valid and invalid inputs.
next step ?
torrent metadata parsing.
read a real .torrent file and extract things like url, file name, piece length, piece hashes.
which is required to start communicating with BitTorrent network.
one step at a time :)
good nyt <3
Dhirendra retweeted
I’ve been working with SQLite + Django recently, and something very basic suddenly made me curious:
How does a database just appear when I run "python manage.py migrate"?
Dhirendra retweeted
Today I mowed the lawn, changed the turtle's water, folded my clothes and cooked a meal! #AIart️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️ #Aivideo
🤖 Made with AI
Dhirendra retweeted
I built a stock market dashboard last year.
Then I never posted about it.
TradeX started alongside a JS Mastery course while I was still figuring out how to go from following tutorials to actually building things myself.
A year later, I came back to it.
I fixed the rough edges, reworked parts of the architecture, added features I actually wanted, and turned it into something I now use myself.
Live market data. Watchlists. Background price alerts with email delivery. Gemini-powered market insights.
But the interesting part isn't really the UI.
It's everything behind it that has to keep working when the API gets rate-limited, an email fails, a database becomes temporarily unavailable, or users aren't even on the website.
I wrote up the whole build, including the engineering problems I ran into and how I solved them.
🧵
built my 1st CLI tool in Go
lolcat - tool that prints ur texts in rainbow colors
can take input in multiple ways
- directly from cli args
- Stdin using pipes
- from files
learned about :
os.args and cli, piping, buffio, file handling, ANSI escape, unicode handling
Dhirendra retweeted
Another dev studio has started using MascoFast.com🚀
They’re currently using it for their own rebranding and they loved the fact that the text stays intact throughout animation unlike our 'competitors'.
4 months ago → damn, this idea of building mascofast.com sounds cool. I should work on it.
3 months ago → I don’t think anyone will pay for this.
2 months ago → I should build it anyway.
1 month ago → launched the beta.
Today → a well-known dev studio from Thailand is using MascoFast to generate mascots for one of their clients.
They loved the results and the fact that it took just 15–20 minutes to go from ideation to finalizing the mascot and its animations.
Dhirendra retweeted
I connected smart bulb to my code's CI pipeline, which changes colour according to the CI stages status, watch video to know more
Dhirendra retweeted
Tried to make the clone of Eufloria (some game that I liked a lot)
Refinements are needed for the game but atleast the workflow idea that I had thought of works.
I can work on projects on the go and test them on my phone.
Even godot is working
Flight take off time👋 (will put some task to be solved on the VM while I go offline)
We’re travelling, so let’s see how far we can push this system 👀
Let’s see if we can actually build something like this.
I doubt the AI-generated background images will be good enough without something like Higgsfield… but we’re going to find out.
Also installed Godot on my VM.
Next step: expose the virtual screen so I can see the game rendered from my phone.
Building games from a phone, through a cloud VM, while travelling would be pretty damn cool if this works. 😎











































