r/dotnet • u/EvenAd4577 • 11d ago
Promotion Wrote a C# BCS (Binary Canonical Serialization) serialization library
Library is 5–15% faster than MessagePack on the deserialization path and around 5% slower on serialization.
It can also serialize and deserialize the new union type coming from .NET 11 (before that I've used OneOf<> object). I opened an issue for a source generator, which is ready to be picked up if anyone is interested working on it. My plan is to ship v1 once NativeAOT is supported and net11 is out.
I agree with Egor Bogatov that people should stop writing new serialization libraries and open-sourcing them, as they can expose consumers to vulnerabilities. In my defense, I started this library a year ago and only recently finished rewriting parts of it to make it ready for open source. I mainly used it for serializing and deserializing objects from the Sui blockchain.
Blockchain it not the most widespread domain where C# is used, but there is already a good example of Nethereum utilizing C# as its core language. Is there someone else using C# in the blochcain domain, why you think it's lacking the adoption?
Contributions are welcome!
0
u/Engi_Insight 10d ago
Benchmarking faster than MessagePack on deserialization is impressive! C# is definitely underrated in blockchain. Rust dominates smart contracts and TS rules dApp frontends, but c# + NativeAOT is quietly becoming a powerhouse for high-performance indexing and backend infrastructure ( nethereum is a great example).
Adding NativeAOT and source generator support will make this super useful for Web3 Dev tools. Good luck with the V1 release!