public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: ZmnSCPxj <ZmnSCPxj@protonmail•com>
To: Runchao Han <runchao.han@monash•edu>
Cc: Bitcoin Protocol Discussion
	<bitcoin-dev@lists•linuxfoundation.org>,
	"jiangshan.yu@monash•edu" <jiangshan.yu@monash•edu>
Subject: Re: [bitcoin-dev] OP_LOOKUP_OUTPUT proposal
Date: Mon, 12 Aug 2019 08:05:53 +0000	[thread overview]
Message-ID: <OLQmXBBI4kc9mkjbpr92bKp3UFhmg7ZtTn-m_VNinXNDT4CYz9Jf45gpSfxmkzXQLJfchMk7AaqEjbEor-ZJ02xrd_0yb2MOekXfRyovj6U=@protonmail.com> (raw)
In-Reply-To: <212E8AD5-0EED-468E-8AFC-134611514CBC@monash.edu>

Good morning Runchao,


Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, August 12, 2019 11:19 AM, Runchao Han <runchao.han@monash•edu> wrote:

> Good morning ZmnSCPxj,
>
> Sorry for the ambiguity of my last email. It was Sunday and I wrote it in 1 min on my bed. Let me elaborate what we are thinking of here.
>
> ## Analysis on the protocol from Fournier et al.
>
> In this protocol, Bob participates in the swap following the steps below:
>
> 1. Alice and Bob creates a payment channel on WJT blockchain.
> 2. Bob creates the WJT transaction using the joint account of Alice and Bob, including 1) Bob's input of 1,000,000 WJT, 2) Alice’s input for the 10,000 WJT premium. This transaction should be signed by both Alice and Bob in order to be valid.
> 3. Bob signs the WJT transaction and sends the WJT transaction to Alice.
> 4. Alice signs this WJT transaction. At this stage, Alice has both the valid BTC transaction and the valid WJT transaction.
> 5. Alice broadcasts both the BTC transaction and the WJT transaction.

Incorrect.

The order is below.
I add also the behavior when the protocol is stalled such that a step is not completed.

1.  Alice broadcasts and confirms a BTC transaction paying an HTLC, hashlock Bob, Timelock Alice.
    * Alice is initiating the protocol via this step, thus non-completion of this step is simply not performing the protocol.
2.  Alice informs the BTC transaction to Bob.
    * If Alice does not perform this, Bob does not know it and Alice locked her own money for no reason.
3.  Alice and Bob indicate their inputs for the WJT-side funding transaction.
    * If Alice does not perform this, it aborts the protocol and Alice locked her own money for no reason.
    * If Bob does not perform this, it aborts the protocol and Bob turns down the opportunity to earn 10,000 WJT (opportunity cost).
4.  Alice and Bob exchange signatures for the WJT-side claim transaction which spends the funding transaction via the hashlock side and gives 1,000,000 WJT to payout to Alice and 10,000 WJT premium to Bob.
    Order does not matter as funding  tx is still unsigned.
    * If Alice does not perform this, it aborts the protocol and Alice locked her own money for no reason.
    * If Bob does not perform this, it aborts the protocol and Bob turns down the opportunity to earn 10,000 WJT (opportunity cost).
5.  Bob provides signatures for the WJT funding tx,
    * If Bob does not perform this, it aborts the protocol and Bob turns down the opportunity to earn 10,000 WJT (opportunity cost).
6.  Alice signs WJT funding tx and broacasts and confirms.
    * If Alice does not perform this, Bob invalidates the transaction by spending any of his inputs.
      * Alice has an option here, but a very short option: up until Bob grows tired of waiting.
        Bob can make this timeout arbitrarily small, without requiring input from Alice.
        What value would there be in a 1-second option, even gotten for free, when Alice has spent fees on the BTC-side transaction in the first place?
7.  Alice completes the claim transaction and broadcasts.
    * If Alice does not perform this, Bob simply waits out the timelock and recovers his funds plus premium.
8.  Bob spends the BTC HTLC via the hashlock path.
    * If Bob does not perform this, Bob has given money for free to Alice.

Thus I do not believe this is needed for blockchain-layer atomic swaps.

For Lightning-layer atomic swaps, the solution requires that two hashes be used on the WJT side, and is largely the above protocol in very broad strokes.
Unfortunately, using two hashes instead of one leaks to intermediate hops that the payment involved a cross-currency swap, thus undesirable.



>
> In a word, Bob is responsible for preparing the WJT transaction, while Alice is responsible for preparing the BTC transaction and broadcasting both transactions.
>
> Here, if Bob stalls, nothing will happen, because Bob cannot spend the 10,000 WJT premium without Alice’s signature.
> If Alice stalls, you are saying that Bob can spend the input of 1,000,000 WJT so he does not lose any money.
>
> I have 3 questions on this scheme.
>
> First, I’m not sure how do you define “Alice stalls”. In this case, Alice can stall by 1) withhold the WJT tx, or 2) broadcast BTC/WJT funding txs but withhold the preimage.
> If 2), this protocol is okay. But what about 1) i.e. Alice withholds the WJT tx? Here, Bob cannot do anything except for closing the payment channel and quit.

Yes.

>
> Second, I’m not sure whether Bob can spend his money in this payment channel while the payment channel is still valid.
> In Bitcoin, Bob needs to close the payment channel and get back his money first, then he can spend the money.

Depends on how the payment channel is implemented.
If you do something like send transactions spending the internal state outputs, then ratifying this later by performing a transaction cut-through to derive the next state update, then it is no different from blockchain layer.
Of course, if you postulate the non-cooperation of Alice in this, there is indeed a need to close unilaterally.
But this is the same as any non-cooperation in any channel system: that is the entire point why you have unilateral closes.

>
> Third, let’s optimistically assume Bob can close this payment channel without Alice’s consent.

Every payment channel system worth consideration today has a unilateral close.
There is no need for optimism.

> Now he decides to close this channel if Alice does not broadcast the WJT tx all the time.
> Alice does not need to pay for the premium if she withholds the WJT tx. If Alice decides not to proceed this swap, Bob should close this channel and get back 1,000,000 WJT. However, Bob cannot get the 10,000 WJT premium.

And this time frame can be made arbitarily small by Bob by simple threat of unilateral close, thus not making it an option for Alice.

Regards,
ZmnSCPxj



  reply	other threads:[~2019-08-12  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 13:35 Haoyu LIN
2019-08-09 14:29 ` ZmnSCPxj
2019-08-10  5:46   ` Runchao Han
     [not found]   ` <ADA03200-1EED-4EAD-B320-3F2034F00954@monash.edu>
2019-08-10 12:50     ` ZmnSCPxj
2019-08-10 13:01       ` Runchao Han
2019-08-12  3:19         ` Runchao Han
2019-08-12  8:05           ` ZmnSCPxj [this message]
2019-08-12  9:22             ` Lloyd Fournier
2019-08-12 10:02             ` Runchao Han
2019-08-12 13:15               ` ZmnSCPxj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='OLQmXBBI4kc9mkjbpr92bKp3UFhmg7ZtTn-m_VNinXNDT4CYz9Jf45gpSfxmkzXQLJfchMk7AaqEjbEor-ZJ02xrd_0yb2MOekXfRyovj6U=@protonmail.com' \
    --to=zmnscpxj@protonmail$(echo .)com \
    --cc=bitcoin-dev@lists$(echo .)linuxfoundation.org \
    --cc=jiangshan.yu@monash$(echo .)edu \
    --cc=runchao.han@monash$(echo .)edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox