summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-04-25 22:40:31 +0200
committerChristian Grothoff <christian@grothoff.org>2021-04-25 22:40:31 +0200
commit2dba865399ab0934f66cfef8046bffb70cce241f (patch)
tree578a58fe64fc853d238b2edb41bf8bf6f1063c9d
parent657d74a87b5e93df4f518eccf6a9c27a5ba75138 (diff)
downloaddocs-2dba865399ab0934f66cfef8046bffb70cce241f.tar.gz
docs-2dba865399ab0934f66cfef8046bffb70cce241f.tar.bz2
docs-2dba865399ab0934f66cfef8046bffb70cce241f.zip
big DD13 update
-rw-r--r--design-documents/013-peer-to-peer-payments.rst516
1 files changed, 306 insertions, 210 deletions
diff --git a/design-documents/013-peer-to-peer-payments.rst b/design-documents/013-peer-to-peer-payments.rst
index 35b8126..c96fd46 100644
--- a/design-documents/013-peer-to-peer-payments.rst
+++ b/design-documents/013-peer-to-peer-payments.rst
@@ -1,11 +1,11 @@
-Design Doc 013: Customer-to-Customer Payments
-#############################################
+Design Doc 013: Wallet-to-Wallet Payments
+#########################################
Summary
=======
This design document proposes an extension of the Taler protocol that allows
-payments from customer-to-customer without a merchant.
+payments from wallet-to-wallet without a merchant.
Motivation
==========
@@ -23,19 +23,25 @@ Requirements
* The protocol must permit transacting arbitrary amounts in any currency,
as long as both parties trust the exchange involved.
-* The control data for customer-to-customer payments should be small
+* The control data for wallet-to-wallet payments should be small
enough to fit into a QR code or short message (so ideally less than 64 bytes).
* No other direct communication channel between payer and payee should
be required.
-* The customer-to-customer payment must be possible without trusting the other
+* The wallet-to-wallet payment must be possible without trusting the other
party beyond the point where the money has been received by the payee. Thus,
sharing of coin private keys is not sufficient, we need transactional semantics
resulting in exclusive control over the funds by the recipient.
-* The customer-to-customer payment protocol must not allow users to circumvent income
- transparency. That is, each customer-to-customer transaction must be visible
+* The wallet-to-wallet payment protocol must not allow users to circumvent income
+ transparency. That is, each wallet-to-wallet transaction must be visible
on a KYCed transaction ledger (such as a bank account).
-* The money received via a customer-to-customer payment must be usable for
+* The money received via a wallet-to-wallet payment must be usable for
further Taler payments with minimal delay (after KYC).
+* It must still be possible to associate payments with a contract that is
+ effectively (alas not necessarily directly) signed by both parties:
+ the payer with the coin private keys, and the payee with their KYC'ed
+ account private key.
+* The contract must be able to satisfy laws like the German TSE law,
+ which implies that the payer must be able to obtain a payment receipt.
* Two payment scenarios must be possible: (1) one where the payee first
transmits a proposal to the payer (request-to-pay) that the payer
accepts by making the payment, and (2) completely uni-directional
@@ -50,7 +56,8 @@ Requirements
payer.
* If a payment would partially succeed, i.e. because the payer inadvertedly
used some double-spent coins and some valid coins, this must fail before the
- uni-directional communication and be correctable payer-side.
+ uni-directional communication and be correctable payer-side. In other words,
+ the actual payment must be atomic.
* The usual properties of Taler (everything auditable, unlinkability,
high-performance in terms of CPU, bandwidth, latency, storage
requirements, and the ability to levy fees on every operation that
@@ -68,22 +75,98 @@ New Terminology
receiving income under that address.
* A ``purse`` is a public-private key pair where the public key is
an exchange address from which any owners of an account
- can pick up an amount left at a ``purse`` assuming they know the purse
- private key.
+ can ``merge`` the amount left at a ``purse`` into their
+ account balance assuming they know the purse private key.
* A ``wad`` is an exchange-to-exchange wire transfer that wires money
into a group of accounts at the target exchange.
-* FIXME: below we now have **pouch** and **purse**. Same? Different? Confusing!
Proposed Solution
=================
-A complete solution for customer-to-customer payments consists of three
-possible operational flows.
+Principles
+----------
+
+* Purses are ephemeral and only serve for one transaction.
+* Each purse is associated with a contract and an expiration date.
+* The contract is stored encrypted at the exchange.
+ The contract must be encrypted to the purse private key.
+ An additional ephemeral public key (for DH encryption) should be
+ part of the POSTed payload.
+* The exchange deletes the encrypted contract at this expiration date.
+* The exchange may limit the encrypted contract size and storage duration.
+* Either payer or payee can create the purse and associate it with the contract.
+* By merging the purse into the account, the payee accepts the contract.
+* By paying the purse to the designated amount, the payer accepts the contract.
+* Until the purse is fully paid, the payer can abort the payment.
+* The exchange may charge a **purse fee** for managing the purse, but we
+ want most scenarios to not require it to be effectively charged.
+* By associating a purse with an account upon creation, the purse fee can be
+ made optional for account holders as long as the number of purses created
+ per account is below a configurable threshold.
+* By charging the purse fee only in case the payee did **not** merge the
+ purse into their account, the purse fee can be limited for payers to
+ the case where they are receiving a refund --- and here it could be
+ then entirely avoided if the refund fee is non-zero.
+
+
+W2W Payment Metadata
+--------------------
+
+The standard Taler Customer-to-Merchant payments always use a contract terms
+JSON object to record the modalities of the payment and the resulting
+obligations of a successful payment.
+
+The contract terms concept does not directly carry over to W2W payments,
+because:
+
+* Either party may initiate the payment.
+* The payee does not have a merchant public key, and
+ at the time of payment initiation, the payee account might not yet
+ be known.
+* There is no nonce that the customer generates and uses to prove that they
+ uniquely "own" the contract terms.
+* There is no negotiation of trusted auditors / exchanges possible.
+
+As a result, some of the existing fields of the contract terms no longer apply
+to wallet-to-wallet payments.
+
+Contract metadata for W2W payments can be exchanged in three ways:
+
+1. Inline, as part of the payment request / payment offer. In this case,
+ both parties are already aware of the contract's contents and
+ the exchange's contract exchange facility is simply not used.
+2. The payee can create a **purse** and immediately associate it with
+ an **account** by sending a signed **merge** request together with
+ the (encrypted) contract.
+ a. The purse creation request created by the payee must include a
+ signature with the account private key of the payee signing the purse
+ public key and the hash of the contract, thereby affirming that
+ the contract was pre-approved by the account owner.
+ b. The exchange may wave the purse fee for a certain number of
+ active purses per account. Additional purses can be purchased
+ by paying the **purse fee**.
+3. The payer can store a contract with the exchange by POSTing
+ an encrypted contract to the exchange as part of creating a **purse**.
+ a. The exchange charges the **purse fee** to payers for purses that
+ are refunded after not being **merged**.
+ b. When paying into a purse, the coin signature includes the purse
+ public key, the contract hash and the desired expiration date
+ (how long a merge is allowed).
+ c. Payment offers are not allowed if the amount transacted is below
+ the purse fee.
+ d. The exchange auto-refunds coins in **purses** with deposits
+ matching expired contracts.
+
+ .. note::
+ While the **refund fee** amount can be reused, these types of refunds
+ are not approved by a merchant's signature. Thus, we will need
+ a new message type in the coin history to represent these events.
-Account creation and withdrawal
--------------------------------
+
+Account creation
+----------------
1. The payee generates an account key, which also yields a
``payto://taler/$EXCHANGE_BASE_URL/$ACCOUNT_PUB``
@@ -94,13 +177,13 @@ Account creation and withdrawal
is redirected to a Web page where they can perform the necessary
KYC operation.
3. For this, the exchange wire gateway is extended with a request to
- check the KYC status of a customer based on an ACCOUNT_PUB.
- Possible replies are in-progress and succeeded. An in-progress
+ check the KYC status of a customer based on an ``ACCOUNT_PUB``.
+ Possible replies are ``in-progress`` and ``succeeded``. An ``in-progress``
status should be accompanied with
information how the customer may complete the KYC check.
4. A new exchange endpoint ``/account/$ACCOUNT_PUB/kyc``
allows wallets to request a KYC for an
- ACCOUNT_PUB. Such a request may include the requirement to pay
+ ``$ACCOUNT_PUB``. Such a request may include the requirement to pay
a **KYC fee**. The KYC fee may be charged to that account (if it exists),
or could be waved if the account was established via a wire transfer
from a partner bank.
@@ -108,23 +191,28 @@ Account creation and withdrawal
in an account remain inaccessible. After a configurable duration,
the funds may be considered forfeit and become the property of
the exchange where the account is located.
-6. When requesting an account's history (which can get quite long),
+
+
+Withdrawing from accounts
+-------------------------
+
+1. When requesting an account's history (which can get quite long),
the exchange only returns the last 3 months of data. Requesting
the full history requires paying an **account history fee**
(which is not done via a 402, but simply charged to the account
when requested; full account histories for accounts with an
insufficient balance cannot be requested -- except of course
the wallet could simply top up the account balance first, see below).
-7. If the exchange has received a **deposit** or **merge** into an
- account, or received an inbound wire transfer from a **wad**
- matching the account (see below), it adds the respective amount(s)
- to the account's balance, allowing the KYC'ed customer to withdraw
- the funds.
-8. The account history endpoint should also allow long-polling.
+2. If the exchange has **merged** a **purse** into an account, or
+ received an inbound wire transfer from a **wad** matching the
+ account (see below), it adds the respective amount(s) to the
+ account's balance, allowing the KYC'ed customer to withdraw the funds,
+ similar to withdrawals from a reserve.
+3. The account history endpoint should also allow long-polling.
Note that long-polling should be limited to short durations,
as inbound transfers via ``taler-exchange-wirewatch`` cannot cause the long
polling to be resumed, only transfers within the same exchange can benefit
- from long polling acceleration.
+ from long-polling acceleration.
Account deletion
@@ -140,139 +228,120 @@ Account deletion
they still contain funds.
4. A related endpoint should exist for the exchange operator, possibly
using messages signed with the exchange offline key. This could be
- useful in case customers died or are otherwise in need for manual
+ useful in case customers die or are otherwise in need for manual
intervention that requires an account to be deleted. In this case,
remaining funds in the account should be wired to a bank account
designated in the message with the offline signature. The audit
report should contain a special note for all of these account deletions.
-C2C Payment Metadata
---------------------
-The standard Taler Customer-to-Merchant payments always use a contract terms
-JSON object to record the modalities of the payment and the resulting
-obligations of a successful payment.
+Payment offers
+--------------
-The contract terms concept does not directly carry over to C2C payments,
-because:
-
-* Either party may initiate the payment.
-* The payee does not have a merchant public key, and
- at the time of payment initiation, the payee account might not yet
- be known.
-* There is no nonce that the customer generates and uses to prove that they
- uniquely "own" the contract terms.
-* There is no negotiation of trusted auditors / exchanges possible.
-
-Metadata for C2C payments can be exchanged in two ways:
+In this protocol variant, the payer is initiating the process.
-1. Inline, as part of the payment request / payment offer. In this case,
- both parties are already aware of the contract's contents and
- the exchange's contract exchange facility is simply not used.
-2. The payer can store a contract with the exchange by POSTing
- an encrypted contract to the exchange at ``/contracts``.
- a. The contract must be encrypted to a purse or account private key.
- The corresponding public key(s) should be part of the encrypted
- payload.
- b. The exchange may charge a **contract fee** for
- storing the contract. Note that a purse may theoretically receive
- multiple inbound payments, so the contract storage facility is
- provided independently of a purse or account.
- c. The fee for contract storage is taken from coins attached to the
- contract storage request, independent of whether payer or
- payee is making a request for contract storage. The coin signature
- includes the contract hash and the desired expiration date.
- d. The exchange may limit the contract size and storage duration.
- e. Encrypted contracts created by the payee must include a signature
- with the account private key of the payee, thereby affirming that
- the contract was pre-approved by the account owner.
- f. The uploaded information must include an expiration date for
- the offer, after which the associated transaction expires if
- it has not concluded.
- g. The exchange deletes encrypted contract at this expiration
- date, and auto-refunds coins in **purses** with deposits
- matching expired contracts.
-
- .. note::
-
- While the **refund fee** amount can be reused, these types of refunds
- are not approved by a merchant's signature. Thus, we will need
- a new message type in the coin history to represent these events.
-
-
-Payment into an unknown account
--------------------------------
-
-1. If the payer does not know the payee's account, they can create
- a **purse** by computing a public-private key pair.
-2. The payer then uses the ``/depost`` API to deposit coins into
- the purse, using ``payto://taler/$PURSE_PUB`` as the target
- address. Note that the lack of a hostname indicates that the
- target address is a purse.
+1. The payer creates a **purse** by computing a public-private key pair.
+2. The payer POSTs to the ``/purse/$PURSE_PUB/depost`` endpoint to
+ both upload the encrypted contract and deposit coins into the purse.
+ The deposit signatures should use ``payto://taler/$PURSE_PUB``
+ as the target address and signing over the ``$CONTRACT_HASH`` as
+ usual in deposit operations. Note that the lack of a hostname
+ indicates that the target address is a local purse.
3. The payer shares the purse's private key and the base URL
of the exchange where the purse was created with the payee.
- This can be done using a ``taler://purse/BASE_URL/$PURSE_PRIV`` URL.
+ This can be done using a ``taler://purse/$BASE_URL/$PURSE_PRIV`` URL.
4. The payee uses the new ``/purse/$PURSE_PUB`` endpoint to retrieve
- the purse history, which includes all deposits and withdrawals
- involving the purse.
-5. *Optional*: Deposits with a non-zero contract hash
- have an underlying contract, which the payee fetches using
- a new ``/contracts/$CONTRACT_HASH`` endpoint and then
- decrypts (if they do not have the contract already). The
- contract terms are shown to the user to have the user agree
- to the contract before proceeding with the next step.
+ the encrypted contract and purse balance, which includes all
+ (coin) deposits and **merges** involving the purse.
+5. Deposits with a non-zero contract hash have an underlying contract.
+ The contract terms are shown to the payee to have them agree
+ to the contract before proceeding with the **merge** step.
6. The payee can then POST to ``/purse/$PURSE_PUB/merge`` a
request signed by the purse's private key to **merge** the
- funds into an account. The signature is over a salted
- hash of the account public key and the list of deposit
- identifiers of deposits to be merged. This avoids disclosure of
- the account public key in the purse history.
-7. The exchange processes the merge request akin to the logic for payments
- into known accounts, as detailed below, except that no
- **deposit fees** are charged at this time. The exchange
- confirms the merge, allowing the payee to instantly affirm
- to the user that the amount is inbound (even if it may not
- be instantly available if the user did not complete the
+ funds into an account. A second signature must be provided
+ by the account private key, signing the ``$CONTRACT_HASH`` thereby
+ affirming that the payee accepted the contract.
+ The account is of the form ``payto://taler/$EXCHANGE_BASE_URL/$ACCOUNT_PUB``.
+7. Processing continues depending on the location of the account:
+ a. If the ``$EXCHANGE_BASE_URL`` matches the local exchange, then
+ the exchange processes the **merge** request akin to the logic
+ for payments into known accounts, as detailed above.
+ b. If the ``$EXCHANGE_BASE_URL`` does not match the local exchange,
+ a **wad fee** is charged, and the remaining amount are placed into a **wad**
+ to inform the target exchange, as detailed below. Wad fees may be covered
+ by the merchant, just like deposit fees, depending on the contract.
+8. The exchange confirms the merge (per response to the **merge** request).
+ This allows the payee software to instantly
+ affirm to the users that the transaction is final (even if it may not
+ be instantly available to the payee if the payee did not complete the
KYC process for the account).
+9. The payer uses the GET ``/purse/$PURSE_PUB`` endpoint
+ to obtain the receipt from the payee (in the form of the
+ **merge** signature). Query parameters are used to avoid
+ downloading the (already known) encrypted contract and the
+ deposit operations. Long-polling must also be possible for
+ this request.
+
+
+
+Payment requests
+----------------
+1. The payee creates a **purse** by computing a public-private key pair.
+2. The payee POSTs to the ``/purse/$PURSE_PUB/merge`` endpoint to
+ both upload the encrypted contract, associate it with the payer's
+ account and signal its agreement to the contract. The
+ **merge** request must be signed by the purse's private key.
+ A second signature must be provided by the account private key,
+ signing the ``$CONTRACT_HASH`` thereby affirming that the payee
+ accepted the contract.
+3. The payee provides the ``$PURSE_PRIV`` to the payer.
+4. The payer computes the corresponding public key and uses the
+ new ``/purse/$PURSE_PUB`` endpoint to retrieve
+ the encrypted contract and the merge request, which signifies that
+ the payee would agree to the contract.
+5. The payer software decrypts the encrypted contract using the purse private
+ key and the payer accepts the contract in the user interface.
+6. Processing continues depending on the source of the coins:
+ a. If the payer's coins originate from the same exchange, the
+ payer software POSTs to the ``/purse/$PURSE_PUB/depost`` endpoint to
+ deposit coins into the purse. The deposit signatures should use
+ ``payto://taler/$PURSE_PUB``
+ as the target address and signing over the ``$CONTRACT_HASH`` as
+ usual in deposit operations. Note that the lack of a hostname
+ indicates that the target address is a local purse.
+ b. If the payer's coins originate from another exchange, the
+ payer software deposits the coins at the originating exchange
+ using the traditional ``/deposit`` endpoint and a target account of the form
+ ``payto://taler/$EXCHANGE_BASE_URL/$ACCOUNT_PUB``. In this case,
+ the remote exchange charges a **wad fee** and places the remaining
+ amount into a **wad** to inform the target exchange, as detailed below.
+7. The exchange confirms the deposit. This allows the payer software to instantly
+ affirm to the users that the transaction is final, or to abort or try again
+ in case of errors.
+8. The payee uses the GET ``/purse/$PURSE_PUB`` endpoint (possibly with long-polling)
+ to be notified about the successful deposit and subsequent completion of the
+ **merge** request.
+
+
+Payment into accounts at remote exchanges
+-----------------------------------------
+
+In case the coins and the accounts in the transaction flows above are at
+different exchanges, an aggregated exchange-to-exchange payment (short
+**wad**) is used.
+
+1. Exchanges specify a new **wad fee** that they charge for exchange-to-exchange
+ payments. They also specify their wad policy, that is how often they
+ perform exchange-to-exchange transfers.
+
+ .. note::
+
+ We may want to consider allowing for different wad-speed levels, where
+ express payments (without aggregation) are allowed in return for higher
+ wad fees.
-Payment directly into a known account at the same exchange
-----------------------------------------------------------
-
-FIXME: do we really want to support payments directly into **accounts**?
-That exposes the long-term account-pub of the payer. Maybe we
-need to mandate the use of a **pouch** or **purse** (which term???).
-
-1. The payee receives a
- ``payto://taler/{EXCHANGE_URL}/{ACCOUNT_PUB}[#CONTRACT_HASH]?``
- payment request, possibly together with a plaintext
- contract.
-2. *Optional*: If the contract hash is provided but the
- contract is unknown, the payee retrieves the contract
- and account signature from the exchange before making
- the payment.
-3. Then, if the payer uses the same exchange,
- they may perform an ordinary ``/deposit`` operation, paying
- the usual **deposit fee**.
-4. The exchange detects the use of the ``taler`` wire method, and
- directly credits the target account (without charging a
- **wire fee**).
-5. The account owner notices the incoming transaction into
- the account and withdraws the funds (once the KYC requirements
- have been met).
-
-
-
-Payment into known account at a remote exchange
------------------------------------------------
-
-1. If the payer knows the payee's account and uses a different exchange,
- they POST the coins to a new ``/wad/MASTER_PUB`` endpoint using the master
- public key of the target exchange, including a deposit permission,
- the base URL of the target exchange, and the target account,
- paying a **deposit fee** and a new **wad fee**. The **wad fees** can
- be used to cover the cost of the exchange-to-exchange wire transfer.
2. The payer's exchange creates a **wad** by grouping all wad requests
to the same target exchange. It executes
the transaction when either the **wad threshold** (maximum number
@@ -282,7 +351,7 @@ Payment into known account at a remote exchange
``/wire`` endpoint of the payee exchange does not
resolve to a valid bank account), the
originating exchange automatically creates a full refund for
- all aggregated deposits and **purses** (**refund fees** apply).
+ all involved coins (**refund fees** apply).
.. note::
@@ -290,11 +359,12 @@ Payment into known account at a remote exchange
are not approved by a merchant's signature. Thus, we will need
a new message type in the coin history to represent these events.
-4. The payee's exchange observes the wire transfer and uses a GET
- ``/wad/{MASTER_PUB}/{WTID}`` request to obtain details about the target
- accounts.
+4. The payee's exchange observes the wire transfer with a wire transfer
+ subject with the originating exchange base URL and a ``$WATID``,
+ and uses a GET ``/wad/$WATID`` request to obtain
+ details about the target accounts.
5. When the payer's exchange is requested to provide information about
- aggregated transfers under the WTID, it provides a signed list of
+ aggregated transfers under the ``$WATID``, it provides a signed list of
account public keys and associated amounts that must add up to an
amount below the total amount transferred. If they do not, the
payee's exchange does not credit any of the accounts and instead
@@ -302,49 +372,53 @@ Payment into known account at a remote exchange
auditor) and reports the issue to the auditor of the payer's exchange
(keeping the received funds for future manual resolution).
6. ``taler-exchange-wirewatch`` and the Taler wire gateway API will
- need to be extended to allow passing inbound wire transfers with WTID
+ need to be extended to allow passing inbound wire transfers with ``$WATID``
and exchange base URL to the exchange. Furthermore, another tool
is needed to lookup the **wad** data at remote exchanges.
-7. If a **wad** contains a deposit with a contract hash, the receiving
- exchange must take note and setup a permanent redirect for requests
- about that contract hash to the original exchange.
-
+7. If the payee trusts the originating exchange, it may consider the
+ transaction ``final`` once the originating exchange has affirmed the
+ deposit (assuming the payer has a way to submit the evidence of that
+ payment, which may not apply in uni-directional scenarios).
+ Otherwise, the payee may simply only trust its own exchange,
+ resulting in the transfer only being considered final after the
+ receiving exchange has confirmed that the **wad** has arrived.
Examples
---------
-Cross-exchange C2C payment request:
+Cross-exchange W2W payment request:
* Bob borrowed 15 EUR from Alice to buy a train ticket. A few days later,
Alice wants her money back. She creates a request for payment in her wallet.
- The wallet creates a pouch for 15 EUR at the only exchange that Alice is currently
+ The wallet creates a purse for 15 EUR at the only exchange that Alice is currently
using. The wallet shows her a
- ``taler://payment-request/{EXCHANGE_URL}/{POUCH_PRIV}?i=Please+pay+me+Bob``
+ ``taler://purse/{EXCHANGE_URL}/{PURSE_PRIV}``
link that she can share with Bob. Bob receives the link and opens it with
his Taler wallet. Bob is using a different EUR exchange than Alice. Bob's
- wallet makes a ``/wad`` request to his own exchange. Shortly after, Alice's
+ wallet makes a ``/deposit`` request to his own exchange. Shortly after, Alice's
exchange receives the wad from Bob's exchange, and credits the money into
- Alice's pouch.
-
+ Alice's purse.
- * How does Bob find out if Alices exchange supports a wad transfer from
- Bob's exchange?
- * How does Bob get a "receipt" to prove that he paid Alice? Is some signature
- from Bob's exchange enough, or should Bob also request a signature for Alice's
- exchange once the money has arrived? Bob's wallet could poll
- the purse at Alice's exchange for a receipt.
+ * Q: How does Bob find out if Alice's exchange supports a wad transfer from
+ Bob's exchange? A: This needs to be part of the wad policy.
+ * Q: How does Bob get a "receipt" to prove that he paid Alice?
+ A: He has Alice's account public key and the associated signature
+ chain leading to her payment request. If he paid someone else by accident,
+ the KYC of Alice's exchange could be used to find out who received the funds.
-Cross-exchange payment offer:
+Cross-exchange W2W payment offer:
* Carol wants to send some money to Dave as a birthday gift. Carol knows that
- Dave is using Taler, but she doesn't know which exchange he is using. She
- opens her Taler wallet and initiates a P2P payment. She sends the
- ``taler://payment-offer/{EXCHANGE_URL}/{POUCH_PRIV}?i=Happy+Birthday+from+Alice`` in an e-mail to Dave.
+ Dave is using Taler, but she does not know which exchange he is using. She
+ opens her Taler wallet and initiates a P2P payment. She sends the resulting
+ ``taler://purse/{EXCHANGE_URL}/{PURSE_PRIV}`` in an e-mail to Dave.
Dave opens they link in the e-mail with his Taler wallet.
Since Dave is using a different exchange than Alice, Dave's wallet
- issues a ``/wad`` request to Alice's exchange. Shortly after,
- Dave's exchange receives the wad, and credits Dave's account with the money.
+ issues a **merge** request to Alice's exchange pointing Alice's exchange
+ to Dave's account at his exchange. Shortly after,
+ Dave's exchange receives a **wad** from Alice's exchange,
+ and credits Dave's account with the money.
State machine for Purses
@@ -352,26 +426,41 @@ State machine for Purses
.. code-block:: none
- // The "OPEN" starte state requires funding
- // the purse either from an account or from
- // a coin.
- -> OPEN
+ // The "OPEN-ACCOUNT" start state implies that the purse is associated
+ // with an account and a merge request for that account.
+ -> OPEN-ACCOUNT
+
+ // "Partial" means that it is filled with a fraction of the coins
+ // indicated in the creation request.
+ OPEN-ACCOUNT -> PARTIAL
+
+ // The purse was filled with as many coins
+ // as indicated in the creation request, resulting in the transaction to complete.
+ OPEN-ACCOUNT -> ACCEPTED
+
+ // The offer expired before any payment was received.
+ OPEN-ACCOUNT -> CLOSED
+
+ // The purse was filled with as many coins
+ // as indicated in the creation request, resulting in the transaction to complete.
+ PARTIAL -> ACCEPTED
- // "Filled" means that it is filled with as many coins
- // as indicated in the creation request.
- OPEN -> FILLED
+ // During an abort, already deposited coins are being taken out of the purse.
+ PARTIAL -> OPEN-ACCOUNT
- // Canceled, all coins put into the purse are refunded
- FILLED -> CLOSED_REFUNDED
+ // All coins put into the purse are refunded because the
+ // payer never completed the purchase before the timeout.
+ PARTIAL -> CLOSED
- // Sent via a wad to a different exchange
- FILLED -> PENDING_WAD
+ // The "OPEN-DEPOSIT" start state implies that the purse is filled with
+ // deposited coins.
+ -> OPEN-DEPOSIT
- // The associated wad transfer succeeded.
- PENDING_WAD -> CLOSED_WAD
+ // Paid and merged with an account (locally or via a wad)
+ OPEN-DEPOSIT -> ACCEPTED
- // Merged into an account at the same exchange
- FILLED -> CLOSED_MERGE
+ // The offer expired without a merge request.
+ OPEN-DEPOSIT -> CLOSED
Additional considerations
@@ -396,7 +485,7 @@ Alternatives
* The payer could directly give deposit permissions to the payee.
This has two problems:
- 1. The payer doesn't know the wire details of the payee.
+ 1. The payer does not know the wire details of the payee.
Thus we would need to introduce some "wildcard deposit permission",
where the exchange allows any wire details on ``/deposit``.
2. The payment information would be rather large, making it difficult
@@ -411,8 +500,10 @@ Alternatives
* Accounts without KYC check could be eventually closed. However,
even if the coins used to fill the account are refunded, it
would be difficult to inform the originating wallet that the
- coins have received a refund. Thus, it is likely simpler to
- declare the funds forfeit.
+ coins have received a refund. This applies even more strongly
+ in case of accounts filled via wads, where in theory the
+ originating exchange may not even be in business anymore.
+ Thus, it is cleaner and simpler to declare such funds forfeit.
Drawbacks
@@ -439,8 +530,10 @@ The overall changes required are not small:
Aside from implementation complexity, the solution has the following drawbacks:
-* If a p2p payment failed (say the receiver lost the account private key),
- the customer's money can be forfeit.
+* If a W2W payment failed (say the receiver lost the account private key),
+ the customer's money can be forfeit. Alas, this should be very, very rare
+ as the wallet software can trivially ensure that a backup was made of the
+ account private key before initiating the KYC process.
Q / A
@@ -448,11 +541,11 @@ Q / A
* Q: Why are direct payments into accounts allowed?
- * A: Direct payments into accounts are used by the customer
+ * A: Direct payments into accounts may be used by the customer
to fund the expenses for using the account. They should not
be used for payments between customers, as contract terms for
- the ``/deposit`` of coins can't be negotiated. Furthermore,
- the sender of the payment can't be sure that the account of
+ the ``/deposit`` of coins cannot be negotiated. Furthermore,
+ the sender of the payment cannot be sure that the account of
the sender is still valid.
* Q: Who "owns" a purse? The payer of payee?
@@ -468,24 +561,27 @@ Q / A
* Q: Are account public keys considered private or public data?
- * A: Private. Making it public would make it too easy
- to accidentally send payments that nobody can receive, because
- the account is wrong/lost. Furthermore, making the account
- public makes it easy to receive unsolicited payments without
- consent from the payee. Since Taler should be as cash-like
- as possible, we might want to avoid that, especially
- for payees who aren't merchant.
+ * A: Public. The payer needs a signature from the payee affirming
+ that they accepted the contract, and this requires a key that
+ is linked to the KYC process to be meaningful. However, the
+ software should NOT permit direct payments into foreign accounts
+ because it would be too easy to accidentally send payments that
+ nobody can receive, because the account public key is wrong/lost.
-* Q: Why do merchant payments not use purses?
+* Q: Why do traditional merchant payments not use purses?
- * Refunds aren't possible with purses after they're closed
- * Partial refunds aren't possible
- * the customer can't prove that they own the contract terms (contract terms claiming isn't interactive)
- * the merchant can't cover deposit fees
- * (All of these could be addressed, but the resulting protocol isn't necessarily simpler
- than what we currently have.)
+ * Refunds are not possible with purses after they are closed.
+ * The customer cannot prove that they own the contract terms
+ (Contract terms claiming requires interactivity that is not
+ possible in all W2W scenarios.) Thus, while payers can prove
+ that they paid, the payee may claim someone else also
+ bought the same product. A secure channel must thus be used to
+ exchange the purchase offer.
* Q: What determines when a wad transfer can happen between two exchanges?
- * Heuristic: Both share an auditor, and the /wire info indicates that the exchanges
- both support wad payments over the same protocol.
+ * Exchanges should explicitly state which other exchanges they are willing
+ to do wad transfers with (and how often, at what cost). This may involve
+ abstract policies like sharing an auditor, using the same currency and the
+ same (banking) protocol, or other constraints (like a specific list of
+ exchanges).