Skip to content

CooperativeSettle protocol leveraging withdraw messages #342

@andrevmatos

Description

@andrevmatos

raiden-network/raiden-contracts#1474 introduced a method for cooperative settle which uses two WithdrawConfirmations (one for each side) which further constraints in order to settle the channel instantly.

  • withdraw requests must be for the whole capacity of the channel
  • there must be no pending locks on either side

For this, we don't need to implement a new set of messages, but instead can do only with the normal withdraw requests, as long as the above conditions are true. To do so, we propose a simple new optional field to WithdrawRequest, coop_settle, to be a boolean and true when this withdraw request is intended to be used for a cooperative settle.
The whole message and signature works exactly the same as the normal withdraws, with the difference that the clients should not (although they could) send a tx to withdraw when receiving WithdrawConfirmation. Instead, the requestee's side, besides signing and sending it, if willing to comply and the conditions hold, just send a request of their own whole balance as well. Requester's will wait for it, and then perform the coopSettle when receiving the valid request on their side.

So, in resume:

  • when willing to coop-settle, we send a WithdrawRequest with property coop_settle: true with our whole balance
  • partner, when receiving it, will confirm it as usual and also initiate a WithdrawRequest with their whole balance (if no pending locks are present on neither side) and may also set coop_settle: false on it, but requester shouldn't mind it, as long a the confirmation is valid.
  • when we receive their WithdrawRequest, we can confirm it as usual, but now, having both confirmations, we can just coop-settle
  • partner may just be sure to not withdraw nor coop-settle on their side upon WithdrawConfirmations, since this was triggered by the other end
  • the withdraw requests will "lock" the whole balance anyway while they're pending, preventing any new transfer to go through meanwhile
  • if for any reason the coop-settle can't be performed, the requests can expire as usual and the channel become usable after that, so no need for further safetyguards beyond those already implemented for withdraws

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions