Batch payment infrastructure for Canton Network — UTXO-optimized batch transfers, MCP tooling for AI agents, and Canton Coin reward integration.
Spraay Canton brings Spraay Protocol's multi-chain batch payment orchestration to Canton Network, the privacy-enabled blockchain for regulated assets.
Canton uses a UTXO model for token holdings (CIP-0056 Token Standard). Spraay Canton provides:
- Batch transfers — Send to N recipients in an optimized sequence of
TransferFactory_Transfercommands - UTXO management — Small-first selection strategy, dust consolidation, and merge delegation
- MCP tools — 5 tools for AI agent frameworks (LangChain, AutoGPT, CrewAI) to execute batch payments
- CC rewards — Automatic
FeaturedAppActivityMarkercreation for Canton Coin minting rewards - REST API — Express server compatible with the Spraay gateway pattern
┌─────────────────────────────────────────────────────┐
│ AI Agents / Clients │
│ (MCP tools | REST API | Gateway) │
└──────────────┬────────────────────┬──────────────────┘
│ │
┌───────▼───────┐ ┌──────▼──────┐
│ MCP Server │ │ Express API │
│ (5 tools) │ │ /api/v1/* │
└───────┬───────┘ └──────┬──────┘
│ │
┌─────▼────────────────────▼─────┐
│ Batch Orchestrator │
│ • UTXO selection (small-first) │
│ • Transfer construction │
│ • Activity marker creation │
└─────────────┬──────────────────┘
│
┌────────▼────────┐
│ Canton Ledger │
│ Client │
│ (JSON API) │
└────────┬────────┘
│ HTTP/JSON
┌────────▼────────┐
│ Canton Node │
│ (Participant) │
│ port 7575 │
└─────────────────┘
The daml/Spraay/BatchPayment.daml module defines:
| Contract | Purpose |
|---|---|
SpraayServiceConfig |
Operator settings (fee rate, max batch size) |
BatchPaymentRequest |
Submitted by sender, accepted by operator |
BatchPaymentExecution |
Active during batch processing |
BatchPaymentReceipt |
Immutable completion record (queryable via PQS) |
SpraayActivityMarker |
Drives Canton Coin reward minting |
- Node.js 18.20+
- DPM (
curl -sSL https://get.digitalasset.com/install/install.sh | sh -s) - Canton sandbox (included with DPM)
# Clone
git clone https://github.com/plagtech/spraay-canton.git
cd spraay-canton
# Install
npm install
# Build Daml model
dpm build
# Copy env
cp env.example .env
# Start Canton sandbox (background)
npm run sandbox &
# Generate TypeScript types from OpenAPI
npm run generate:api
# Start Spraay Canton
npm run dev# 1. Allocate test parties
curl -X POST http://localhost:3100/api/v1/parties \
-H "Content-Type: application/json" \
-d '{"hint": "Alice"}'
# → {"party": "Alice::1220abc...", "isLocal": true}
curl -X POST http://localhost:3100/api/v1/parties \
-H "Content-Type: application/json" \
-d '{"hint": "Bob"}'
curl -X POST http://localhost:3100/api/v1/parties \
-H "Content-Type: application/json" \
-d '{"hint": "Carol"}'
# 2. Submit batch payment
curl -X POST http://localhost:3100/api/v1/batch \
-H "Content-Type: application/json" \
-d '{
"senderPartyId": "Alice::1220abc...",
"recipients": [
{"partyId": "Bob::1220def...", "amount": 10.0, "memo": "Payment 1"},
{"partyId": "Carol::1220ghi...", "amount": 5.0, "memo": "Payment 2"}
],
"instrument": "CantonCoin"
}'
# 3. Check holdings
curl http://localhost:3100/api/v1/holdings/Alice::1220abc...{
"name": "spraay-canton",
"version": "0.1.0",
"tools": [
"canton_batch_payment",
"canton_query_holdings",
"canton_batch_status",
"canton_allocate_party",
"canton_health"
]
}{
"mcpServers": {
"spraay-canton": {
"command": "npx",
"args": ["ts-node", "src/mcp/server.ts"],
"env": {
"CANTON_LEDGER_API_URL": "http://localhost:7575",
"SPRAAY_OPERATOR_PARTY_ID": "your-operator-party-id"
}
}
}
}Spraay Canton interacts with Canton's Token Standard interfaces:
- Holding (
splice-api-token-holding-v1) — UTXO queries and balance checks - TransferFactory (
splice-api-token-transfer-instruction-v1) — Transfer execution - TransferInstruction — Transfer acceptance and tracking
When deployed as a featured app on Canton Network, each successful batch generates a FeaturedAppActivityMarker that SV automation converts into AppRewardCoupon contracts for Canton Coin minting.
Self-featuring is available on DevNet for testing the reward flow.
- LocalNet —
dpm sandboxfor development - DevNet — Self-featured, test reward flow
- TestNet — GSF approval required
- MainNet — Production deployment
spraay-canton/
├── daml/
│ └── Spraay/
│ └── BatchPayment.daml # On-ledger contracts
├── src/
│ ├── api/
│ │ └── server.ts # Express REST API
│ ├── batch/
│ │ ├── orchestrator.ts # Batch execution engine
│ │ └── utxo-selection.ts # UTXO selection strategy
│ ├── canton/
│ │ └── ledger-client.ts # JSON Ledger API client
│ ├── mcp/
│ │ └── server.ts # MCP tool server
│ ├── utils/
│ │ └── logger.ts
│ ├── config.ts # Environment configuration
│ └── index.ts # Main entry point
├── daml.yaml # Daml project config
├── package.json
├── tsconfig.json
└── env.example
- Spraay Gateway — Main x402 gateway
- Canton Docs — Canton Network documentation
- CIP-0056 — Token Standard
- Canton Dev Fund — Grant proposals
0BSD — same as the Canton Quickstart.