|
| 1 | +Canton Coin Specific Considerations |
| 2 | +=================================== |
| 3 | + |
| 4 | +Handling Time-Bound Signatures (Canton Coin) |
| 5 | +-------------------------------------------- |
| 6 | + |
| 7 | +If your wallet infrastructure relies on offline signing, cold storage, or multi-party approval flows that take longer than **10–20 minutes**, then this guide is for you. |
| 8 | + |
| 9 | +The 10-Minute Signing Window |
| 10 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 11 | +Canton Coin transactions operate on a strict **10-minute minting cycle**. Unlike standard Daml transactions, |
| 12 | +**Canton Coin** transfers and acceptances must reference a specific |
| 13 | +`OpenMiningRound <https://docs.dev.sync.global/app_dev/api/splice-amulet/Splice-Round.html>`_ contract to |
| 14 | +calculate network fees and rewards. |
| 15 | + |
| 16 | +* A new ``OpenMiningRound`` is created every **10 minutes**. |
| 17 | +* The contract remains active for approximately **20 minutes** (the current round + overlap). |
| 18 | +* **The Problem:** If you prepare a transaction referencing *Round A*, but you do not sign and submit it before *Round A* expires, the network will reject it. |
| 19 | + |
| 20 | +**Common Error:** |
| 21 | +If your transaction exceeds this window, the API will return a ``409 Conflict`` with the following error: |
| 22 | + |
| 23 | +.. code-block:: text |
| 24 | +
|
| 25 | + LOCAL_VERDICT_INACTIVE_CONTRACTS |
| 26 | +
|
| 27 | +There is one way of handle incoming transfers and another way to handle outgoing transfers, listed below. |
| 28 | + |
| 29 | +Solution 1: Implement Pre-approvals for Incoming Transfers / Receiving Funds |
| 30 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | + |
| 32 | +**Use Case:** Your users need to receive Canton Coin, but you cannot sign a transaction within 10 minutes |
| 33 | +(e.g., due to cold storage of the receiver's keys). |
| 34 | + |
| 35 | +**The Fix:** Enable **1-Step Transfers** using `Pre-approvals <https://docs.digitalasset.com/integrate/devnet/token-standard/index.html#step-transfer-vs-1-step-transfer>`_. |
| 36 | + |
| 37 | +Instead of signing every incoming transfer, the receiver signs a single, long-living ``TransferPreapproval`` |
| 38 | +contract. This authorizes the sending party (or a specific provider) to deposit funds immediately without |
| 39 | +requiring an interactive acceptance signature for every transaction. |
| 40 | + |
| 41 | +To do this, create a `Splice.Wallet.TransferPreapproval` contract. The guide on how to create the pre-approval |
| 42 | +contract in the `Wallet SDK is here <https://docs.digitalasset.com/integrate/devnet/token-standard/index.html#step-transfer-vs-1-step-transfer>`_ |
| 43 | +and the general information about `Canton Coin Preapprovals is here <https://docs.dev.sync.global/background/preapprovals.html>`_. |
| 44 | +By implementing a preapproval contract the receiver doesn't need to accept Canton Coin transfers sent to |
| 45 | +them as they are automatically accepted. |
| 46 | + |
| 47 | +Solution 2: Use Command Delegation for Outgoing Transfers / Sending Funds |
| 48 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 49 | + |
| 50 | +**Use Case:** Your users need to send Canton Coin, but the signing process (e.g., institutional custody approval) takes hours. |
| 51 | + |
| 52 | +**The Fix:** Use **Command Delegation** - `TransferCommand <https://docs.dev.sync.global/app_dev/api/splice-amulet/Splice-ExternalPartyAmuletRules.html>`_. |
| 53 | + |
| 54 | +Instead of signing the transfer transaction directly (which pins a short-lived Mining Round), the user signs a long-living instruction to transfer funds. |
| 55 | + |
| 56 | +How it works |
| 57 | +"""""""""""" |
| 58 | + |
| 59 | +1. **User Signs Instruction:** The user signs a transaction to create a ``Splice.ExternalPartyAmuletRules.TransferCommand`` contract. |
| 60 | + |
| 61 | + * This contract **does not** reference a mining round. |
| 62 | + * It can remain valid for up to 24 hours (or as defined by ``expiresAt``). |
| 63 | + |
| 64 | +2. **Delegated Execution:** Once this command is on the ledger, a Super Validator (SV) or a delegate picks it up. |
| 65 | + |
| 66 | +3. **Execution:** The delegate executes the actual transfer. The *delegate* selects the current ``OpenMiningRound`` at the moment of execution, ensuring the transaction succeeds regardless of how long ago the user signed the instruction. |
0 commit comments