<oembed><type>rich</type><version>1.0</version><author_name>npub16dt55fpq3a8r6zpphd9xngxr46zzqs75gna9cj5vf8pknyv2d7equx4wrd</author_name><author_url>https://nostr.ae/npub16dt55fpq3a8r6zpphd9xngxr46zzqs75gna9cj5vf8pknyv2d7equx4wrd</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2023-05-24&#xA;🗒️ Summary of this message: The Ark protocol involves an Ark service provider broadcasting a new unconfirmed on-chain transaction every 5 seconds, with three outputs. Bob can deposit 1 BTC with Alice and they both sign the PSBT, which is broadcast. Bob can unilaterally withdraw or collaboratively withdraw the funds.&#xA;📝 Original message:Hi Burak,&#xA;&#xA;Thanks for this really interesting protocol!  I tend to analyze&#xA;complicated ideas like this by writing about them in my own words, so&#xA;I&#39;ve pasted my summary of your idea to the end of this email in case&#xA;it&#39;s useful, either to other people or to you in helping understand my&#xA;one concern.&#xA;&#xA;My concern is the same one I think Olaoluwa Osuntokun mentioned on&#xA;Twitter[1] and (less clear to me) might be related to ZmnSCPxj&#39;s&#xA;concern[2]:&#xA;&#xA;It seems to me that receiving a payment on the protocol, including&#xA;conditional payments using HTLC, PTLC, or Anchor-TLC, requires waiting&#xA;for the transaction containing that payment to confirm to a sufficient&#xA;depth (e.g., I&#39;d wait 6 blocks for small payments and longer for huge&#xA;payments).  Am I missing something?&#xA;&#xA;My summary of how I think that part of the protocol works is in the&#xA;sections labeled &#34;Make an unconditioned payment&#34; and &#34;Make a conditional&#xA;payment&#34; below.  In short, it&#39;s clear to me how the service provider and&#xA;the customer can make instant atomic swaps with each other---they can&#xA;either spend instantly cooperatively, or they have to wait for a&#xA;timeout.  But how can a receiver of funds be assured that they will&#xA;actually get those funds unless there&#39;s already a timelock and&#xA;cooperative spend path placed on those funds?&#xA;&#xA;-Dave&#xA;&#xA;Rough initial summary of Ark protocol:&#xA;&#xA;Alice runs an Ark service provider.  Every 5 seconds, she broadcasts a&#xA;new unconfirmed onchain transaction that pays three outputs (the&#xA;three Cs):&#xA;&#xA;1. *Change Output:* money not used for the other two Cs that gets sent&#xA;    back to the the transaction creator.&#xA;&#xA;2. *Connector Output:* an output that will be used in a future&#xA;    transaction created by Alice as protection against double spends.&#xA;&#xA;3. *Commitment Output:* a CTV-style commitment to a set of outputs that&#xA;    can be published later in a descendant transaction (alternatively,&#xA;    the commitment output may be spent unilaterally by Alice after 4&#xA;    weeks).&#xA;&#xA;Bob wants to deposit 1 BTC with Alice.  He sends her an unsigned PSBT&#xA;with an input of his and a change output.  She updates the PSBT with a&#xA;commitment output that refunds Bob the 1 BTC and a connector output with&#xA;some minimum value.  They both sign the PBST and it is broadcast.  We&#39;ll&#xA;ignore fees in our examples, both onchain transaction fees and fees paid&#xA;to Alice.&#xA;&#xA; From here, there are several things that Bob can do:&#xA;&#xA;- *Unilaterally withdraw:* Bob can spend from the commitment output to&#xA;   put his refund onchain.  The refund can only be spent after a 24-hour&#xA;   time delay, allowing Bob to optionally come to an agreement with Alice&#xA;   about how to spend the funds before Bob can spend them unilaterally&#xA;   (as we&#39;ll see in a moment).  For example, the script might be[3]:&#xA;&#xA;     pk(B) &amp;&amp; (older(1 day) || pk(A))&#xA;&#xA;- *Collaboratively withdraw:* as seen above, Bob has the ability to come&#xA;   to a trustless agreement with Alice about how to spend his funds.&#xA;   They can use that ability to allow Bob to trade his (unpublished) UTXO&#xA;   for a UTXO that Alice funds and broadcasts.  For example:&#xA;&#xA;     - Alice creates an unsigned PSBT that uses as one of its inputs the&#xA;       connector from Bob&#39;s deposit transaction.  This will ensure that&#xA;       any attempt by Bob to double-spend his deposit transaction will&#xA;       invalidate this withdrawal transaction, preventing Bob from being&#xA;       able to steal any of Alice&#39;s funds.&#xA;&#xA;         Also included in Alice&#39;s unsigned PSBT is another connector&#xA;         output plus the output that pays Bob his 1 BTC.&#xA;&#xA;     - Bob receives Alice&#39;s unsigned PSBT and creates a separate PSBT&#xA;       that includes his unpublished UTXO as an input, giving its value&#xA;       to Alice in an output.  The PSBT also includes as an input the&#xA;       connector output from Alice&#39;s PSBT.  This will ensure that any&#xA;       attempt by Alice to double spend her transaction paying him will&#xA;       invalidate his transaction paying her.&#xA;&#xA;     - Bob signs his PSBT and gives it to Alice.  After verifying it,&#xA;       Alice signs her PSBT and broadcasts it.&#xA;&#xA;- *Collaboratively trade commitments:* as mentioned, the commitment&#xA;   output that pays Bob may be claimed instead by Alice after 4 weeks, so&#xA;   Bob will need to either withdraw or obtain a new commitment within &#xA;that&#xA;   time.  To trade his existing commitment for a new commitment looks&#xA;   similar to the collaborative withdrawal procedure but without the&#xA;   creation of an immediately-spendable onchain output:&#xA;&#xA;     - Alice creates an unsigned PSBT that uses as one of its inputs the&#xA;       connector from Bob&#39;s deposit transaction, again preventing double&#xA;       spending by Bob.  Alice also includes a new connector and a new&#xA;       commitment that again allows Bob to later claim 1 BTC.&#xA;&#xA;     - Bob receives Alice&#39;s PSBT and creates a PSBT transferring his&#xA;       existing commitment to her, with the new connector again being&#xA;       included as an input to ensure atomicity.&#xA;&#xA;     - Bob signs; Alice signs and broadcasts.&#xA;&#xA;- *Make an unconditioned payment:* using the mechanisms described above,&#xA;   it&#39;s possible to make either an onchain payment or an offchain&#xA;   payment---just have Carol receive the new output or commitment rather&#xA;   than Bob.  That payment would have no conditions (except its&#xA;   atomicity).&#xA;&#xA;- *Make a conditional payment:* imagine that Carol knows a secret (e.g.&#xA;   a preimage) that Bob is willing to pay for.&#xA;&#xA;      - Alice creates an unsigned PSBT depending on the connector from&#xA;        Bob&#39;s deposit transaction and creating a new connector.  The PSBT&#xA;        includes an output paying Carol (either onchain or via a&#xA;        commitment) with an HTLC, allowing Carol to claim the funds if &#xA;she&#xA;        reveals the secret or allowing Bob to claim the funds after a&#xA;        timeout.&#xA;&#xA;      - Bob receives Alice&#39;s PSBT and creates a PSBT transferring his&#xA;        existing commitment to her with the HTLC condition attached and,&#xA;        again, with connectors being used to ensure atomicity.&#xA;&#xA;      - Bob signs; Alice signs and broadcasts.&#xA;&#xA;      - Carol can settle her HTLC by either revealing the secret onchain&#xA;        or by trading her commitment containing the HTLC clause for a&#xA;        commitment from Alice that doesn&#39;t contain the clause (which&#xA;        Alice will only accept by learning the secret, since Alice has&#xA;        to settle with Bob).  Alice can then either settle onchain or&#xA;        trade commitments with Bob after giving him the secret.&#xA;&#xA;- *Do nothing for 4 weeks:* if Bob does nothing for four weeks, Alice&#xA;   can claim the funds from the commitment output (i.e., takes his&#xA;   money).&#xA;&#xA;     If Bob did actually do something, and if every other user who also&#xA;     had an unpublished output in the commitment transaction did&#xA;     something, then they all exchanged their portion of the funds in&#xA;     this output to Alice, so Alice can now claim all of those funds&#xA;     onchain in a highly efficient manner.&#xA;&#xA;Regarding the connector outputs, although all of the examples above show&#xA;Alice directly spending from the connector output in Bob&#39;s deposit&#xA;transaction, atomicity is also ensured if Alice spends from any output&#xA;descended from Bob&#39;s connector output.  Connector outputs from different&#xA;deposits can be used as inputs into the same transaction, merging their&#xA;histories.  This allows all operations made by Alice to be fully atomic,&#xA;ensuring that she doesn&#39;t lose any money during a reorg of any length.&#xA;&#xA;Users are not so well protected during reorgs, e.g. if Bob double-spends&#xA;a transaction whose funds were later used in a payment to Carol, then&#xA;Carol loses the money.  For this reason, Alice will probably want to&#xA;prove to users that no funds they receive in a payment derive from any&#xA;deposit less than safe_confirmation_depth blocks.&#xA;&#xA;[1] https://twitter.com/roasbeef/status/1661266771784126464&#xA;&#xA;[2] &#xA;https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-May/021710.html&#xA;&#xA;[3] &#xA;https://min.sc/#c=pk%28B%29%20%26%26%20%28older%281%20day%29%20%7C%7C%20pk%28A%29%29</html></oembed>