Intent Anchoring
Optional support for publishing settlement intent hashes to a distributed ledger for public auditability and dispute protection.
!!! note "Scope: Settlement Intent Only" This page covers intent anchoring — recording the hash of a settlement intent before payment. For anchoring the policy document itself (on-chain policy audit trails and XRPL NFT-backed revocation), see Policy Anchoring.
Purpose
When an intent hash is anchored:
- Dispute resolution — A verifier can fetch the anchor and confirm the intent was published before settlement
- Auditability — Third parties can verify intent was committed without seeing payment details
- Replay protection — Anchoring timestamps the intent; disputes can establish ordering
Supported Rails
| Rail | Description |
|---|---|
| mock | Stub for development/testing; no real ledger |
| hedera-hcs | Hedera Hashgraph Consensus Service; publishes to a topic |
Additional rails can be supported by implementations (XRPL memos, Ethereum calldata, etc.).
Flow
- Compute
intentHash = computeSettlementIntentHash(settlementIntent) - Publish the intentHash to the chosen rail (e.g., Hedera HCS topic)
- Store the
AnchorResult(reference, consensusTimestamp, etc.) with the settlement - In dispute: verifier fetches anchor, confirms intentHash matches
Usage
import { anchorIntent, computeSettlementIntentHash } from "mpcp-service";
const intentHash = computeSettlementIntentHash(settlementIntent);
// Mock (development)
const anchor = await anchorIntent(intentHash, { rail: "mock" });
// Hedera HCS (requires HEDERA_OPERATOR_ACCOUNT_ID, etc.)
const anchor = await anchorIntent(intentHash, { rail: "hedera-hcs" });
Hedera HCS
Requires environment variables:
HEDERA_OPERATOR_ACCOUNT_IDHEDERA_OPERATOR_PRIVATE_KEYHEDERA_TOPIC_IDHEDERA_NETWORK(optional; default: testnet)
Verification uses the Hedera mirror node to fetch the message and confirm intentHash matches.