Raiden Network
  • What is Raiden?
  • Installation
    • Quick Start
      • Get MetaMask
      • Get an Infura ID
      • Download and run the Raiden Wizard
      • Handle Limitations
    • Starting Raiden Manually
  • Using Raiden on Mainnet
    • Overview
    • Get Whitelisted Tokens
    • Deposit Tokens to the UDC
    • Open a Channel
    • Make a Payment
    • Deposit Tokens
    • View Channel Status
    • Mediation Fees
  • The Raiden Web Interface
    • Overview
    • Navigate the WebUI
    • Join a Token Network
    • Make a Payment
    • Add More Tokens
    • Settle Payments and Close Channels
  • Using Raiden on testnet
    • Quick Start on Görli Testnet
    • Use Custom Token
      • Get Goerli Testnet ETH (GÖETH)
      • Import Custom Token
      • Compile Imported Token Code
      • Deploy Custom Token
  • Raiden API
    • Introduction
    • Resources
      • Address
      • Version
      • Settings
      • Contracts Information
      • Tokens
      • Channels
      • Payments
      • Connections
      • Pending Transfers
      • Shutdown
      • Testing
    • API Tutorial
      • Create a Token Network
      • Open a Channel
      • Deposit Tokens
      • Make a Payment
      • Withdraw Tokens
      • Settle Payments and Close Channels
  • Other
    • Safe Usage
    • Known Issues
    • Glossary
    • v1.0 Documentation
    • Trademark Attributions
Powered by GitBook
On this page

Was this helpful?

  1. Using Raiden on Mainnet

Open a Channel

Opening a channel and depositing tokens in it allows you to transfer these tokens to your channel partner -- and indirectly to other nodes connected to you partner.

PreviousDeposit Tokens to the UDCNextMake a Payment

Last updated 4 years ago

Was this helpful?

To open a channel, a PUT request is made to the endpoint that includes a JSON object containing:

  1. The address of the node you'd like to open the channel with. If you don't know to which partner you should connect, have a look at "".

  2. The token address. We use W-ETH token in this example.

  3. The amount of tokens you want to deposit in the channel (Remember that it is always possible to later). 1 W-ETH is equivialent to 10^18 WEI.

  4. The settle timeout period which corresponds to the number of blocks that have to be mined before a closed channel can be settled.

curl -i -X PUT \
http://localhost:5001/api/v1/channels \
-H 'Content-Type: application/json' \
--data-raw '{"partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9", "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "total_deposit": "1337", "settle_timeout": "500"}'

Raiden utilizes a RESTful API where all URL paths starts with /api/ followed by a version number. The current API version is 1 and therefore all requests begins with /api/v1/ .

This will create a new channel and a successful request will return you the following response object:

HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "token_network_address": "0x3C158a20b47d9613DDb9409099Be186fC272421a",
    "channel_identifier": "99",
    "partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
    "token_address": "0x9aBa529db3FF2D8409A1da4C9eB148879b046700",
    "balance": "1337",
    "total_deposit": "1337",
    "total_withdraw": "0",
    "state": "opened",
    "settle_timeout": "500",
    "reveal_timeout": "50"
}

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.

We're now ready to start sending W-ETH tokens!

Make a Payment
Find suitable partner nodes
deposit more tokens
channels