GEO Protocol nodes handler API

Nodes handler API
V1
POST /api/v1/nodes/
DELETE /api/v1/nodes-handlers/{uuid}/
Create
POST /api/v1/nodes/

Time prediction: <5 sec.

Creates and launches new node with random UUID as it’s ID.

Responses

201 Created
Body
Object
uuid
integer required

UUID of the created node.

Examples

POST /api/v1/nodes-handlers/ HTTP/1.1 

HTTP/1.1 201 Created 

Content-Type: application/json

{
    "data": {
        "uuid": "550e8400-e29b-41d4-a716-446655440000"
    }
}
Disable
DELETE /api/v1/nodes-handlers/{uuid}/

Time prediction: <5 sec.

  • Stops node process;
  • Marks it as disabled, by prefixing it’s directory with “(disabled-)”, so this account will be ignored on the next startup;

WARN: Doesn’t removes node’s data itself.

WARN: Doesn’t checks any present debts.

Path variables

uuid
string required

UUID of the node, that must be disabled.

Responses

200 OK

Node was deactivated successfully.

404 Not Found

There is no node with exact uuid.

412 Precondition Failed

Node is present, but is alredy disabled.

Node API

Engine Proxy - distibuted HTTP Server, that provides access to nodes via HTTP API. This proxy server is used by the GEO Pay backend for reaching nodes info. Provied API methods take part on maintaining trust lines and transactions on them.

V1
Contractors
GET /api/v1/contractors/
List
GET /api/v1/contractors/

Authentication

Open

Returns list of all neighours of the node.

Responses

200 OK
Body
Object
count
integer required

Neighbours count

Examples:
112
uuids
Array of string required
Example:
List of UUIDs of all contractors.

Examples

No contractors

GET /api/v1/contractors/ HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

{
  "data": {
    "count": 0,
    "uuids": [] 
  }
}

Contractors present

GET /api/v1/contractors/ HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

{
  "data": {
    "count": 1,
    "uuids": ["1b822993-4515-4ee4-adb9-fa2b3347a705"]
  }
}
Trust Lines
POST /api/v1/contractors/{contractor_uuid}/trust-lines/{equivalent_id}
DELETE /api/v1/contractors/{contractor-uuid}/trust-lines/
PUT /api/v1/contractors/{contractor-uuid}/trust-lines/
GET /api/v1/contractors/trust-lines/
Open
POST /api/v1/contractors/{contractor_uuid}/trust-lines/{equivalent_id}

Initiates creating of the trust line to the contractor node with total credit amount = amount.

Path variables

contractor_uuid
string required

UUID of the node, to which the trust line should be opened.

equivalent_id
integer required

ID of the accounting unit, that is used for the operation.

Request parameters

amount
Amount required

Specifies how much current node trusts to the contractor node.

Responses

404 Node Not Found

No requested node is present in the system.

503 Node is gone

Node process is gone and doesn’t processes incomming commands.

Close
DELETE /api/v1/contractors/{contractor-uuid}/trust-lines/

Initiates closing of the trust line to the contractor node. Outgoing trust line would be automatically deleted in case if it holds no debt, otherwise - it would be marked as closed, but would be keept until debt wan’t be cleared.

Path variables

contractor-uuid
string required

Responses

404 Node Not Found

No requested node is present in the system.

503 Service Unavailable: node is gone

Node process is goneand doesn’t processes incomming commands.

Set
PUT /api/v1/contractors/{contractor-uuid}/trust-lines/

Updates outgoing trust amount of the trust line to the contractor node.

Path variables

contractor-uuid
string required

Request parameters

amount
Amount required

New outgoing trust line amount.

Responses

404 Node Not Found

No requested node is present in the system.

503 Service Unavailable: node is gone

Node process is gone and doesn’t processes incomming commands.

List
GET /api/v1/contractors/trust-lines/

Returns all trust lines of the node.

Responses

200 OK

Examples

GET /api/v1/contractors/trust-lines/ HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

{
  "data": {
    "count": 1,
    "trust_lines": [
      {
        "uuid": "uuid",
        "incoming_trust_amount": "1000",
        "outgoing_trust_amount": "2000",
        "balance": "500"
      }
    ]
  }
}

No trust lines

GET /api/v1/contractors/trust-lines/ HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

{
  "data": {
    "count": 0,
    "trust_lines": []
  }
}
Transactions
POST /api/v1/contractors/{contractor_uuid}/transactions/
GET /api/v1/contractors/{contractor-uuid}/transactions/max/
Pay (generate transaction)
POST /api/v1/contractors/{contractor_uuid}/transactions/

Generates payment operation from the node to the contractor.

Path variables

contractor_uuid
string required

UUID of the node, that should receive the transfer.

Request parameters

amount
Amount required
purpose
string optional
Equivalent
string optional

ID of accounting unit, that is used in the operation.

Responses

201 Created

Examples

OK

POST /api/v1/contractors/{contractor_uuid}/transactions/ HTTP/1.1 

HTTP/1.1 201 Created 

Content-Type: application/json

{
    "data": {
        "transaction_uuid": "1b822993-4515-4ee4-adb9-fa2b3347a705"
    }
}
Predict max flow
GET /api/v1/contractors/{contractor-uuid}/transactions/max/

Returns max amout flow from contractor node to the current node.

Path variables

contractor-uuid
string required

UUID of the node, to which the flow must be calculated.

Request parameters

[v1.1] Equivalents
string optional

Responses

200 OK

Examples

GET /api/v1/contractors/{contractor-uuid}/transactions/max/ HTTP/1.1 

HTTP/1.1 200 OK 

Content-Type: application/json

{
    "data": {
        "max_amount": "1000"
    }
}
Common types
Amount

Amount is the base type for all operations, that are requiring pair of amount and equivalent (for example, payment operations, or some operations with trust lines).

Positive BigInt representation in string format. The comma is ommited, because the number will be represented in 10**8 (power of 8) notation. For example, 1 dollar will be represented as 1 * 10**8 dollars in the system. Max value == 2**32.

string
Min length: 1