KRPC protocol implementation

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Sam Truzjan
Maintained by Sam Truzjan


KRPC is simple remote procedure call mechanism used by bittorrent DHT but might be used anywhere else.


KRPC basically consisting of bencoded dictionaries sent over UDP. This implementation provides extra safiety by separation of procedure signature and implementation and baking procedure type in host language, thus it's hard to shoot yourself in the foot accidently.

See bittorrent DHT specification for detailed protocol description.




  • Remote.KRPC — simple interface which reduce all RPC related stuff to a few lines. Should be used in the first place.

  • Remote.KRPC.Protocol — raw protocol implementation.

  • Remote.KRPC.Scheme — message validation.


For usage see examples in `examples` directory. For documentation see haddock generated documentation.

Build Status Build Status


Feel free to report bugs and suggestions via github issue tracker or the mail.


2014-02-19 Sam Truzjan <>

API changes:

* Added isActive: this predicate can be used to implement
MonadActive instance and useful for resource
initialization/finalization sanity check.

2014-01-08 Sam Truzjan <> Logging + exceptions.

API changes:

* MonadLogger is superclass of MonadKRPC;
* KError hidden from Network.KRPC;
* HandlerFailure added;
* QueryFailure and getQueryCount added.

2013-12-25 Sam Truzjan <> Major API changes.

* Added transaction handling;
* Use the same socket for server and client;
* New query function will infer query method from request/response
* Added MonadKRPC and KRPC classes.

2013-11-26 Sam Truzjan <>

* Fixed build failure on GHC == 7.4.*

2013-10-17 Sam Truzjan <>

* Use bencoding-0.4.*

2013-10-03 Sam Truzjan <>

* Minor documentation fixes.

2013-10-03 Sam Truzjan <>

* IPv6 support.

2013-09-28 Sam Truzjan <>

* Use bencoding-0.3.*
* Rename Remote.* to Network.* modules.

2013-09-28 Sam Truzjan <>

* Use bencoding-0.2.2.*

2013-08-27 Sam Truzjan <>

* Async API have been removed, use /async/ package
* Expose caller address in handlers.

2013-07-09 Sam Truzjan <>

* Allow passing raw argument\/result dictionaries.

2013-07-09 Sam Truzjan <>

* Initial version.
comments powered byDisqus