Open a Channel
Channels allow tokens to move between the two connected Raiden nodes. You need at least one channel to make payments in a Token Network.
This section will cover the endpoints you would use to:
Find suitable partner nodes
Find suitable partner nodes
To make payments, you need to be connected to the target node either directly, or indirectly by having a channel with a well connected that mediates your payment to the target. If you already know to which node you want to connect, skip ahead to the next section.
Open a ChannelThe Path Finding Service (PFS) can suggest partners that are highly connected. These nodes will be able to mediate your payments to a large amount of potential targets and are thus a good choice for your first channel(s). Ask the PFS by sending a GET request to its partner suggestion endpoint for the token you want to use.
If you don't know which PFS to ask, you can get the URL of the PFS used by your Raiden node from the settings endpoint. The list of suggested partners is sorted with the most recommended ones coming first. If you want to open just a single channel, picking the address of the first partner in the results is a reasonable choice.
Open a channel
To open a channel a PUT request is made to the channels
endpoint that includes a JSON object containing:
The address of the node you'd like to open the channel with.
The amount of tokens you want to deposit in the channel. (Remember that it is always possible to deposit more tokens later.)
The settle timeout period which corresponds to the number of blocks that have to be mined before a closed channel can be settled.
This will create a new channel and a successful request will return you the following response object:
As you can tell by the response object a channel identifier has been generated. This means that there now is a channel with that identifier inside the token network.
You're now ready to start making payments.
Make a PaymentOpening a channel with a partner node is not dependent on whether the partner node holds tokens or not. It will work either way.
Query the state of a channel
Checking the current state of a channel is as easy as making a query to the channels
endpoint while providing:
The token address as a path parameter.
The address of the partner node as a path parameter.
This will give you the same response object as when opening a channel.
Last updated