Transaction cost visibility
This page reads a pre-submission traffic-cost estimate live from a Canton validator and renders it with PartyLayer's cost hook and CostPreview. The numbers are the validator's raw int64 traffic units.
Pre-submission estimate
LiveRecomputed on every visit, so this value moves. That movement is how you can tell it reads the validator live, not a fixed number. Press Re-estimate to read it again.
Actual paid cost
CapturedThe realized cost reads paid_traffic_cost from a completed transaction's completion. This value is the real cost captured from one controlled, successful execute against our DevNet validator: a self-signatory ValidatorRight create with no value transfer. In that one execute the estimate was 2612 and the actual paid came in at 2577, a little under the estimate, as expected. The page shows this fixed snapshot instead of running an execute for every visitor.
- Actual paid
- 2577
Captured snapshot, one DevNet execute.
Integrating cost visibility
PartyLayer does not own ledger transport. Your dApp supplies a cost-fetcher that calls your validator's /v2/interactive-submission/prepare, typically through your own backend, and PartyLayer provides the types, the TanStack Query wrapper, and the UI:
// 1. Your fetcher returns a CostEstimation (int64 as strings)
const estimate = (signal) => fetchCostEstimate(signal);
// 2. Wrap it in the hook
const { costEstimate, isPending, error } =
useTransactionCostEstimate({ estimate });
// 3. Render it
<CostPreview estimate={costEstimate} loading={isPending} error={error} />Cost values are int64 and can exceed Number.MAX_SAFE_INTEGER, so PartyLayer carries them as strings (TrafficCost) end to end. Use trafficCostToBigInt for arithmetic. Set LEDGER_API_URL (plus LEDGER_PARTY, LEDGER_SYNCHRONIZER_ID, LEDGER_DSO_PARTY) to read from a live validator. When unset, the proxy serves a real captured DevNet estimate.