Lightning Network (Raiden Network) is under expansion program chain Ethernet Square block chain, Restful API official Chinese version of the document provided by the Wise Raiden node network access address:http://cw.hubwiz.com/card/c/raiden-api/
Raiden API access end node URL usually contains version information, in order to support access to different versions of the API, all API access URL prefixes are: /api/<version>/
.
If you want to quickly master the development block chain applications, we recommended Ebizal network block chain application development tutorial series , covering Bitcoin, Ethernet Square, eos, super fabric books and other tendermint block chain, as well as java, go , nodejs, python, php, c #, dart and other development languages.
1, API request / response JSON encoded data
API access requests and responses are encoded using JSON. The following are the common API objects.
1.1 channel / Channel
Example channel object as follows:
{
"channel_identifier": 21,
"token_network_identifier": "0x2a65Aca4D5fC5B5C859090a6c34d164135398226",
"partner_address": "0x61C808D82A3Ac53231750daDc13c777b59310bD9",
"token_address": "0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8",
"balance": 25000000,
"total_deposit": 35000000,
"state": "opened",
"settle_timeout": 500,
"reveal_timeout": 40
}
Channel object contains the following fields:
- channel_identifier: channel identification, integer
- partner_address: other address, EIP55 encoded address string, used to open a passage
- token_address: token address, EIP555 encoded address string token, for the transaction on the channel
- token_network_identifier: network identifier token, EIP55 network identifier encoded token
- balance: balance available tokens, integer
- total_deposit: channel amount has been deposited contracts, integer
- state: The current status of the channel, a string, a value may include:
opened
- Channel turnedclosed
- channel is closedsettled
- and the channel is closed liquidated - settle_timeout: Liquidation Channel Timeout number of blocks, integer
- reveal_timeout: The maximum number of blocks allowed disclosed timeout, integers
1.2 Channel Event / Event
Channel encoding a JSON object events, the event parameters as the properties of the event object. In order to facilitate the distinction between different types of events, the event object in the additionally added event_type
and block_number
attributes.
2, API error message
For API request is unsuccessful, it will return the corresponding http status codes, such as 409 or 400 Bad Request conflict, etc., but also comes with errors in the field json object returned, you can use to get more information about the error. However, it should be noted that, if Raiden can not handle the incoming request and an exception is thrown, it will return http status code 500, it is not json object is then returned, but only a string message Internal server error
. This is because we rely on other development library to implement API, we are unable to handle normal response message when an exception occurs.
In any case, we believe that the 500 error is Raiden bug, if you encountered this phenomenon, please give us feedback.
3, access terminal node
The following access Raiden end nodes, may be selected in the development of:
- The underlying API
- Lightning query node information: GET / API / (Version) / address
- Registration specified tokens: PUT / API / (Version) / tokens / (token_address)
- Channel information query API and tokens
- Get unsettled channel list: GET / API / (Version) / channels
- Gets the token list unsettled channels: the GET / API / (Version) / channels / (token_address)
- Queries specific channel information: GET / API / (Version) / channels / (token_address) / (partner_address)
- Obtain a list of registered tokens: GET / API / (Version) / tokens
- Gets the token Network Address: GET / API / (Version) / tokens / (token_address)
- Gets the tokens unsettled channel counterparties: the GET / API / (Version) / tokens / (token_address) / Partners
- Get not complete the transfer list: GET / API / (Version) / pending_transfers
- Gets the specified tokens not complete the transfer list: GET / API / (Version) / pending_transfers / (token_address)
- Gets the channel did not complete the transfer list: GET / API / (Version) / pending_transfers / (token_address) / (partner_address)
- Channel Management API
- Open the pathway: the PUT / API / (Version) / channels
- Close Channel: the PATCH / API / (Version) / channels / (token_address) / (partner_address)
- Connection Manager API
- Query has joined the network of tokens: GET / API / (Version) / Connections
- Tokens automatically join the network: the PUT / API / (Version) / Connections / (token_address)
- Removes the specified tokens network: DELETE / API / (Version) / Connections / (token_address)
- Payment-related API
- Initiate a payment: POST / API / (Version) / Payments / (token_address) / (TARGET_ADDRESS)
- Queries payment history: GET / API / v1 / Payments / (token_address) / (TARGET_ADDRESS)
Original link: Ethernet network API documentation Square lightning - Wise Net