[Solved] Channel not found

I’m trying to get channel by pubkey using the Node API GET /channels/{pubkey}
link to channel
but I’m getting Channel not found

using the middleware I can get this channel
middleware link to channel

The main reason I need to know the response of the GET /channels/{pubkey} is the “responder_id” that is missing in “ChannelCloseMutualTx” transactions type.
link to ChannelCloseMutualTx

Is there any reason to not receive the channel that closed?
Thanks in advance.

1 Like

Once the channel is closed it is removed from the state tree, and thus /channels/{pubkey} will return Channel not found. If you are interested in responder_id you can see it in the channel create transaction (seen in the middleware link, ak_26xYuZJnxpjuBqkvXQ4EKb4Ludt8w3rGWREvEwm68qdtJLyLwq ) - it is not an explicit part of the mutual close transaction (since it isn’t necessary and thus just bloating the transaction size).

Thank you, I understood what you mean.
Maybe you can point me to what I need.
There are two transaction types - channel_close_mutual, channel_settle, that are final for channels.
I want to parse those transactions as 2 ‘withdraw’ transactions, one for initiator and one for responder.
For example:
the first transaction -
{"from": channel id,
"to": from_id (initiator_id),
"amount": initiator_amount_final}
the second transaction -
{"from": channel id,
"to": ??? (responder_id),
"amount": responder_amount_final}

the problem is that link to channel_close_mutual is missing the responder_id and I have to find a way to get it programmatically.

Possible solutions:

  • use Blake2b (256 bits digest) to decode the channel_id to receive responder_id (Blake2b example)

I was looking for how to decode/encode channel_id from source-code (gen_channel_id)
Can you please help to provide an example for encoding/decoding to/from channel_id?

Thanks again.

First, two obvious things that you have misunderstood. The from_id in the mutual_close (and the settle) transaction is not necessarily the initiator_id it can just as well be responder_id, it depends which of the two channel participants that actually initiate the transaction. Secondly, channel_id is a hash; hash functions is typically one-way functions, i.e. it is impossible to calculate anything from the channel_id.

So without any context (why would you want to do this) it is a bit hard to help. But since you know the channel_id you probably also know the channel_create transaction, it contains the addresses/ids of the two channel participants, I suggest you keep track of them and then use that information when you try to interpret the mutual_close transaction.

Thank you @hanssv.chain.
Probably I missed those parts