Inspiration

I wanted to learn more about the details of ICP. My strongest programming language is C#/.Net so I figured I would start there. Building something not exciting helps not only me learn but for the ecosystem to grow by being able to use .Net with IC

What it does

My set of libraries allows .Net code to easily communicate with canisters throught the Http boundry nodes. Its essentially just another Agent implementation. Nuget packages

  • EdjCase.ICP.Candid - library to allow the use of candid types and conversion between C# classes/built in types with candid data structures
  • EdjCase.ICP.Agent - library containing the http agent implementation
  • EdjCase.ICP.ClientGenerator - library/dotnet cli tool to automatically generate C# source code based off of a .did file. Creates an api client and type files based on the service definition

How we built it

Lots of documentation/spec reading and looking at other agent implementations. Came from the approach of making it user friendly, which is the main reason why I also built the Client Generator, because i know implementing api clients is a pain.

Challenges we ran into

Binary encoding and other highly technical parts of the code. Hard to convert binary (which can be little or big endian) to anything without lots of trial and error. Making Candid types and C# types work well together. One big one was Variants, because C# doesn't have that kind of data structure.

Accomplishments that we're proud of

The whole thing in general. Got a good sense of whats really happening with API calls and candid in general. Also the client generator was cool because not only have I never done source code generation but I think it can be really helpful for people who just want to start programming against the IC with no overhead.

What we learned

So much about the ICP, Candid, encodings and Internet Identity. Also powerful variants can be and C# needs them. As a .Net developer, its something I want to use everyday but cant.

What's next for ICP.NET

Probably a lot of bug fixes, but the only main thing I want to do after this initial release is better authentication integration, especially with frontend Blazor. Right I am essentially hacking the dfinity/agent-js library to get the Internet Identity response to then use in C# code. It would be nice to have that more integrated

Built With

Share this project:

Updates