canton-network-repos
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCanton Network Open-Source Repositories
Canton Network 开源仓库
This skill provides comprehensive knowledge about the Canton Network open-source ecosystem, repository relationships, and build processes.
本技能提供关于Canton Network开源生态系统、仓库依赖关系及构建流程的全面知识。
Activation
适用场景
Use this skill when:
- Working with Canton Network, DAML, or Splice repositories
- Investigating version compatibility issues
- Understanding enterprise vs community differences
- Debugging LF version or package ID mismatches
- Building Canton participants or Splice applications
在以下场景中使用本技能:
- 处理Canton Network、DAML或Splice仓库相关工作
- 排查版本兼容性问题
- 理解企业版与社区版的差异
- 调试LF版本或包ID不匹配问题
- 构建Canton节点或Splice应用
Repository Hierarchy
仓库层级结构
┌─────────────────────────────────────────────────────────────────┐
│ Splice Version (e.g., 0.5.4) │
│ github.com/digital-asset/decentralized-canton-sync │
│ Applications: Validator, SV, Wallet, Scan, Amulet (CC) │
└─────────────────────────┬───────────────────────────────────────┘
│ depends on
▼
┌─────────────────────────────────────────────────────────────────┐
│ Canton Version (e.g., 3.4.9) │
│ github.com/digital-asset/canton │
│ Runtime: Participant, Sequencer, Mediator, Admin API │
└─────────────────────────┬───────────────────────────────────────┘
│ depends on
▼
┌─────────────────────────────────────────────────────────────────┐
│ DAML SDK (e.g., 3.4.9) │
│ github.com/digital-asset/daml │
│ Compiler: damlc, LF Engine, Ledger API, stdlib, protobuf │
└─────────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────────┐
│ Splice Version (e.g., 0.5.4) │
│ github.com/digital-asset/decentralized-canton-sync │
│ Applications: Validator, SV, Wallet, Scan, Amulet (CC) │
└─────────────────────────┬───────────────────────────────────────┘
│ depends on
▼
┌─────────────────────────────────────────────────────────────────┐
│ Canton Version (e.g., 3.4.9) │
│ github.com/digital-asset/canton │
│ Runtime: Participant, Sequencer, Mediator, Admin API │
└─────────────────────────┬───────────────────────────────────────┘
│ depends on
▼
┌─────────────────────────────────────────────────────────────────┐
│ DAML SDK (e.g., 3.4.9) │
│ github.com/digital-asset/daml │
│ Compiler: damlc, LF Engine, Ledger API, stdlib, protobuf │
└─────────────────────────────────────────────────────────────────┘Repository Details
仓库详情
1. DAML SDK (github.com/digital-asset/daml
)
github.com/digital-asset/daml1. DAML SDK (github.com/digital-asset/daml
)
github.com/digital-asset/damlPurpose: Smart contract language, compiler, and runtime libraries.
Key Directories:
daml/
├── sdk/
│ ├── compiler/damlc/ # Haskell compiler source
│ │ └── lib/DA/Cli/Options.hs # --target version validation
│ ├── daml-lf/
│ │ ├── language/ # LF version definitions (Scala)
│ │ ├── engine/ # LF execution engine
│ │ └── archive/ # DALF protobuf format
│ └── canton/ # Canton runtime (submodule)
├── ledger-api/ # gRPC API definitions
└── VERSION # SDK version stringLF Version Definitions ( at v3.4.9):
LanguageVersion.scalascala
// V2 versions defined
val List(v2_1, v2_2, v2_dev) = AllV2 // Line 51 - v2_2 IS defined
// Version ranges
case Major.V2 => VersionRange(v2_1, v2_2) // Line 171 - StableVersions includes v2_2
def AllVersions = VersionRange(v2_1, v2_dev)
// Features at v2_2:
val flatArchive = v2_2
val kindInterning = flatArchive
val exprInterning = flatArchive
val explicitPkgImports = v2_2
val unsafeFromInterfaceRemoved = v2_2Note: v2_2 IS in SDK v3.4.9 source. Older snapshots may not include it.
damlc Target Validation ():
Options.hshaskell
lfVersionOpt :: Parser LF.Version
-- Validates against LF.supportedOutputVersions
-- Error: "Unknown Daml-LF version: X" if not in list用途:智能合约语言、编译器及运行时库。
核心目录:
daml/
├── sdk/
│ ├── compiler/damlc/ # Haskell compiler source
│ │ └── lib/DA/Cli/Options.hs # --target version validation
│ ├── daml-lf/
│ │ ├── language/ # LF version definitions (Scala)
│ │ ├── engine/ # LF execution engine
│ │ └── archive/ # DALF protobuf format
│ └── canton/ # Canton runtime (submodule)
├── ledger-api/ # gRPC API definitions
└── VERSION # SDK version stringLF版本定义(v3.4.9版本下的):
LanguageVersion.scalascala
// V2 versions defined
val List(v2_1, v2_2, v2_dev) = AllV2 // Line 51 - v2_2 IS defined
// Version ranges
case Major.V2 => VersionRange(v2_1, v2_2) // Line 171 - StableVersions includes v2_2
def AllVersions = VersionRange(v2_1, v2_dev)
// Features at v2_2:
val flatArchive = v2_2
val kindInterning = flatArchive
val exprInterning = flatArchive
val explicitPkgImports = v2_2
val unsafeFromInterfaceRemoved = v2_2注意:v2_2在SDK v3.4.9源码中已定义。旧版快照可能未包含该版本。
damlc目标版本验证():
Options.hshaskell
lfVersionOpt :: Parser LF.Version
-- Validates against LF.supportedOutputVersions
-- Error: "Unknown Daml-LF version: X" if not in list2. Canton (github.com/digital-asset/canton
)
github.com/digital-asset/canton2. Canton (github.com/digital-asset/canton
)
github.com/digital-asset/cantonPurpose: Distributed ledger runtime implementing the Canton Protocol.
Key Directories:
canton/
├── community/ # Open-source Canton
│ ├── app/ # CantonCommunityApp entry point
│ ├── participant/ # Participant node implementation
│ ├── domain/ # Embedded domain (sequencer/mediator)
│ └── common/src/main/daml/ # Built-in DAML packages
│ └── AdminWorkflows/ # Ping, party replication DARs
├── daml/ # DAML SDK submodule
├── daml_dependencies.json # LF library versions
├── VERSION # Canton version
└── version.sbt # SBT version configBuilt-in DARs (embedded in JAR):
canton-builtin-admin-workflow-ping.darcanton-builtin-admin-workflow-party-replication-alpha.darCantonExamples.dar
Enterprise vs Community:
| Feature | Enterprise | Community |
|---|---|---|
| Main class | CantonEnterpriseApp | CantonCommunityApp |
| Transaction processing | Parallel | Sequential |
| Pruning | Available | Limited |
| Database | PostgreSQL, Oracle | PostgreSQL only |
| HA Domain | Supported | Embedded only |
用途:实现Canton协议的分布式账本运行时。
核心目录:
canton/
├── community/ # Open-source Canton
│ ├── app/ # CantonCommunityApp entry point
│ ├── participant/ # Participant node implementation
│ ├── domain/ # Embedded domain (sequencer/mediator)
│ └── common/src/main/daml/ # Built-in DAML packages
│ └── AdminWorkflows/ # Ping, party replication DARs
├── daml/ # DAML SDK submodule
├── daml_dependencies.json # LF library versions
├── VERSION # Canton version
└── version.sbt # SBT version config内置DAR包(嵌入在JAR中):
canton-builtin-admin-workflow-ping.darcanton-builtin-admin-workflow-party-replication-alpha.darCantonExamples.dar
企业版 vs 社区版:
| 特性 | 企业版 | 社区版 |
|---|---|---|
| 主类 | CantonEnterpriseApp | CantonCommunityApp |
| 事务处理 | 并行 | 串行 |
| 数据清理 | 支持完整功能 | 功能受限 |
| 数据库 | PostgreSQL、Oracle | 仅支持PostgreSQL |
| 高可用域 | 支持 | 仅支持嵌入式 |
3. Splice (github.com/digital-asset/decentralized-canton-sync
)
github.com/digital-asset/decentralized-canton-sync3. Splice (github.com/digital-asset/decentralized-canton-sync
)
github.com/digital-asset/decentralized-canton-syncPurpose: Decentralized synchronizer governance, Amulet (Canton Coin), and network applications.
Key Directories:
decentralized-canton-sync/
├── project/
│ ├── CantonDependencies.scala # Version config, LF versions
│ └── DamlPlugin.scala # DAR build logic
├── daml/
│ ├── splice-amulet/ # Canton Coin token contracts
│ ├── splice-wallet/ # Wallet contracts
│ ├── splice-dso-governance/ # DSO governance
│ └── */daml.yaml # Package configs with --target
├── apps/
│ ├── sv/ # Super Validator app
│ ├── validator/ # Validator app
│ ├── wallet/ # Wallet backend
│ └── scan/ # Payment scan service
├── cluster/images/ # Docker image builds
│ └── canton-community/ # Community participant image
└── daml-compiler-sources.json # Compiler version referenceCritical Configuration ():
CantonDependencies.scalascala
object CantonDependencies {
val version: String = "3.4.9"
val daml_language_versions = Seq("2.1") // ← LF target version
val daml_libraries_version = version
val daml_compiler_version = sys.env("DAML_COMPILER_VERSION")
}Package Target ():
daml/splice-amulet/daml.yamlyaml
sdk-version: 3.3.0-snapshot.20250502.13767.0.v2fc6c7e2
build-options:
- --target=2.1 # Explicit LF 2.1 target用途:去中心化同步器治理、Amulet(Canton Coin)及网络应用。
核心目录:
decentralized-canton-sync/
├── project/
│ ├── CantonDependencies.scala # Version config, LF versions
│ └── DamlPlugin.scala # DAR build logic
├── daml/
│ ├── splice-amulet/ # Canton Coin token contracts
│ ├── splice-wallet/ # Wallet contracts
│ ├── splice-dso-governance/ # DSO governance
│ └── */daml.yaml # Package configs with --target
├── apps/
│ ├── sv/ # Super Validator app
│ ├── validator/ # Validator app
│ ├── wallet/ # Wallet backend
│ └── scan/ # Payment scan service
├── cluster/images/ # Docker image builds
│ └── canton-community/ # Community participant image
└── daml-compiler-sources.json # Compiler version reference关键配置():
CantonDependencies.scalascala
object CantonDependencies {
val version: String = "3.4.9"
val daml_language_versions = Seq("2.1") // ← LF target version
val daml_libraries_version = version
val daml_compiler_version = sys.env("DAML_COMPILER_VERSION")
}包目标版本():
daml/splice-amulet/daml.yamlyaml
sdk-version: 3.3.0-snapshot.20250502.13767.0.v2fc6c7e2
build-options:
- --target=2.1 # Explicit LF 2.1 targetVersion Mapping
版本映射表
| Splice | Canton | DAML SDK | Protocol | LF (Default) | LF (With SDK 3.4.9) |
|---|---|---|---|---|---|
| 0.5.4 | 3.4.9 | 3.4.9 | PV34 | 2.1* | 2.2 (verified) |
| 0.5.3 | 3.4.8 | 3.4.8 | PV34 | 2.1* | 2.2 |
| 0.4.x | 3.3.x | 3.3.x | PV33 | 2.1 | 2.1 |
*Open-source Splice 0.5.4 ships with SDK snapshot which predates LF 2.2.
3.3.0-snapshot.20250502Root Cause (Verified): The public Splice release uses an SDK snapshot from May 2, 2025, but LF 2.2 was added to the SDK on October 3, 2025. Updating to SDK 3.4.9 enables LF 2.2 builds.
Key insight: LF 2.2 is fully available in open-source SDK v3.4.9. The Splice project simply needs to be updated to use the newer SDK.
| Splice | Canton | DAML SDK | 协议 | LF(默认) | LF(使用SDK 3.4.9) |
|---|---|---|---|---|---|
| 0.5.4 | 3.4.9 | 3.4.9 | PV34 | 2.1* | 2.2(已验证) |
| 0.5.3 | 3.4.8 | 3.4.8 | PV34 | 2.1* | 2.2 |
| 0.4.x | 3.3.x | 3.3.x | PV33 | 2.1 | 2.1 |
*开源Splice 0.5.4使用的SDK快照版本为,该版本早于LF 2.2的发布时间。
3.3.0-snapshot.20250502根本原因(已验证):公开的Splice版本使用的SDK快照发布于2025年5月2日,而LF 2.2是在2025年10月3日才加入SDK的。升级到SDK 3.4.9即可支持LF 2.2构建。
核心结论:LF 2.2在开源SDK v3.4.9中已完全可用。Splice项目只需升级至新版本SDK即可。
LF Version Implications
LF版本影响
Package ID Derivation
包ID生成逻辑
Package IDs are cryptographic hashes derived from:
- Package source content
- LF version used ()
--target - SDK/stdlib versions
- Dependency package IDs
Changing LF version = Different package IDs = Incompatible packages
包ID是基于以下内容生成的加密哈希:
- 包源码内容
- 使用的LF版本(参数指定)
--target - SDK/标准库版本
- 依赖包ID
修改LF版本 = 生成不同的包ID = 包不兼容
Upgrade Validation
升级验证
Canton validates package upgrades:
- Upgraded packages must use equal or newer LF version
- LF 2.1 package cannot "upgrade" to LF 2.2 package (different IDs)
- Mixing LF versions on same ledger causes validation failures
Canton会对包升级进行验证:
- 升级后的包必须使用等于或更高版本的LF
- LF 2.1包无法“升级”为LF 2.2包(包ID不同)
- 同一账本中混合使用不同LF版本会导致验证失败
Building from Open-Source
从开源代码构建
Community Canton Participant
社区版Canton节点
bash
cd canton
sbt "community/app/assembly"bash
cd canton
sbt "community/app/assembly"Output: community/app/target/scala-2.13/canton-community.jar
Output: community/app/target/scala-2.13/canton-community.jar
undefinedundefinedSplice Applications
Splice应用
bash
cd decentralized-canton-sync
sbt compile # Requires DAML_COMPILER_VERSION env varbash
cd decentralized-canton-sync
sbt compile # Requires DAML_COMPILER_VERSION env varBuilding with LF 2.2 (Verified Working)
使用LF 2.2构建(已验证可行)
LF 2.2 is available in SDK v3.4.9. The following steps have been verified to work:
-
Edit:
project/CantonDependencies.scalascalaval daml_language_versions = Seq("2.2") -
Update:
nix/daml-compiler-sources.jsonjson{ "version": "3.4.9" } -
Update allfiles:
daml/*/daml.yamlyamlsdk-version: 3.4.9 build-options: - --target=2.2 -
Remove invalid warning flags (not present in SDK 3.4.9):bash
# Remove -Wno-ledger-time-is-alpha from all daml.yaml files -
Build packages:bash
cd decentralized-canton-sync nix-shell -p daml-sdk --run "daml build -p daml/splice-util" nix-shell -p daml-sdk --run "daml build -p daml/splice-amulet"
Verified: splice-util and splice-amulet build successfully with LF 2.2 and SDK 3.4.9.
LF 2.2在SDK v3.4.9中可用。以下步骤已验证可行:
-
编辑:
project/CantonDependencies.scalascalaval daml_language_versions = Seq("2.2") -
更新:
nix/daml-compiler-sources.jsonjson{ "version": "3.4.9" } -
更新所有文件:
daml/*/daml.yamlyamlsdk-version: 3.4.9 build-options: - --target=2.2 -
移除无效的警告标志(SDK 3.4.9中不存在):bash
# Remove -Wno-ledger-time-is-alpha from all daml.yaml files -
构建包:bash
cd decentralized-canton-sync nix-shell -p daml-sdk --run "daml build -p daml/splice-util" nix-shell -p daml-sdk --run "daml build -p daml/splice-amulet"
已验证:splice-util和splice-amulet可通过LF 2.2和SDK 3.4.9成功构建。
Fully Open-Source LF 2.2 Build (Verified)
完全开源的LF 2.2构建(已验证)
Both Splice and Canton can be built with LF 2.2 from entirely open-source code:
Splice和Canton均可完全基于开源代码使用LF 2.2构建:
Canton Built-in DARs
Canton内置DAR包
Update Canton's daml.yaml files:
bash
cd canton/community更新Canton的daml.yaml文件:
bash
cd canton/communityUpdate all daml.yaml files to sdk-version: 3.4.9 and --target=2.2
Update all daml.yaml files to sdk-version: 3.4.9 and --target=2.2
perl -pi -e 's/sdk-version: 3.3.0-snapshot.[^\n]*/sdk-version: 3.4.9/g' **/daml.yaml
perl -pi -e 's/--target=2.1/--target=2.2/g' **/daml.yaml
Rebuild Canton:
```bash
sbt "canton-community-app/assembly"perl -pi -e 's/sdk-version: 3.3.0-snapshot.[^\n]*/sdk-version: 3.4.9/g' **/daml.yaml
perl -pi -e 's/--target=2.1/--target=2.2/g' **/daml.yaml
重新构建Canton:
```bash
sbt "canton-community-app/assembly"Verified Results (2025-12-24)
验证结果(2025-12-24)
Community-built DARs have identical package IDs to enterprise:
canton-builtin-admin-workflow-ping-3.4.9-fbeb863dab36da66d99...
This confirms full compatibility with enterprise deployments.
社区版构建的DAR包与企业版的包ID完全一致:
canton-builtin-admin-workflow-ping-3.4.9-fbeb863dab36da66d99...
这证实了社区版构建与企业版部署完全兼容。
Key Files Reference
核心文件参考
| Purpose | Repository | File |
|---|---|---|
| LF versions (Scala) | daml | |
| damlc validation | daml | |
| Canton version | canton | |
| Canton DARs | canton | |
| Splice LF config | splice | |
| Package targets | splice | |
| Docker builds | splice | |
| 用途 | 仓库 | 文件 |
|---|---|---|
| LF版本定义(Scala) | daml | |
| damlc验证逻辑 | daml | |
| Canton版本 | canton | |
| Canton DAR包 | canton | |
| Splice LF配置 | splice | |
| 包目标版本 | splice | |
| Docker构建 | splice | |
Troubleshooting
故障排查
"Unknown Daml-LF version: 2.2"
“Unknown Daml-LF version: 2.2”(未知Daml-LF版本:2.2)
- Cause: damlc binary doesn't support 2.2 in
supportedOutputVersions - Check: for supported targets
daml damlc --help - Fix: Use SDK version that includes 2.2, or use 2.1
- 原因:damlc二进制文件的中不支持2.2版本
supportedOutputVersions - 检查:执行查看支持的目标版本
daml damlc --help - 解决:使用包含2.2版本的SDK,或切换至2.1版本
Package ID Mismatch
包ID不匹配
- Cause: Different LF versions between builds
- Check:
unzip -p package.dar META-INF/MANIFEST.MF | grep Sdk-Version - Fix: Ensure consistent across all builds
--target
- 原因:构建时使用了不同的LF版本
- 检查:执行查看SDK版本
unzip -p package.dar META-INF/MANIFEST.MF | grep Sdk-Version - 解决:确保所有构建使用一致的参数
--target
Upgrade Validation Failed
升级验证失败
- Cause: Trying to swap enterprise (LF 2.2) with community (LF 2.1) packages
- Fix: Use DAR injection to maintain LF 2.2 compatibility
- 原因:尝试将企业版(LF 2.2)包替换为社区版(LF 2.1)包
- 解决:使用DAR注入方式保持LF 2.2兼容性