You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ERCS/erc-7573.md
+72-23Lines changed: 72 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,11 @@ One smart contract implements the `ILockingContract` interface on one chain (e.g
24
24
The smart contract implementing `ILockingContract` locks a token (e.g., the asset) on its chain until a key is presented to encrypt to one of two given values.
25
25
The smart contract implementing `IDecryptionContract`, decrypts one of two keys (via the decryption oracle) conditional to the success or failure of the token transfer (e.g., the payment). A stateless decryption oracle is attached to the chain running `IDecryptionContract` for the decryption.
26
26
27
+
In addtion there are to interface that standardize the communication with external decryption oracle(s).
28
+
29
+
The interface`IDecryptionOracle.sol` is implemented by a decryption oracle proxy contract.
30
+
The interface `IDecryptionOracleCallback.sol` has to be implemented by a callback receiving the decrypted key.
31
+
27
32
## Motivation
28
33
29
34
Within the domain of financial transactions and distributed ledger technology (DLT), the Hash-Linked Contract (HLC) concept has been recognized as valuable and has been thoroughly investigated.
function inceptTransfer(uint256 id, int amount, address from, string memory keyEncryptedSuccess, string memory keyEncryptedFailure) external;
121
+
function inceptTransfer(uint256 id, int amount, address from, bytes memory keyEncryptedSuccess, bytes memory keyEncryptedFailure) external;
117
122
```
118
123
119
124
Called from the receiver of the amount to initiate payment transfer. Emits a `TransferIncepted`.
@@ -124,7 +129,7 @@ The parameter `keyEncryptedFailure` is an encryption of a key and will be decryp
124
129
##### Transfer: `transferAndDecrypt`
125
130
126
131
```solidity
127
-
function transferAndDecrypt(uint256 id, int amount, address to, string memory keyEncryptedSuccess, string memory keyEncryptedFailure) external;
132
+
function transferAndDecrypt(uint256 id, int amount, address to, bytes memory keyEncryptedSuccess, bytes memory keyEncryptedFailure) external;
128
133
```
129
134
130
135
Called from the sender of the amount to initiate completion of the payment transfer. Emits a `TransferKeyRequested` with keys depending on completion success.
@@ -138,7 +143,7 @@ do not match a previous call to `inceptTransfer`.
function releaseKey(uint256 id, bytes memory key) external;
176
181
}
177
182
```
178
183
@@ -255,6 +260,50 @@ A corresponding XML sample is shown below.
255
260
</releaseKey>
256
261
```
257
262
263
+
### Multi-Party Delivery versus Payment
264
+
265
+
#### Locking is a Feature
266
+
267
+
In Delivery-versus-Payment (DvP) protocols like [ERC-7573](../EIPS/eip-7573.html), at least one token must be locked to ensure atomicity, even if only for a short period during the transaction.
268
+
269
+
While locking may appear as an inconvenient necessity, it is in fact a feature that becomes valuable in the construction of conditional trades or multi-party DvPs.
270
+
271
+
If *n* parties wish to perform bilateral transactions atomically, there are *at least**m := 2 • (n - 1)* transactions, of which *m-1* require locking. The last one can operate directly, and its success or failure decides whether the other locks are released or reverted.
272
+
273
+
A multi-party delivery versus payment is a valuable trade feature. Consider, for example, the case where counterparty A wishes to buy a token *Y* (e.g., a bond) from counterparty C, but in order to fund this transaction, counterparty A wishes to sell a token *X* (e.g., another bond) to counterparty B. However, A does not want to sell bond *X* if the purchase of *Y* fails. A multi-party DvP allows these two transactions to be bound into a single atomic unit.
274
+
275
+
While for a two-party DvP with two tokens only one token requires locking—and hence a DvP can be constructed without locking on the cash chain—a three-party DvP with three tokens in general requires the ability to lock all three tokens.
276
+
277
+
This highlights that locking is not just a constraint, but a required feature to enable advanced and economically meaningful protocols.
278
+
279
+
#### N-DvP with [ERC-7573](../EIPS/eip-7573.html)
280
+
281
+
A multi-party DvP can be created elegantly by combining multiple (*n-1*) two-party DvPs, for example based on the [ERC-7573](../EIPS/eip-7573.html) protocol.
282
+
283
+
The procedure is simple: instead of finalizing the respective two-party DvP by a call to `transferAndDecrypt`, the two-party DvP is first confirmed with a call to `confirm`, leaving the finalization open.
284
+
285
+
At any time, any party can call `cancelAndDecrypt` to release the failure key and revert all lockings.
286
+
287
+
Once all parties are linked with their respective two-party DvPs, a single call to `transferAndDecrypt` performs locking of the token implementing the `IDecryptionContract` and releases either the success key on success or the failure key on failure.
288
+
289
+
##### Initiation and Finalization
290
+
291
+
The counterparty that initiates the multi-party DvP by making the first call
292
+
to the `IDecryptionContract` is the one that is allowed to finalize it via `transferAndDecrypt`, the other may cancel via `cancelAndDecrypt`.
293
+
294
+
##### Sequence Diagram
295
+
296
+
Below we depict the corresponding sequence diagram of a multi-party DvP via [ERC-7573](../EIPS/eip-7573.html).
297
+
Note that the individual DvP may come in two different flavors depending on which counterparty is the receiver of the token on the `IDecryptionContract`.
298
+
299
+
The diagram depicts a multi-party dvp with n+1 counterparties trading n+1 tokens out of which
300
+
the DvPs are bound by the contract on token 0.
301
+
302
+

303
+
304
+
*Note: The more general case of N counterparties trading
305
+
M tokens is just a special case where we enumerate all combination as new counterparties and new tokens.*
306
+
258
307
## Security Considerations
259
308
260
309
The decryption oracle does not need to be a single trusted entity. Instead, a threshold decryption scheme can be employed, where multiple oracles perform partial decryption, requiring a quorum of them to reconstruct the secret key. This enhances security by mitigating the risk associated with a single point of failure or trust.
0 commit comments