DAML Smart Contract Audits: What Gets Checked and Why
A DAML smart contract audit reviews DAML contracts for authorisation, privacy and logic flaws, checking the code matches the agreed rules before real value moves.
On this page
Short answer
A DAML smart contract audit is an independent review of contracts written in DAML, the smart contract language from Digital Asset, that checks whether the code does what its authors intended and whether any party can misuse it. The audit covers authorisation, privacy, choices, the data model, upgrades and error handling, and it ends with ranked findings and a retest of the fixes.
What is a DAML smart contract audit?
A DAML smart contract audit is an independent review of contracts written in DAML, the smart contract language from Digital Asset, that checks whether the code does what its authors intended and whether it can be misused. The auditor reads the contract code, tests its behaviour and reports the problems it finds.
DAML contracts model rights and obligations between named parties. A contract states who can act, what they can do and what happens next, and the ledger enforces those rules. An audit checks that the rules in the code match the rules the business agreed, and that no party can do something the agreement never allowed.
Audits matter because DAML contracts often move real value: cash, securities and other assets on the Canton network. A flaw in the code can let the wrong party settle a trade, see data they should not see, or block a payment that should go through. For the general case, see what a smart contract audit is.
What makes DAML different from other smart contract languages?
DAML differs from most smart contract languages in three ways: authorisation is part of the language, privacy is built into the ledger, and execution is deterministic. Each of these changes what an audit must check.
Authorisation in DAML is explicit. Every action on a contract needs a signatory, the party who agrees to it, and the language checks that the right party signed. An auditor therefore checks the signatory and observer lists on every template, not just the business logic.
Privacy is also different. On Canton, a party only sees the contracts it is a party to, so data does not leak to the whole network by default. The audit must check that observers are added only where the business needs them, because each observer widens who can see the data.
Deterministic execution means the same input always gives the same result, which removes a whole class of timing and ordering flaws found in other platforms.
What does an audit check?
An audit covers the contract code, the data model and the way the contracts fit together. The table below lists the main check areas and what the auditor looks for in each one.
| Check area | What the auditor checks | Why it matters |
|---|---|---|
| Authorisation | Signatories and controllers on every choice | Stops the wrong party acting |
| Privacy | Observers and data shared with each party | Keeps business data with its owners |
| Choices | Preconditions and what each choice changes | Prevents invalid state changes |
| Data model | Fields, types and how contracts link | Avoids broken or ambiguous records |
| Upgrades | How old contracts move to new versions | Stops stranded or duplicated assets |
| Error handling | What happens when a step fails | Keeps failed trades from half-completing |
Authorisation and privacy get the most attention, because they are where DAML differs most from other languages and where a small mistake has the largest effect. A missing signatory check can hand control of an asset to the wrong party.
How does a DAML audit run?
A DAML audit runs in stages, from scoping to retesting. The team agrees the scope first, then the auditors work through the code and the tests before writing up what they found.
- Agree the scope. List the templates, interfaces and workflows in scope, and what is out of scope.
- Read the contracts. Auditors read every template, choice and interface by hand.
- Build a threat model. List what each party could try to do, and what the code must prevent.
- Test the behaviour. Run scenarios in a sandbox, including hostile ones, and check the results.
- Write the report. Rank each finding by severity and give a fix for each one.
- Retest the fixes. Check that each fix works and did not break something else.
The whole process usually takes weeks, not days, because the reading stage is slow and careful. A report that only lists automated tool output is not a full audit. For the step-by-step method, see how to audit a smart contract.
What problems do DAML audits usually find?
Most findings fall into a few repeatable groups. Auditors see the same kinds of mistakes across projects, which is why a checklist of known problem areas is part of every audit.
- Missing authorisation checks. A choice that any party can exercise when only one should be able to.
- Over-wide observers. Parties added as observers who have no business need to see the contract.
- Unchecked preconditions. A choice that runs even when the contract is in the wrong state.
- Stale contract versions. Old templates still live after an upgrade, so assets split across versions.
- Weak error paths. A failed step that leaves a half-finished workflow with no way back.
- Leaked fields. Data in a contract that a party should not see, carried in through a shared template.
Most findings are not exotic. They are ordinary mistakes in who can act and who can see, made under deadline pressure. That is why the authorisation and privacy checks come first in the review.
Example (hypothetical): auditing a settlement workflow
Example (hypothetical): a settlement workflow has three parties, a buyer, a seller and a custodian, and five choices across its contracts: propose, accept, fund, settle and cancel. The auditors write 40 test scenarios covering each choice, including attempts by the wrong party and attempts in the wrong order.
Of the 40 scenarios, 38 pass and 2 fail. Both failures trace to the same missing check: the cancel choice can be exercised by the buyer after the custodian has already funded the trade, which leaves the money with the seller while the trade is marked cancelled. The fix adds a precondition that blocks cancel once funding has happened.
After the fix, the auditors run all 40 scenarios again and all 40 pass. They also add 6 new scenarios around the fixed choice, and those pass too. The audit report records the finding as high severity, because it could have moved money the wrong way, and notes the retest as passed.
What are the common mistakes?
The most common mistakes in DAML audits are scoping the audit too narrowly, trusting the code because the language is safe, and skipping the retest after fixes. Each of these leaves real risk on the table.
- Auditing templates but not workflows. A flaw often lives in how contracts interact, not in one template.
- Assuming DAML safety means no audit is needed. The language prevents some errors, but not wrong business rules.
- Skipping the retest. A fix that is never retested may not work, or may break another path.
- Forgetting upgrades. A contract that cannot be upgraded safely will strand assets when the rules change.
- Ignoring privacy. Observers are easy to add and easy to forget, and each one widens the data leak.
Plan the audit before the launch date, not after it. A finding found in audit costs a fix; the same finding found in production costs a fix plus the damage it already did. For what an audit costs, see smart contract audit cost.
Key takeaways
- DAML builds authorisation and privacy into the language, so audits focus on signatories and observers
- The most common findings are missing authorisation checks and over-wide observers
- An audit runs from scoping to retesting, and a report without a retest is not complete
- Flaws often live in how contracts interact, not in a single template
- Plan the audit before launch: a finding in audit costs a fix, in production it costs more
Frequently asked questions
Do DAML contracts need auditing if the language is safe?
Yes. DAML prevents some errors, such as double spending, but it cannot check whether the business rules in the code are the right ones. A wrong signatory, an over-wide observer or a missing precondition are all legal DAML, and only a review finds them.
How is a DAML audit different from a Solidity audit?
The focus shifts. Solidity audits spend much time on reentrancy, gas and arithmetic, which DAML largely removes. DAML audits spend that time on authorisation, privacy and workflow logic, where the risk actually sits for DAML projects.
How long does a DAML smart contract audit take?
It depends on the number of templates and workflows, but a typical audit takes weeks rather than days. The reading stage is slow because auditors check every template, choice and interface by hand, and the retest stage adds more time after fixes.
What should a team prepare before an audit?
Prepare the contract code, a description of each workflow, the list of parties and what each one should be able to do, and any existing tests. The clearer the intended behaviour, the faster auditors can spot where the code differs from it.
Can automated tools replace a DAML audit?
No. Automated tools can flag simple patterns, but they cannot judge whether a business rule is right or whether an observer should see a contract. A manual review by people who understand the workflow is still the core of the audit.
When should a DAML audit happen?
Before the contracts move real value, and again after any major change to the templates or workflows. Auditing after launch means any flaw found has already had a chance to cause damage.