Copyright (c) 2017-2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Rich Python bindings for accessing Canton 2.x Ledger API-based applications. It is not intended for use with Canton 3.x.
The user documentation is available online here.
If you just want to use the library, you can install it locally with pip
:
pip install --user dazl
- Python 3.10+
- Go 1.23
- Daml SDK
- Daml 2: 2.10 or later
All of the examples below assume you imported dazl
, and are running a ledger with the default scenario generated with daml new
.
Connect to the ledger and submit a single command:
import asyncio
import dazl
async def main():
async with dazl.connect(url='http://localhost:6865', act_as='Alice') as client:
contract = { 'issuer' : 'Alice', 'owner' : 'Alice', 'name' : 'hello world!' }
await client.create('Main:Asset', contract)
asyncio.run(main())
Connect to the ledger as a single party, print all contracts, and close:
import asyncio
import dazl
from dazl.ledgerutil import ACS
async def main():
async with dazl.connect(url='http://localhost:6865', read_as='Alice') as conn:
async with ACS(conn, {"*": {}}) as acs:
snapshot = await acs.read()
print(snapshot)
asyncio.run(main())
You will need additional dependencies to build locally:
- Direnv (https://direnv.net/)
- Nix (https://nixos.org/download/)
Once you have these prerequisites in place:
make build
Tests in the Daml Python bindings are written using pytest. You can run them by doing:
make test
The Daml Python bindings library are supported under the Daml Enterprise license. If you do not have a Daml Enterprise license and are in need of support, have questions or just want to engage in friendly conversation anything Daml, contact us on our Daml Community Forum.