I recently went through the same thing – building my own simple BitTorrent client, mostly just due to curiosity about how the protocol works. There were some tricky parts, most of which are outlined in this but I found the underlying concept so simple. I guess simplicity is a requirement for scale and resilience.
For "Writing BitTorrent Client" workshops I've made, I have created "introductory" tracker and peers (they, for example, display friendly errors if you make invalid protocol requests):
https://torrent.zielmicha.com/
Feross has some great implementations of the different pieces of BitTorrent (including parsing torrent files, magnets etc) in JavaScript on his GitHub[0]. Would recommend people take a look if they find this blog post interesting.
I wrote up my adventure too: http://seanjoflynn.com/research/bittorrent.html