Skip to content
CCPEDIAby Unity Nodes
Outreach

Canton .NET SDK 0.7.0: from a Daml model to a tested .NET app on Canton 3.6

2 posts87 views1 likesLast activity 24d ago

  1. matthieuOP 1

    Canton .NET SDK 0.7.0 is out: a stable, open-source (Apache-2.0) SDK for building on Canton 3.6 in C# and .NET. All packages are on nuget.org.

    Many teams in finance build and run their systems on .NET. This SDK takes them from a Daml model to a tested Canton application without leaving their language and tooling.

    What it does:

    1. Generate your model. dpm codegen-cs turns a Daml package into typed C#, so mistakes show up when the code compiles rather than on the ledger. Ready-made packages cover the Splice Token Standard and Daml Finance.
    2. Talk to the ledger. One client submits over gRPC or the JSON Ledger API, and the PQS client queries contracts with the same generated types.
    3. Sign with confidence. For external signing, the client recomputes the transaction hash and refuses a mismatch before anything is signed.
    4. Test and observe. In-memory test doubles serve your unit tests, and OpenTelemetry traces each call.

    Start here:

    1. Run the demo app. It runs a Token Standard V2 transfer from Daml source to a local Canton ledger in about 20 minutes, once .NET, a JDK and Docker are installed.
    2. See it in action:
    3. Tell us what you’re building. If your team builds in .NET and is looking at Canton, we’d like to help you get started. Share your project in this thread, or email info@peaceful.studio.

    Peaceful Studio

  2. matthieu

    0.8.0 is out, supporting Canton 3.7 :rocket:

    The SDK now pins the protos and the JSON Ledger API spec at Canton 3.7.1 (every 3.7.x patch works) and ships C# bindings for Splice 0.10.0. Teams still on Canton 3.6 can stay on 0.7.x. Here is what is new since the post above, with a walkthrough for each on GitHub:

    • Daml codegen at dotnet build, no JDK needed. Add Daml.Codegen.CSharp.MSBuild and a <DamlArchive Include="contracts.dar" /> item, and the bindings are generated during the build by a .NET DAR decoder that ships inside the package. dpm codegen-cs is still there if you prefer it. Walkthrough
    • Writes you can reason about. CommandBatch submits several commands as one atomic transaction with typed results, RecoverAsync resolves a write left in an unknown state as committed, rejected or lost, and the new Canton.Ledger.AspNetCore package maps ledger outcomes to RFC 9457 ProblemDetails. Walkthrough
    • A typed Token Standard registry client. Splice.Api.Token.Registry.Client covers the registries’ off-ledger API, and CreatedEventBlob.Decode checks the signatories of the disclosed contracts before you submit. Walkthrough
    • An Intermediate DAR oracle for every SDK author. Each release publishes the JVM reference decoding (built on Digital Asset’s daml-lf-archive) of a conformance corpus of DARs, and the intermediate-dar-oracle-check GitHub Action diffs your own decoder against it. Useful if you are writing a Canton SDK in Rust, Go, TypeScript or any other language, without running a JVM yourself. Walkthrough

    The matching stack is Canton LocalNet v0.10.0-1 (Splice 0.10.0, Canton 3.7.1, protocol version 37 by default), and the mini demo is on 0.8.0 too.

    0.8.0 is a breaking release: bump all SDK packages together, run dpm install 3.7.1 and regenerate your bindings. The release notes list every API change, and the GitHub announcement is open for questions.

    We’d like to hear how the upgrade goes and what you would improve. Bugs are easiest to track as GitHub issues.