NAV Navbar
cli
  • Introduction
  • Exchange (XBridge)BETA
  • Error Codes
  • Introduction

    Blocknet provides a simple and powerful API to build previously impossible multi-chain applications that consumes services on compatible blockchains, all while remaining 100% trustless and decentralized.

    Currently the API is only accessible through the command line(cli). Code examples can be viewed in the dark areas next to each respective API call.

    Exchange (XBridge)

    The following set of calls are used to conduct decentralized and trustless exchanges on the Blocknet network.

    dxMakeOrder

    Sample Data

    {
      "maker": "SYS",
      "maker_size": "0.100",
      "maker_address": "yFMXXUJF7pSKegHTkTYMjfNxyUGVt1uCrL",
      "taker": "LTC",
      "taker_size": "0.01",
      "taker_address": "yGDmuy8m1Li4ShNe7kGYusACw4oyiGiK5b",
      "type": "exact"
    }
    

    This call is used to create a new order.

    Request Parameters

    Sample Request

    blocknetdx-cli dxMakeOrder SYS 0.100 yFMXXUJF7pSKegHTkTYMjfNxyUGVt1uCrL LTC 0.01 yGDmuy8m1Li4ShNe7kGYusACw4oyiGiK5b exact
    

    dxMakeOrder [maker] [maker_size] [maker_address] [taker] [taker_size] [taker_address] [type] [dryrun](optional)

    Parameter Type Description
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    maker_address string Maker address for sending the outgoing token.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    taker_address string Maker address for receiving the incoming token.
    type string This is the order type.
    "exact": Matches a specific order.
    "limit": (not yet supported)
    "market": (not yet supported)
    dryrun string (Optional Parameter)
    "dryrun": Receive a response without actually submitting the order to the network.

    Response Parameters

    Sample 200 Response

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092",
      "maker": "SYS",
      "maker_size": "0.100",
      "maker_address": "yFMXXUJF7pSKegHTkTYMjfNxyUGVt1uCrL",
      "taker": "LTC",
      "taker_size": "0.01",
      "taker_address": "yGDmuy8m1Li4ShNe7kGYusACw4oyiGiK5b",
      "updated_at": "2018-01-16T00:00:00.00000Z",
      "created_at": "2018-01-15T18:15:30.12345Z",
      "block_id": "38729344720578447445023782734923740427863289632489723984723",
      "status": "created"
    }
    
    Parameter Type Description
    id string The order GUID.
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    maker_address string Maker address for sending the outgoing token.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    taker_address string Maker address for receiving the incoming token.
    updated_at string ISO 8601 datetime, with microseconds, of the last time the order was updated.
    created_at string ISO 8601 datetime, with microseconds, of when the order was created.
    block_id string The GUID block hash of the current block on the Blocknet blockchain at the time the order was created.
    status string Order status: "created", "open", "pending", "filled", "cancelled"

    Sample 400 Response

    {
      "error": "Size must be greater than 0",
      "code": 1024,
      "name": "dxMakeOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxMakeOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1024 400 Size must be greater than 0
    1011 400 Invalid maker symbol
    1012 400 Invalid taker symbol
    1026 400 Bad maker address
    1026 400 Bad taker address
    1002 500 Internal server error

    dxTakeOrder

    Sample Data

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092",
      "send_address": "yFMXXUJF7pSKegHTkTYMjfNxyUGVt1uCrL",
      "receive_address": "yGDmuy8m1Li4ShNe7kGYusACw4oyiGiK5b",
      "dryrun": "dryrun"
    }
    

    This call is used to take an order.

    Request Parameters

    Sample Request

    blocknetdx-cli dxTakeOrder 2cd2a2ac-e6ff-4beb-9b45-d460bf83a092 yFMXXUJF7pSKegHTkTYMjfNxyUGVt1uCrL yGDmuy8m1Li4ShNe7kGYusACw4oyiGiK5b
    

    dxTakeOrder [order_id] [send_address] [receive_address] [dryrun](optional)

    Parameter Type Description
    id string ID of order being filled.
    send_address string Taker address for sending the outgoing token.
    receive_address string Taker address for receiving the incoming token.
    dryrun string (Optional Parameter)
    "dryrun": Receive a response without actually submitting the order to the network.

    Response Parameters

    Sample 200 Response

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092",
      "maker": "SYS",
      "maker_size": "0.100",
      "taker": "LTC",
      "taker_size": "0.01",
      "updated_at": "1970-01-01T00:00:00.00000Z",
      "created_at": "2018-01-15T18:15:30.12345Z",
      "status": "filled"
    }
    
    Parameter Type Description
    id string The order GUID.
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    updated_at string ISO 8601 datetime, with microseconds, of the last time the order was updated.
    created_at string ISO 8601 datetime, with microseconds, of when the order was created.
    status string Order status: "filled"

    Sample 400 Response

    {
      "error": "Invalid order id",
      "code": 1021,
      "name": "dxTakeOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxTakeOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1021 400 Invalid order id
    1011 400 Invalid maker symbol
    1012 400 Invalid taker symbol
    1026 400 Bad maker address
    1026 400 Bad taker address
    1002 500 Internal server error

    dxCancelOrder

    Sample Data

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092"
    }
    

    This call is used to cancel an order, and automatically rolled back if necessary.

    Request Parameters

    Sample Request

    blocknetdx-cli dxCancelOrder 2cd2a2ac-e6ff-4beb-9b45-d460bf83a092
    

    dxCancelOrder [order_id]

    Parameter Type Description
    id string ID of order being cancelled.

    Response Parameters

    Sample 200 Response

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092",
      "maker": "SYS",
      "maker_size": "0.100",
      "maker_address": "yFMXXUJF7pSKegHTkTYMjfNxyUGVt1uCrL",
      "taker": "LTC",
      "taker_size": "0.01",
      "taker_address": "yGDmuy8m1Li4ShNe7kGYusACw4oyiGiK5b",
      "updated_at": "1970-01-01T00:00:00.00000Z",
      "created_at": "2018-01-15T18:15:30.12345Z",
      "status": "canceled"
    }
    
    Parameter Type Description
    id string The order GUID.
    maker string Sending token of party cancelling the order.
    maker_size string(float) Sending trading size. String is used to preserve precision.
    maker_address string Address for sending the outgoing token.
    taker string Receiving token of party cancelling the order.
    taker_size string(float) Receiving trading size. String is used to preserve precision.
    taker_address string Address for receiving the incoming token.
    updated_at string ISO 8601 datetime, with microseconds, of the last time the order was updated.
    created_at string ISO 8601 datetime, with microseconds, of when the order was created.
    status string Order status: "created", "open", "pending", "filled", "cancelled"

    Sample 400 Response

    {
      "error": "Invalid order id",
      "code": 1021,
      "name": "dxCancelOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxCancelOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1021 400 Invalid order id
    1002 500 Internal server error

    dxGetOrder

    Sample Data

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092"
    }
    

    This call is used to retrieve order info.

    Request Parameters

    Sample Request

    blocknetdx-cli dxGetOrder 2cd2a2ac-e6ff-4beb-9b45-d460bf83a092
    

    dxGetOrder [order_id]

    Parameter Type Description
    id string ID of order of interest.

    Response Parameters

    Sample 200 Response

    {
      "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092",
      "maker": "SYS",
      "maker_size": "0.100",
      "taker": "LTC",
      "taker_size": "0.01",
      "updated_at": "1970-01-01T00:00:00.00000Z",
      "created_at": "2018-01-15T18:15:30.12345Z",
      "status": "open"
    }
    
    Parameter Type Description
    id string The order GUID.
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    updated_at string ISO 8601 datetime, with microseconds, of the last time the order was updated.
    created_at string ISO 8601 datetime, with microseconds, of when the order was created.
    status string Order status: "created", "open", "pending", "filled", "cancelled"

    Sample 400 Response

    {
      "error": "Invalid order id",
      "code": 1021,
      "name": "dxGetOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetOrder"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1021 400 Invalid order id
    1002 500 Internal server error

    dxGetOrders

    This call is used to retrieve all orders.

    Request Parameters

    Request

    blocknetdx-cli dxGetOrders
    

    dxGetOrders

    This call does not take parameters.

    Response Parameters

    Sample 200 Response

    [
      {
        "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092", 
        "maker": "SYS",
        "maker_size": "0.100",
        "taker": "LTC",
        "taker_size": "0.01",
        "updated_at": "2018-01-15T18:25:05.12345Z", 
        "created_at": "2018-01-15T18:15:30.12345Z", 
        "status": "filled"
      },
      {
        "id": "12b672d4-cc43-4941-8b35-b1d0ea110908", 
        "maker": "SYS",
        "maker_size": "0.100",
        "taker": "LTC",
        "taker_size": "0.01",
        "updated_at": "2018-01-15T18:25:05.12345Z", 
        "created_at": "2018-01-15T18:15:30.12345Z", 
        "status": "filled"
      },
      {
        "id": "01639dfa-db96-440c-85bd-6d4feda8ace6", 
        "maker": "SYS",
        "maker_size": "0.100",
        "taker": "LTC",
        "taker_size": "0.01",
        "updated_at": "2018-01-15T18:25:05.12345Z", 
        "created_at": "2018-01-15T18:15:30.12345Z", 
        "status": "filled"
      }
    ]
    
    Parameter Type Description
    Array array An array of all orders with each order having the following parameters.
    id string The order GUID.
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    updated_at string ISO 8601 datetime, with microseconds, of the last time the order was updated.
    created_at string ISO 8601 datetime, with microseconds, of when the order was created.
    status string Order status: "created", "open", "pending", "filled", "cancelled"

    Sample 400 Response

    {
      "error": "Invalid order id",
      "code": 1021,
      "name": "dxGetOrders"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetOrders"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1021 400 Invalid order id
    1002 500 Internal server error

    dxGetMyOrders

    This call is used to retrieve all of the orders from the local client.

    Request Parameters

    Request

    blocknetdx-cli dxGetMyOrders
    

    dxGetMyOrders

    This call does not take parameters.

    Response Parameters

    Sample 200 Response

    [
      {
        "id": "2cd2a2ac-e6ff-4beb-9b45-d460bf83a092", 
        "maker": "SYS",
        "maker_size": "0.100",
        "taker": "LTC",
        "taker_size": "0.01",
        "updated_at": "2018-01-15T18:25:35.12345Z", 
        "created_at": "2018-01-15T18:15:37.12345Z", 
        "status": "filled"
      },
      {
        "id": "12b672d4-cc43-4941-8b35-b1d0ea110908", 
        "maker": "SYS",
        "maker_size": "0.100",
        "taker": "LTC",
        "taker_size": "0.01",
        "updated_at": "2018-01-15T18:25:25.12345Z", 
        "created_at": "2018-01-15T18:15:32.12345Z", 
        "status": "filled"
      },
      {
        "id": "01639dfa-db96-440c-85bd-6d4feda8ace6", 
        "maker": "SYS",
        "maker_size": "0.100",
        "taker": "LTC",
        "taker_size": "0.01",
        "updated_at": "2018-01-15T18:25:52.12345Z", 
        "created_at": "2018-01-15T18:15:26.12345Z", 
        "status": "filled"
      }
    ]
    
    Parameter Type Description
    Array array An array of all orders with each order having the following parameters.
    id string The order GUID.
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    maker_address string Address for sending the outgoing token.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    taker_address string Address for receiving the incoming token.
    updated_at string ISO 8601 datetime, with microseconds, of the last time the order was updated.
    created_at string ISO 8601 datetime, with microseconds, of when the order was created.
    status string Order status: "created", "open", "pending", "filled", "cancelled"

    Sample 400 Response

    {
      "error": "Invalid order id",
      "code": 1021,
      "name": "dxGetMyOrders"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetMyOrders"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1021 400 Invalid order id
    1002 500 Internal server error

    dxGetOrderFills

    Sample Data

    {
      "maker": "SYS",
      "taker": "LTC",
      "combined": false
    }
    

    This call is used to retrieve all recent filled orders by a given trade pair.

    Request Parameters

    Sample Request

    blocknetdx-cli dxGetOrderFills SYS LTC false
    

    dxGetOrderFills [maker] [taker] [combined](optional)

    Parameter Type Description
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    combines boolean (Optional Parameter) Defaults to true.
    true: Receive filled orders for both the maker and taker tokens as specified, as well as the inverse with the maker token as the taker and the taker token as the maker.
    false: Receive filled orders only with the maker and taker tokens as specified.

    Response Parameters

    Sample 200 Response

    [
      {
        "id": "00a2afce-4754-443e-93d6-1f600501e3ac",
        "time": "2018-01-16T13:15:05.12345Z",
        "maker": "SYS",
        "maker_size": "101.00000000",
        "maker_txid": "f2b1ebf45b81da67171bfc55f34c20c9bbc55d8234b8f5c61d0965f61e3c3156",
        "taker": "LTC",
        "taker_size": "0.01000000",
        "taker_txid": "bcb7543c2f66777927899e701c8309be77904b9c0ef286791fb1a1813bb9099d",
        "block_id": "5036c0ac1a3e0337d3e51f37060e79cf3300cc02317bb5877d07412dd9f5c208"
      },
      {
        "id": "7de354c3-6c66-44e7-bf30-eaf942df5fcc",
        "time": "2018-01-16T13:15:05.12345Z",
        "maker": "LTC",
        "maker_size": "0.01000000",
        "maker_txid": "7d36aa270a9952f92e82eb23a8ccd25870430ba19f4dc469c9af4be3a9bd2026",
        "taker": "SYS",
        "taker_size": "101.00000000",
        "taker_txid": "c831c786b4d00f8688c37873b65223e4bca88a191497d5d149bdf00e4c55ed30",
        "block_id": "69a1f3bc5031e55800a37062d3c74c017cf233730e7c00813f5cbe7d9d7d0230"
      }
    ]
    
    Parameter Type Description
    Array array Array of orders sorted by date descending (most recent filled trade first).
    id string The order GUID.
    time string Time the order was filled.
    maker string Maker trading token; the token being sold by the maker.
    maker_size string(float) Maker trading size. String is used to preserve precision.
    maker_txid string Transaction ID of maker token on the token's network.
    taker string Taker trading token; the token being sold by the taker.
    taker_size string(float) Taker trading size. String is used to preserve precision.
    taker_txid string Transaction ID of taker token on the token's network.
    block_id string Blocknet block hash GUID at the time the order was filled.

    Sample 400 Response

    {
      "error": "Invalid maker symbol",
      "code": 1011,
      "name": "dxGetOrderFills"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetOrderFills"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1011 400 Invalid maker symbol
    1012 400 Invalid taker symbol
    1002 500 Internal server error

    dxGetOrderHistory

    Sample Data

    {
      "maker": "SYS",
      "taker": "LTC",
      "start_time": 15929405986,
      "end_time": 15929423986,
      "granularity": 3600
    }
    

    This call is used to retrieve all the filled trades by a trade pair within a specified time range.

    Request Parameters

    Sample Request

    blocknetdx-cli dxGetOrderHistory SYS LTC 15929405986 15929423986 3600
    

    dxGetOrderHistory [maker] [taker] [start_time] [end_time] [granularity] [order_ids](optional)

    Parameter Type Description
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    start_time int Start time(Unix time) representing the lower boundary to search.
    end_time int End time(Unix time) representing the upper boundary to search.
    granularity int Time interval slice in seconds:
    60, 300, 900, 3600, 21600, 86400
    order_ids bool (Optional Parameter) Defaults to false.
    true: Receive the GUIDs of all filled orders in each slice.
    false: Do not receive the order GUIDs.

    Response Parameters

    Sample 200 Response

    [
      //[ time, low, high, open, close, volume ],
      [ "2018-01-16T13:15:05.12345Z", 1.10, 2.0, 1.10, 1.4, 1000 ],
      [ "2018-01-16T14:15:05.12345Z", 1.10, 2.1, 1.10, 1.4, 1000 ],
      [ "2018-01-16T15:15:05.12345Z", 1.12, 2.2, 1.10, 1.4, 1000 ],
      [ "2018-01-16T16:15:05.12345Z", 1.14, 2.0, 1.10, 1.4, 1000 ],
      [ "2018-01-16T17:15:05.12345Z", 1.15, 2.0, 1.10, 1.4, 1000 ]
    ]
    
    Parameter Type Description
    time string ISO 8601 datetime, with microseconds, of the time at the beginning of the time slice.
    low float64 Exchange rate lower bound within the time slice.
    high float64 Exchange rate upper bound within the time slice.
    open float64 Exchange rate of first filled order at the beginning of the time slice.
    close float64 Exchange rate of last filled order at the end of the time slice.
    volume int64 Total volume of the taker token within the time slice.
    order_ids array Array of GUIDs of all filled orders within the time slice.

    Sample 400 Response

    {
      "error": "Invalid maker symbol",
      "code": 1011,
      "name": "dxGetOrderHistory"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetOrderHistory"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1004 400 Bad request
    1011 400 Invalid maker symbol
    1012 400 Invalid taker symbol
    1016 400 Invalid time
    1002 500 Internal server error

    dxGetLocalTokens

    This call is used to retrieve all the tokens supported by the local client.

    Request Parameters

    Request

    blocknetdx-cli dxGetLocalTokens
    

    dxGetLocalTokens

    This call does not take parameters.

    Response Parameters

    Sample 200 Response

    [
      "LTC",
      "SYS",
      "MONA",
      "BLOCK"
    ]
    
    Parameter Type Description
    Array array An array of all the tokens supported by the local client.

    Sample 400 Response

    {
      "error": "Bad request",
      "code": 1004,
      "name": "dxGetLocalTokens"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetLocalTokens"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1004 400 Bad request
    1002 500 Internal server error

    dxGetNetworkTokens

    This call is used to retrieve all the tokens supported by the network.

    Request Parameters

    Request

    blocknetdx-cli dxGetNetworkTokens
    

    dxGetNetworkTokens

    This call does not take parameters.

    Response Parameters

    Sample 200 Response

    [
      "LTC",
      "SYS",
      "MONA",
      "BLOCK"
    ]
    
    Parameter Type Description
    Array array An array of all the tokens supported by the network.

    Sample 400 Response

    {
      "error": "Bad request",
      "code": 1004,
      "name": "dxGetNetworkTokens"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetNetworkTokens"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1004 400 Bad request
    1002 500 Internal server error

    dxGetTokenBalances

    This call is used to retrieve the balances for all connected wallets on the local client.

    Request Parameters

    Request

    blocknetdx-cli dxGetTokenBalances
    

    dxGetTokenBalances

    This call does not take parameters.

    Response Parameters

    Sample 200 Response

    {
      "LTC": "0.568942",
      "SYS": "1050.128493",
      "MONA": "3.452",
      "BLOCK": "250.83492174"
    }
    
    Parameter Type Description
    Object map Map structure of the tokens and respective balances.
    - key string The token symbol.
    - value string(float) The wallet balance amount. String is used to preserve precision.

    Sample 400 Response

    {
      "error": "Bad request",
      "code": 1004,
      "name": "dxGetTokenBalances"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetTokenBalances"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1004 400 Bad request
    1002 500 Internal server error

    dxGetOrderBook

    Sample Data

    {
      "detail": 1,
      "maker": "LTC",
      "taker": "SYS",
      "max_orders": 100
    }
    

    This call is used to retrieve open orders at various detail levels:
    Detail 1 - Retrieves the best bid and ask.
    Detail 2 - Retrieves a list of aggregated orders. This is useful for charting.
    Detail 3 - Retrieves a list of non-aggregated orders. This is useful for bot trading.
    Detail 4 - Retrieves the best bid and ask with the order GUIDs.

    Request Parameters

    Sample Request

    blocknetdx-cli dxGetOrderBook 1 LTC SYS 100
    

    dxGetOrderBook [detail] [maker] [taker] [max_orders](optional)

    Parameter Type Description
    detail int Detail level: 1, 2, 3, 4
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    max_orders int (Optional Parameter) Defaults to 50.

    Response Parameters

    Sample 200 Response (Detail 1)

    {
      "detail": 1,
      "maker": "LTC",
      "taker": "SYS",
      "bids": [
        //[ price, size, order_count ],
        [ "253", "15", 1 ],
      ],
      "asks": [
        //[ price, size, order_count ],
        [ "253.01", "15", 4 ],
      ]
    }
    


    Detail 1
    Retrieves the best bid and ask.

    Parameter Type Description
    detail int Detail level: 1
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    bids Array An array of the best bids.
    - price string(float) The highest bid price for the token. String is used to preserve precision.
    - size string(float) The size of bid orders at this price. String is used to preserve precision.
    - order_count int The total bid orders at this price.
    asks Array An array of the best asks.
    - price string(float) The lowest ask price for the token. String is used to preserve precision.
    - size string(float) The size of ask orders at this price. String is used to preserve precision.
    - order_count int The total ask orders at this price.

    Sample 200 Response (Detail 2)

    {
      "detail": 2,
      "maker": "LTC",
      "taker": "SYS",
      "bids": [
        //[ price, size, order_count ],
        [ "253.00", "15.00", 10 ],
        [ "253.00", "15.01", 3 ],
      ],
      "asks": [
        //[ price, size, order_count ],
        [ "254.15", "15.01", 1 ],
        [ "254.16", "15.02", 2 ],
      ]
    }
    


    Detail 2
    Retrieves a list of aggregated orders. This is useful for charting.

    Parameter Type Description
    detail int Detail level: 2
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    bids Array An array of bids.
    - price string(float) The bid price for the token. String is used to preserve precision.
    - size string(float) The size of bid orders at this price. String is used to preserve precision.
    - order_count int The total bid orders at this price.
    asks Array An array of asks.
    - price string(float) The ask price for the token. String is used to preserve precision.
    - size string(float) The size of ask orders at this price. String is used to preserve precision.
    - order_count int The total ask orders at this price.

    Sample 200 Response (Detail 3)

    {
      "detail": 3,
      "maker": "LTC",
      "taker": "SYS",
      "bids": [
        //[ price, size, order_id ],
        [ "253.00", "15.00", "d1ebd0b8-5398-4278-8e20-d480ac1d5869" ],
        [ "253.00", "15.01", "120cb23f-bf62-47fb-abcc-d9a2909ef0cd" ],
      ],
      "asks": [
        //[ price, size, order_id ],
        [ "254.15", "15.01", "d93b735b-ae1b-4ac6-b96b-d92966dd6ea1" ],
        [ "254.16", "15.02", "32f5a551-3da6-4ff0-8ae6-0b60535c5237" ],
      ]
    }
    


    Detail 3
    Retrieves a list of non-aggregated orders. This is useful for bot trading.

    Parameter Type Description
    detail int Detail level: 3
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    bids Array An array of bids.
    - price string(float) The highest bid price for the token. String is used to preserve precision.
    - size string(float) The size of the bid order. String is used to preserve precision.
    - order_id string The GUID of the bid order.
    asks Array An array of asks.
    - price string(float) The lowest ask price for the token. String is used to preserve precision.
    - size string(float) The size of the ask order. String is used to preserve precision.
    - order_id string The GUID of the ask order.

    Sample 200 Response (Detail 4)

    {
      "detail": 4,
      "maker": "LTC",
      "taker": "SYS",
      "bids": [
        //[ price, size, [order_ids] ],
        [ "253.00", "15", ["d1ebd0b8-5398-4278-8e20-d480ac1d5869"] ],
      ],
      "asks": [
        //[ price, size, [order_ids] ],
        [ "254.00", "15", ["32f5a551-3da6-4ff0-8ae6-0b60535c5237"] ],
      ]
    }
    


    Detail 4
    Retrieves the best bid and ask with the order GUIDs.

    Parameter Type Description
    detail int Detail level: 4
    maker string Maker trading token; the token being sold by the maker.
    taker string Taker trading token; the token being sold by the taker.
    bids Array An array of the best bids.
    - price string(float) The highest bid price for the token. String is used to preserve precision.
    - size string(float) The size of bid orders at this price. String is used to preserve precision.
    - order_ids Array An array of GUID for bid orders at this price.
    asks Array An array of the best asks.
    - price string(float) The lowest ask price for the token. String is used to preserve precision.
    - size string(float) The size of ask orders at this price. String is used to preserve precision.
    - order_ids Array An array of GUID for ask orders at this price.

    Sample 400 Response

    {
      "error": "Invalid detail level",
      "code": 1015,
      "name": "dxGetOrderBook"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function

    Sample 500 Response

    {
      "error": "Internal error occurred",
      "code": 1002,
      "name": "dxGetOrderBook"
    }
    
    Parameter Type Description
    error string Error message
    code int Error code
    name string Name of the RPC function
    Code Type Error
    1001 401 Unauthorized
    1004 400 Bad request
    1011 400 Invalid maker symbol
    1012 400 Invalid taker symbol
    1015 400 Invalid detail level
    1002 500 Internal server error

    Error Codes

    The Blocknet API uses the following error codes:

    Code Type Error
    1004 400 Bad request
    1011 400 Invalid maker symbol
    1012 400 Invalid taker symbol
    1015 400 Invalid detail level
    1016 400 Invalid time
    1021 400 Invalid order id
    1026 400 Bad maker address
    1026 400 Bad taker address
    1029 400 Not an exchange node
    1024 400 Size must be greater than 0
    1001 401 Unauthorized
    1002 500 Internal server error
    cli