Skip to content

docs(ledgers): add Transaction deduplication section#172

Merged
marc0olo merged 1 commit into
mainfrom
docs/ledger-tx-deduplication
Apr 29, 2026
Merged

docs(ledgers): add Transaction deduplication section#172
marc0olo merged 1 commit into
mainfrom
docs/ledger-tx-deduplication

Conversation

@marc0olo
Copy link
Copy Markdown
Member

Summary

Adds a dedicated ### Transaction deduplication section to docs/guides/digital-assets/ledgers.mdx, immediately after ### Fee handling.

Previously, deduplication was a single sentence at the end of ### Fee handling: "Always set created_at_time to enable deduplication. Without it, two identical transfers submitted within 24 hours both execute." Fee handling and deduplication are separate concerns, and a developer scanning the page for deduplication guidance would not find it there.

The new section covers:

  • What it does: the ledger tracks (args, created_at_time) pairs and rejects exact duplicates within 24 hours with Duplicate { duplicate_of: block_index }. The duplicate_of field lets you confirm the original succeeded without re-submitting.
  • How to enable it: references the existing sendTokens (Motoko: Nat64.fromNat(Int.abs(Time.now()))) and send_tokens (Rust: ic_cdk::api::time()) examples already on the page — no redundant code tabs needed.
  • Boundary errors: TooOld (timestamp older than 24h, window no longer tracked) and CreatedInFuture { ledger_time } (timestamp ahead of ledger time, ledger_time field helps diagnose clock drift).
  • When null is acceptable: one-off manual CLI calls where double-submission is not a concern.

Also updates the bitcoin.mdx CLI note to link to #transaction-deduplication instead of the broader #transferring-assets-icrc-1 anchor.

Related

Sync recommendation

Hand-written. Content is derived from the ICRC-1 specification (created_at_time deduplication semantics) and verified against the existing Motoko/Rust examples in this file.

Extracted the single-sentence deduplication note from ### Fee handling
into a dedicated ### Transaction deduplication section. Covers what the
ledger tracks, how to enable it (Motoko and Rust), the Duplicate response
and its duplicate_of field, and the TooOld / CreatedInFuture boundary
errors. References the existing code examples above rather than adding
redundant tabs.

Updated the bitcoin.mdx CLI note to link to #transaction-deduplication
instead of the broader #transferring-assets-icrc-1 anchor.
@marc0olo marc0olo merged commit 09445be into main Apr 29, 2026
1 check passed
@marc0olo marc0olo deleted the docs/ledger-tx-deduplication branch April 29, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant