osagga / NTumbleBit

TumbleBit Implementation in .NET Core
MIT License
1 stars 0 forks source link

Puzzle Solving protocol changes (for paymentHub mode) #4

Open osagga opened 6 years ago

osagga commented 6 years ago

Write up for the Solver protocol (in Payment-Hub mode)

Changes to the Transactions (smart contracts)

T_escr:
        input = A
        output = [Q BTC] -> (T and A) OR (A and tw_1)

Cooperative A and T:

T_cash:
        input= (A and T)
        outputs=
            0. [j BTC] -> T
            1. [Q-j BTC] -> A

Uncooperative A:

T_puzzle:
        input= (T and A)
        outputs=
            0. [j BTC] -> (T and all pre images of specific hash values) OR (A and tw_1) #Check the way the refund is written here.
            1. [Q-j BTC] -> A
T_solve:
        input= (T and all the preimages)
        output= [j BTC] -> T

Uncooperative T:

T_refund (to get money back from T_escr):
        input= (A and tw_1)
        output= [Q BTC] -> A
T_refund (to get money back from T_puzzle):
        input= (A and tw_1)
        output= [j BTC] -> A

How the puzzle solving protocol should behave in this mode

image

(The puzzle solving protocol for Q=1 from the TumbleBit paper, page 10 here)

Mainly the protocol is same as the Q=1 case, except with the following modifications:

On the Tumbler side

On Alice's side

NTumbleBit status regarding the required changes (Needs more research through the code base)

goldbe commented 6 years ago

Omar, can you revise please? Remember that no transactions are actually posted to the blockchain until the cashout phase. Instead, we just pass transactions back and forth between Alice and Tumbler. We only post the last transaction that we get, once we finish making the last payment.

So you will need to revise the parts where talk about posting please

osagga commented 6 years ago

Yeah sorry I thought that was already implied. I revised the parts related to posting transactions and tried to state clearly when a transaction is posted or not. Let me know if it's clearer now.

goldbe commented 6 years ago

Note:

T_refund (to get money back from T_escr): input= (A and tw_1) output= [Q BTC] -> A

There's no way to have tw_1 in the input. That's just the time window. Instead the script will confirm that T_refund was confirmed in a block that was confirmed after time tw_1.

osagga commented 6 years ago

Yeah I figured, but I tried to keep the structure of the definition of the transaction to be consistent with how the TumbleBit paper defines them (see picture below). image