Commit 09445be
authored
docs(ledgers): add Transaction deduplication section (#172)
## 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
- Surfaced while writing the ckBTC CLI walkthrough in PR #171
- Opened
[dfinity/icskills#178](dfinity/icskills#178)
to track updating the ckBTC skill's CLI examples
## 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.1 parent 28bacc8 commit 09445be
2 files changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
176 | 192 | | |
177 | 193 | | |
178 | 194 | | |
| |||
0 commit comments