# 組み込みの型

> アプリとwalletとexchangeをCantonにつなぐ型を選び、データの読み方、移転の証明、USDCxの入金と出金までを、章の中の図解で追います。

- URL: https://cardene.dev/diagrams/canton-ext-integration
- 公開日: 2026-11-24
- 更新日: 2026-11-24
- トピック: Blockchain
- タグ: Canton
- 親の図解: [Canton Networkの全体像](https://cardene.dev/diagrams/canton-network.md): トランザクションの中身を関わるpartyにだけ見せるCanton Networkについて、部品ごとの役割と、1つのトランザクションが部品の間をどう流れるかを段ごとに追います。
- 子の図解: [アプリにCantonを組み込む型](https://cardene.dev/diagrams/canton-integration-patterns.md): walletとトークンと他のアプリとデータの読み出しの、よく使う4つの組み込みの型と、プライバシーの扱いと、エラーのやり直しを追います。
- 子の図解: [walletとexchangeの組み込み方](https://cardene.dev/diagrams/canton-wx-basics.md): walletとexchangeがCanton Networkにつなぐ時の、partyとhostとデータの読み方の違いと、必須と任意の機能とmemo tagを追います。
- 子の図解: [移転を証明しUSDCxを扱う](https://cardene.dev/diagrams/canton-wx-proof-usdcx.md): walletが移転の証明の材料のTransfer ObjectとUpdateIDをどう取り出して残すかと、USDCxの入金と出金の実装を、段ごとに追います。

この章では、自分のアプリやwalletやexchangeをCanton Networkにつなぐ人の目線で、どの型を選び、何に気を付けて作るかを追います。
Cantonの身元とデータの見え方は、パブリックなブロックチェーンと違います。
そのため、つなぐ前に、型の選び方と、データの読み方の違いを押さえます。

まず、アプリにCantonを組み込む、よく使う4つの型と、どの型でも守るプライバシーの設計と、エラーのやり直しを見ます。

https://cardene.dev/diagrams/canton-integration-patterns

次に、walletとexchangeがつなぐ時の、台帳の身元とデータの読み方と、対応する機能の必須と任意と、exchangeへの入金を口座に届けるmemo tagを追います。
memo tagは、exchangeの利用者の口座を見分けるIDを、移転の情報と一緒に送るパターンです。

https://cardene.dev/diagrams/canton-wx-basics

最後に、walletが移転の証明の材料をどう取り出して残すかと、USDCxの入金と出金をどう実装するかを追います。
USDCxは、元のチェーンでCircleがロックしたUSDCを表す、Canton上のトークンです。

https://cardene.dev/diagrams/canton-wx-proof-usdcx

下の図は、この章の3つの頁を、自前のAPIとLedger APIと、walletとexchangeの頁と、移転を証明しUSDCxを扱う頁の順に置きます。
自前のAPIと2つの頁の箱は、押すと説明する頁を開きます。
walletとexchangeと、移転の証明とUSDCxの箱は、頁の分類で、1つの部品ではありません。

```dragon
architecture 自前のAPIとwalletとexchangeの頁からCantonへ
group Top as Cantonにつなぐ所 [icon: net]
  box App as 自前のAPI [note: データ型で単純な問い合わせを出す, color: blue, icon: app, link: /diagrams/canton-integration-patterns]
  box Api as Ledger API [note: 実時間の問い合わせ, color: slate, icon: server]
  box Wx as walletとexchange [note: 分類。必須の機能とmemo tagの役割, color: rose, icon: card, link: /diagrams/canton-wx-basics]
  box Proof as 移転の証明とUSDCx [note: 分類。walletが残す証明の材料と、入金と出金, color: rose, icon: db, link: /diagrams/canton-wx-proof-usdcx]
end

step 自前のAPIからLedger APIへ
  say データ型では、自前のAPIが、単純な問い合わせと実時間の問い合わせを、Ledger APIに出します。walletとexchangeの頁は、必須の機能と、memo tagでの入金の照合を扱います。移転を証明しUSDCxを扱う頁は、walletが残す移転の証明の材料と、USDCxの入金と出金を扱います。
  App -> Api: 問い合わせる
  source CantonのIntegration Patterns [url: https://docs.canton.network/integrations/integration-patterns]
  source CantonのIntegrations Overview [url: https://docs.canton.network/integrations/overview]
  source CantonのCanton Network Overview [url: https://docs.canton.network/integrations/wallets-and-exchanges/canton-network-overview]
  source CantonのIntegrating with the Canton Network [url: https://docs.canton.network/integrations/wallets-and-exchanges/integrating-with-canton]
  source CantonのMemo Tags [url: https://docs.canton.network/integrations/wallets-and-exchanges/memo-tags]
  source CantonのProof of Transfer [url: https://docs.canton.network/integrations/wallets-and-exchanges/proof-of-transfer]
  source CantonのUSDCx Support [url: https://docs.canton.network/integrations/wallets-and-exchanges/usdcx-support]
  source CantonのPOST /v2/updates/update-by-id [url: https://docs.canton.network/reference/json-api-reference/post-v2updatesupdate-by-id]
  source CantonのPOST /v2/events/events-by-contract-id [url: https://docs.canton.network/reference/json-api-reference/post-v2eventsevents-by-contract-id]
```

線は1本で、データ型の例の自前のAPIが、単純な問い合わせと実時間の問い合わせをLedger APIへ出す経路です。
複雑な問い合わせや分析にはPQSを使うので、その選び方は1つ目の頁で追います。
walletとexchangeの頁と、移転を証明しUSDCxを扱う頁は、部品でなく頁の分類なので、Ledger APIへの線を引きません。

## 出典

https://docs.canton.network/integrations/integration-patterns

https://docs.canton.network/integrations/overview

https://docs.canton.network/integrations/wallets-and-exchanges/canton-network-overview

https://docs.canton.network/integrations/wallets-and-exchanges/integrating-with-canton

https://docs.canton.network/integrations/wallets-and-exchanges/memo-tags

https://docs.canton.network/integrations/wallets-and-exchanges/proof-of-transfer

https://docs.canton.network/integrations/wallets-and-exchanges/usdcx-support

https://docs.canton.network/reference/json-api-reference/post-v2updatesupdate-by-id

https://docs.canton.network/reference/json-api-reference/post-v2eventsevents-by-contract-id
