RFP 19:Daml Traffic Cost Attribution, per-choice traffic cost for Daml developers. Feedback welcome, seeking a Tech & Ops champion
- Wilson00OP
Hi Daml Language & Developer Tooling SIG,
We are CURG, a blockchain research society of professionals working in the blockchain industry. Our two developers hold Daml certifications issued by Digital Asset. We submitted a Development Fund proposal for RFP 19 (DPM Components) and RFP 18 (SDLC integration). We would like the SIG’s feedback, and we are looking for a Tech & Ops Committee champion.
Problem
On the Global Synchronizer, every transaction pays for its sequenced bytes at the MainNet extra traffic price. How many bytes a transaction uses depends on how the Daml is written: what a contract holds, who the observers are, and how many transactions a workflow takes.
PrepareSubmission.costEstimationalready returns an estimate, but only as one number. A developer can see that a choice costs 42 KB, but not why, or what to change. Developers on other smart contract platforms get per-function cost from their editor and test suite (for example Remix, Hardhat’s gas reporter, Foundry’sforge snapshot); Daml developers have no equivalent.What our proof of concept measured
We built a proof of concept that measures traffic cost on a local synchronizer with traffic enabled and three participants, with Global Synchronizer-like traffic parameters (Canton 3.7.2). We compared pairs of Daml patterns that do the same job.
- The native estimate is accurate. Over 52 transactions, it differed from the request cost actually charged (
paidTrafficCost, Canton 3.7+) by 0.67% on average and 1.2% at most. What is missing is attribution, not accuracy. - Raw size does not explain the charge. Two 50,000-character fields in the same contract and choice: random data added about 39,000 B, and one repeated character added under 100 B. Charges apply to compressed bytes, so field-length rules are unreliable.
- Participants matter, not parties. Each new receiving participant added about 370 B. Another party on a participant that already receives the message added about 100 B.
- Structure matters by an order of magnitude. Splitting a frequently updated field out of a large contract: 11.8× cheaper. Batching 20 creates into one transaction: 12.6× cheaper. A direct choice instead of propose/accept: 1.94× cheaper.
What we will build
A DPM component (
dpm cost, name subject to DPM conventions) that attributes each choice’s charged traffic to its causes: fixed per-transaction overhead, the compressed bytes of individual fields, and receiving participants. It also suggests the fix. For example, in one transaction from our proof of concept ametadatafield that the choice never changed accounted for about 39 KB of 42.6 KB. The same attribution appears in three places:- VS Code CodeLens above each choice (contributed to the existing Daml VS Code extension where its maintainers agree, otherwise a separate extension)
- a GitHub Action that posts a cost diff showing which cause changed
- a linter on compiled Daml-LF (SARIF) that ships only rules backed by measurements (the proof of concept already ruled out a duplicate-fetch rule that made no difference)
Request: 1,550,000 CC (about USD 114,000 at USD 0.0735/CC on 2026-11-22): 6 months of delivery and adoption, then 6 months of maintenance. 430,000 CC is tied to adoption (cost reports for at least 5 public Daml repositories, upstream optimization PRs or issues, and a tutorial), and 120,000 CC is a separate maintenance milestone.
Questions for the SIG
- Would a per-choice cost breakdown help your team, or is the single estimate enough in practice?
- Would a Tech & Ops Committee member be willing to champion this proposal, or point us to the right person?
Thank you.
Wilson, CURG (slee000220@gmail.com)
- The native estimate is accurate. Over 52 transactions, it differed from the request cost actually charged (