Difference between state channel close methods

I can see three methods related to channel close or disconnect in the sdk.

  • Disconnect()
  • Leave()
  • Shutdown()

I am kind of confused between them. Which is among them is on-chain activity. As I understand shutdown should be on-chain activity, but when I call it, it responds almost instantly, Why?

Hey @dimitar.chain can you please help here :wink:

1 Like

Well it is @nduchak.chain who supports the SDK, my 2 cents:

Disconnect() - abruptply destroys the WebSocket connection. Participant just “disappears” from the other participant’s point of view

Leave() - handles the channels.leave method - in this case it is the expected way of temporarily closing the connection. Meaning “hey, I am going offline but I will be back”. docs

Shutdown() - handles channels.shutdown method. This is the on-chain final closing of the channel where tokens are redistributed between participants on-chain. This deletes the channel on-chain. docs

This strongly depends on your (local) setup. What response are you receiving?

3 Likes

@nduchak.chain @dimitar.chain this should be part of the docs.

It’s already there: https://github.com/aeternity/aepp-sdk-js/blob/feat/channel-debug/docs/api/channel/index.md#module_@aeternity/aepp-sdk/es/channel/index--Channel..shutdown

2 Likes

It is already part of the node WebSocket API docs as well, I provided links for it.

1 Like

thanks! @nduchak.chain

3 Likes

Hey I got a transaction with type channelCloseMutual when I parse it on laboratory. I need to verify the transaction hash and the balances on the network. I will update here. The reason I was confused is, when I create channel, it takes time but shutdown is almost instant so I thought whether the mining happens or not. anyways thanks for pointing out those docs.

By the way this line is confusing

This can be done by either of the parties. The process is similar to the off-chain updates.

The phrase Off-chain was confusing to me because update is off chain activity whereas shutdown is on chain activity. so comparing the shutdown with update is what confusing. (this is just my personal opinion)

I am almost done with my work in payment channel, soon this feature will be integrated on the AE-Lab for people to play around with. :slight_smile:

3 Likes

@vishwas_hypermine is this work being done in a public repo? would like to track :slight_smile: looking forward to play around with it! =)

1 Like

Not yet, but soon I will make it public. (I am learning how to code :p)

2 Likes