NAV Navbar
shell javascript
  • Introduction
  • Litecoind-adapter
  • Bitcoind-adapter
  • Lnd-adapter
  • Errors
  • Introduction

    Below is the documentation for each of the CoinMesh adapters.

    Litecoind-adapter

    List Addresses

    curl -X POST
      -d '{
          "minConfirmations": 0,
          "includeEmpty": true,
          "includeWatchOnly": false
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/addresses/listaddresses"
    
    const addressesService = require('@coinmesh/litecoind-adapter').addressesService;
    
    addressesService.listReceivedByAddress(0, true, false).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    { "result":
      [
        {
          "address": "mfh71i1bbXSoWsPeQ1Sqpy3ivy2zmtfng3",
          "account": "",
          "amount": 0.1,
          "confirmations": 1,
          "label": "",
          "txids": [
            "f4ea8e9cbcf891bdafc2fc4e3c9b15c3edfb6b83d5a9ecf62b0dba592d3202fe"
          ]
        }
      ],
      "error": null,
      "id": "listreceivedbyaddress"
    }
    

    This endpoint retrieves all addresses that have been the receiving address in a transaction in this wallet.

    HTTP Request

    POST http://localhost:3009/v0/addresses/listaddresses

    Query Parameters

    Parameter Default Description
    minConfirmations 0 Minimum number of confirmations to include
    includeEmpty true Whether or not empty addresses should be returned (zero balance)
    includeWatchOnly false Include addresses which are only being watched

    Get a new Receive Address

    curl "http://localhost:3009/v0/addresses/getnewaddress/?:account_name"
    
    const addressesService = require('@coinmesh/litecoind-adapter').addressesService;
    
    const addressType = 'bech32';
    
    addressesService.getNewAddress(addressType).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
      "error": null,
      "id": "getnewaddress"
    }
    

    This endpoint retrieves a new address that the wallet can receive coins on.

    HTTP Request

    http://localhost:3009/v0/addresses/getnewaddress/?:address_type

    URL Parameters

    Parameter Default Description
    address_type bech32 Type of address to generate.

    Get Received By Address

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "minConfirmations": 1
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/addresses/getreceivedbyaddress"
    
    const addressesService = require('@coinmesh/litecoind-adapter').addressesService;
    
    addressesService.getReceivedByAddress("moM8EywChNZqcSJmnikNKaScMyw9thwDwi", 1).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result":0,
      "error":null,
      "id":"getreceivedbyaddress"
    }
    

    This endpoint looks up addresses in the wallet (including watch-only) for the amount of received coins.

    HTTP Request

    POST http://localhost:3009/v0/addresses/getreceivedbyaddress

    Query Parameters

    Parameter Default Description
    address null The address to look up received amount.
    minConfirmations null The minimum number of confirmations to assume the balance.

    Send to an Address

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "amount": 0.1
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/addresses/sendtoaddress"
    
    const addressesService = require('@coinmesh/litecoind-adapter').addressesService;
    
    addressesService.sendToAddress("moM8EywChNZqcSJmnikNKaScMyw9thwDwi", 0.1).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": "fc6c5a8e81ea9cef9abb9c67e7d261ee827c34f4ce15cd86f112cbb33d058a75",
      "error": null,
      "id": "sendtoaddress"
    }
    

    This endpoint sends creates and broadcasts a transaction that sends the supplied address.

    HTTP Request

    POST http://localhost:3009/v0/addresses/sendtoaddress

    Query Parameters

    Parameter Default Description
    address null The address to the send the coins to.
    amount null The amount of coins to send

    Get Balance Info

    curl "http://localhost:3009/v0/balances/"
    
    const balancesService = require('@coinmesh/litecoind-adapter').balancesService;
    
    balancesService.getBalance().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": 12936.99252,
      "error": null,
      "id": "getbalance"
    }
    

    This endpoint retrieves the balance of the wallet.

    HTTP Request

    http://localhost:3009/v0/balances

    Parameter Description
    none none

    Get Block Info

    curl "http://localhost:3009/v0/blocks/:hash/info"
    
    const blocksService = require('@coinmesh/litecoind-adapter').blocksService;
    
    let hash = 'f202e9cfb5d40328a4b471b4f1d752bc8b560e3c9f32382968fffb32c1d04a39';
    blocksService.getBlock(hash).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": {
        "hash": "e920f6a888352250bdfdc164fd10849e6d3ece079ec06849ac2e98d5339ddcc9",
        "confirmations": 1,
        "strippedsize": 228,
        "size": 264,
        "weight": 948,
        "height": 967,
        "version": 536870912,
        "versionHex": "20000000",
        "merkleroot": "1c6b256351f23d7c36c851b16a4b86ac18305ec3f100c500ebf8f4b34f089c74",
        "tx": [ "1c6b256351f23d7c36c851b16a4b86ac18305ec3f100c500ebf8f4b34f089c74" ],
        "time": 1534798346,
        "mediantime": 1534798345,
        "nonce": 5,
        "bits": "207fffff",
        "difficulty": 4.656542373906925e-10,
        "chainwork": "0000000000000000000000000000000000000000000000000000000000000790",
        "previousblockhash": "1a8b43aaf7a318cba08109aa815afd538581b7bde41cbbf7a0cbd4088d47ddba"
      },
      "error": null,
      "id": "getblock"
    }
    

    This endpoint retrieves the information about a block.

    HTTP Request

    http://localhost:3009/v0/blocks/:hash/info

    Url Parameters

    Parameter Description
    hash Hash of a block that is known by the node.

    Get Current Block Height of Chain

    curl "http://localhost:3009/v0/blocks/height"
    
    const blocksService = require('@coinmesh/litecoind-adapter').blocksService;
    
    blocksService.getChainHeight().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": 972,
      "error": null,
      "id": "getblockcount"
    }
    

    This endpoint retrieves the information about a block.

    HTTP Request

    http://localhost:3009/v0/blocks/height

    Parameter Description
    none none

    Generate Blocks (regtest mode only)

    curl "http://localhost:3009/v0/blocks/generate/:num_of_blocks"
    
    const blocksService = require('@coinmesh/litecoind-adapter').blocksService;
    
    blocksService.generate(5).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": [
        "9282eaa85b0c9591ade5a64d88b541971e604bb4902d231bf04441634c2d549b",
        "49efce51c4a2c8c4b539ce490ffe2b672a5c9f13829d690a04e789711d002880",
        "b4652422d5ea82365b1eebfdc13127a2a154ba1d79f224148346c3db057232e4",
        "eba31d82278f875ceecf010db5a81fda91c1b91be21f0a97ca3d3578f1e00492",
        "5b8c3a82fa46e601bc7d4cce733809ee5d6c285aacdc1e2a37acfb9a74c415cb"
      ],
      "error": null,
      "id": "generate"
    }
    

    This endpoint generates additional blocks. This only works in regtest mode!

    HTTP Request

    http://localhost:3009/v0/blocks/generate/:num_of_blocks

    Url Parameters

    Parameter Description
    num_of_blocks Number of new blocks to generate

    Sign Message

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "message": "Hello word"
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/crypto/sign"
    
    const cryptoService = require('@coinmesh/litecoind-adapter').cryptoService;
    
    let address = 'moM8EywChNZqcSJmnikNKaScMyw9thwDwi';
    let message = 'Hello word';
    
    cryptoService.signMessage(address, message).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": "IMB0g6YJEawYtYefPV9rZcuK/EjrSexuYNQ0SqikbZTqaUr4W1b78+CKRMd1UHYQKoKmgGw1B3UdgYyx7wJ03QA=",
      "error": null,
      "id": "signmessage"
    }
    

    This endpoint returns a message signed by wallet for a specified address.

    HTTP Request

    POST http://localhost:3009/v0/crypto/sign

    Query Parameters

    Parameter Default Description
    address none The address whose private key will be used to sign the message
    message none The message to sign

    Verify Message

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "signature": "IMB0g6YJEawYtYefPV9rZcuK",
          "message": "Hello word"
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/crypto/sign"
    
    const cryptoService = require('@coinmesh/litecoind-adapter').cryptoService;
    
    let address = 'moM8EywChNZqcSJmnikNKaScMyw9thwDwi';
    let signature = 'IMB0g6YJEawYtYefPV9rZcuK';
    let message = 'Hello word';
    
    cryptoService.signMessage(address, message).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": true,
      "error": null,
      "id": "verifymessage" }
    

    This endpoint returns a message signed by wallet for a specified address.

    HTTP Request

    POST http://localhost:3009/v0/crypto/verify

    Query Parameters

    Parameter Default Description
    address none The address whose key will be used to validate the message
    signature none The signature to verify
    message none The message to verify

    Get the current exchange rate

    curl "http://localhost:3009/v0/exchange-rates/:pair/current_rate"
    
    const exchangeRatesService = require('@coinmesh/litecoind-adapter').exchangeRatesService;
    
    exchangeRatesService.getExchangeRate('ltcusd').then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "high": "58.59",
      "last": "55.81",
      "timestamp": "1534800601",
      "bid": "55.80",
      "vwap": "56.32",
      "volume": "20266.31083135",
      "low": "54.78",
      "ask": "55.92",
      "open": "57.95"
    }
    

    This endpoint retrieves the latest exchange rate from bitstamp.

    HTTP Request

    http://localhost:3009/v0/exchange-rates/:pair/current_rate

    URL Parameters

    Parameter Description
    pair A currency pair supported by bitstamp.

    Get Network Info

    curl "http://localhost:3009/v0/network-info"
    
    const networkInfoService = require('@coinmesh/litecoind-adapter').networkInfoService;
    
    networkInfoService.getNetworkInfo().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": {
        "version": 150100,
        "subversion": "/LitecoinCore:0.17.0/",
        "protocolversion": 70015,
        "localservices": "000000000000000d",
        "localrelay": true,
        "timeoffset": 0,
        "networkactive": true,
        "connections": 0,
        "networks": [
          {
            "name": "ipv4",
            "limited": false,
            "reachable": true,
            "proxy": "",
            "proxy_randomize_credentials": false
          }
        ],
        "relayfee": 0.00001,
        "incrementalfee": 0.00001,
        "localaddresses": [],
        "warnings": ""
      },
      "error": null,
      "id": "getnetworkinfo"
    }
    

    This endpoint retrieves the current network information for the node.

    HTTP Request

    http://localhost:3009/v0/network-info

    URL Parameters

    Parameter Description
    none none

    Get Peer Info

    curl "http://localhost:3009/v0/peers/getpeerinfo"
    
    const peersService = require('@coinmesh/litecoind-adapter').peersService;
    
    peersService.getPeerInfo().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": [],
      "error": null,
      "id": "getpeerinfo"
    }
    

    This endpoint retrieves information about the peers the node is currently connected to.

    HTTP Request

    http://localhost:3009/v0/peers/getpeerinfo

    URL Parameters

    Parameter Description
    none none

    Get Recent Transactions

    curl "http://localhost:3009/v0/transactions"
    
    const transactionsService = require('@coinmesh/litecoind-adapter').transactionsService;
    
    transactionsService.getTransactions().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": [
        {
          "account": "",
          "address": "mx4vtMBLn2mMUq6HnZQDCmr7ZwXaW73ni1",
          "category": "immature",
          "amount": 0.00076293,
          "vout": 0,
          "confirmations": 8,
          "generated": true,
          "blockhash": "665a25b74e321ea123f61b58db50b3ee018a77ad23bd36762a3ca1c0f34a5baf",
          "blockindex": 0,
          "blocktime": 1534801960,
          "txid": "26ecd89229badd6ad337337ff2c3ff11e55cbaa3e6960297267d62ad0c0e47e7",
          "walletconflicts": [],
          "time": 1534801936,
          "timereceived": 1534801936,
          "bip125-replaceable": "no"
        },
      ],
      "error": null,
      "id": "listtransactions"
    }
    

    This endpoint retrieves the recent transactions that have been made to or from the node.

    HTTP Request

    http://localhost:3009/v0/transactions

    URL Parameters

    Parameter Description
    none none

    Get Wallet Info

    curl "http://localhost:3009/v0/wallet-info"
    
    const walletInfoService = require('@coinmesh/litecoind-adapter').walletInfoService;
    
    walletInfoService.getTransactions().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "error": null,
      "id": "getwalletinfo",
      "result": {
        "balance": 14947.23096741,
        "hdmasterkeyid": "fef59a7b971dbc208322e56075a99b973b623443",
        "immature_balance": 0.04680321,
        "keypoololdest": 1534784895,
        "keypoolsize": 999,
        "keypoolsize_hd_internal": 1000,
        "paytxfee": 0,
        "txcount": 2970,
        "unconfirmed_balance": 0,
        "walletname": "wallet.dat",
        "walletversion": 139900
      }
    }
    

    This endpoint retrieves the information about the wallet.

    HTTP Request

    http://localhost:3009/v0/wallet-info

    URL Parameters

    Parameter Description
    none none

    Bitcoind-adapter

    List Addresses

    curl -X POST
      -d '{
          "minConfirmations": 0,
          "includeEmpty": true,
          "includeWatchOnly": false
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/addresses/listaddresses"
    
    const addressesService = require('@coinmesh/bitcoind-adapter').addressesService;
    
    addressesService.listReceivedByAddress(0, true, false).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    { "result":
      [
        {
          "address": "mfh71i1bbXSoWsPeQ1Sqpy3ivy2zmtfng3",
          "account": "",
          "amount": 0.1,
          "confirmations": 1,
          "label": "",
          "txids": [
            "f4ea8e9cbcf891bdafc2fc4e3c9b15c3edfb6b83d5a9ecf62b0dba592d3202fe"
          ]
        }
      ],
      "error": null,
      "id": "listreceivedbyaddress"
    }
    

    This endpoint retrieves all addresses that have been the receiving address in a transaction in this wallet.

    HTTP Request

    POST http://localhost:3009/v0/addresses/listaddresses

    Query Parameters

    Parameter Default Description
    minConfirmations 0 Minimum number of confirmations to include
    includeEmpty true Whether or not empty addresses should be returned (zero balance)
    includeWatchOnly false Include addresses which are only being watched

    Get a new Receive Address

    curl "http://localhost:3009/v0/addresses/getnewaddress/?:account_name"
    
    const addressesService = require('@coinmesh/bitcoindd-adapter').addressesService;
    
    const addressType = 'bech32';
    
    addressesService.getNewAddress(addressType).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
      "error": null,
      "id": "getnewaddress"
    }
    

    This endpoint retrieves a new address that the wallet can receive coins on.

    HTTP Request

    http://localhost:3009/v0/addresses/getnewaddress/?:account_name

    URL Parameters

    Parameter Default Description
    account_name bech32 Optional account name to use

    Get Received By Address

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "minConfirmations": 1
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/addresses/getreceivedbyaddress"
    
    const addressesService = require('@coinmesh/bitcoind-adapter').addressesService;
    
    addressesService.getReceivedByAddress("moM8EywChNZqcSJmnikNKaScMyw9thwDwi", 1).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result":0,
      "error":null,
      "id":"getreceivedbyaddress"
    }
    

    This endpoint looks up addresses in the wallet (including watch-only) for the amount of received coins.

    HTTP Request

    POST http://localhost:3009/v0/addresses/getreceivedbyaddress

    Query Parameters

    Parameter Default Description
    address null The address to look up received amount.
    minConfirmations null The minimum number of confirmations to assume the balance.

    Send to an Address

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "amount": 0.1
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/addresses/sendtoaddress"
    
    const addressesService = require('@coinmesh/bitcoind-adapter').addressesService;
    
    addressesService.sendToAddress("moM8EywChNZqcSJmnikNKaScMyw9thwDwi", 0.1).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": "fc6c5a8e81ea9cef9abb9c67e7d261ee827c34f4ce15cd86f112cbb33d058a75",
      "error": null,
      "id": "sendtoaddress"
    }
    

    This endpoint sends creates and broadcasts a transaction that sends the supplied address.

    HTTP Request

    POST http://localhost:3009/v0/addresses/sendtoaddress

    Query Parameters

    Parameter Default Description
    address null The address to the send the coins to.
    amount null The amount of coins to send

    Get Balance Info

    curl "http://localhost:3009/v0/balances/"
    
    const balancesService = require('@coinmesh/bitcoind-adapter').balancesService;
    
    balancesService.getBalance().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": 12936.99252,
      "error": null,
      "id": "getbalance"
    }
    

    This endpoint retrieves the balance of the wallet.

    HTTP Request

    http://localhost:3009/v0/balances

    Parameter Description
    none none

    Get Block Info

    curl "http://localhost:3009/v0/blocks/:hash/info"
    
    const blocksService = require('@coinmesh/bitcoind-adapter').blocksService;
    
    let hash = 'f202e9cfb5d40328a4b471b4f1d752bc8b560e3c9f32382968fffb32c1d04a39';
    blocksService.getBlock(hash).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": {
        "hash": "e920f6a888352250bdfdc164fd10849e6d3ece079ec06849ac2e98d5339ddcc9",
        "confirmations": 1,
        "strippedsize": 228,
        "size": 264,
        "weight": 948,
        "height": 967,
        "version": 536870912,
        "versionHex": "20000000",
        "merkleroot": "1c6b256351f23d7c36c851b16a4b86ac18305ec3f100c500ebf8f4b34f089c74",
        "tx": [ "1c6b256351f23d7c36c851b16a4b86ac18305ec3f100c500ebf8f4b34f089c74" ],
        "time": 1534798346,
        "mediantime": 1534798345,
        "nonce": 5,
        "bits": "207fffff",
        "difficulty": 4.656542373906925e-10,
        "chainwork": "0000000000000000000000000000000000000000000000000000000000000790",
        "previousblockhash": "1a8b43aaf7a318cba08109aa815afd538581b7bde41cbbf7a0cbd4088d47ddba"
      },
      "error": null,
      "id": "getblock"
    }
    

    This endpoint retrieves the information about a block.

    HTTP Request

    http://localhost:3009/v0/blocks/:hash/info

    Url Parameters

    Parameter Description
    hash Hash of a block that is known by the node.

    Get Current Block Height of Chain

    curl "http://localhost:3009/v0/blocks/height"
    
    const blocksService = require('@coinmesh/bitcoind-adapter').blocksService;
    
    blocksService.getChainHeight().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": 972,
      "error": null,
      "id": "getblockcount"
    }
    

    This endpoint retrieves the information about a block.

    HTTP Request

    http://localhost:3009/v0/blocks/height

    Parameter Description
    none none

    Generate Blocks (regtest mode only)

    curl "http://localhost:3009/v0/blocks/generate/:num_of_blocks"
    
    const blocksService = require('@coinmesh/bitcoind-adapter').blocksService;
    
    blocksService.generate(5).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": [
        "9282eaa85b0c9591ade5a64d88b541971e604bb4902d231bf04441634c2d549b",
        "49efce51c4a2c8c4b539ce490ffe2b672a5c9f13829d690a04e789711d002880",
        "b4652422d5ea82365b1eebfdc13127a2a154ba1d79f224148346c3db057232e4",
        "eba31d82278f875ceecf010db5a81fda91c1b91be21f0a97ca3d3578f1e00492",
        "5b8c3a82fa46e601bc7d4cce733809ee5d6c285aacdc1e2a37acfb9a74c415cb"
      ],
      "error": null,
      "id": "generate"
    }
    

    This endpoint generates additional blocks. This only works in regtest mode!

    HTTP Request

    http://localhost:3009/v0/blocks/generate/:num_of_blocks

    Url Parameters

    Parameter Description
    num_of_blocks Number of new blocks to generate

    Sign Message

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "message": "Hello word"
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/crypto/sign"
    
    const cryptoService = require('@coinmesh/bitcoind-adapter').cryptoService;
    
    let address = 'moM8EywChNZqcSJmnikNKaScMyw9thwDwi';
    let message = 'Hello word';
    
    cryptoService.signMessage(address, message).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": "IMB0g6YJEawYtYefPV9rZcuK/EjrSexuYNQ0SqikbZTqaUr4W1b78+CKRMd1UHYQKoKmgGw1B3UdgYyx7wJ03QA=",
      "error": null,
      "id": "signmessage"
    }
    

    This endpoint returns a message signed by wallet for a specified address.

    HTTP Request

    POST http://localhost:3009/v0/crypto/sign

    Query Parameters

    Parameter Default Description
    address none The address whose private key will be used to sign the message
    message none The message to sign

    Verify Message

    curl -X POST
      -d '{
          "address": "moM8EywChNZqcSJmnikNKaScMyw9thwDwi",
          "signature": "IMB0g6YJEawYtYefPV9rZcuK",
          "message": "Hello word"
        }'
      -H "Content-Type: application/json"
      "http://localhost:3009/v0/crypto/sign"
    
    const cryptoService = require('@coinmesh/bitcoind-adapter').cryptoService;
    
    let address = 'moM8EywChNZqcSJmnikNKaScMyw9thwDwi';
    let signature = 'IMB0g6YJEawYtYefPV9rZcuK';
    let message = 'Hello word';
    
    cryptoService.signMessage(address, message).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": true,
      "error": null,
      "id": "verifymessage" }
    

    This endpoint returns a message signed by wallet for a specified address.

    HTTP Request

    POST http://localhost:3009/v0/crypto/verify

    Query Parameters

    Parameter Default Description
    address none The address whose key will be used to validate the message
    signature none The signature to verify
    message none The message to verify

    Get the current exchange rate

    curl "http://localhost:3009/v0/exchange-rates/:pair/current_rate"
    
    const exchangeRatesService = require('@coinmesh/bitcoind-adapter').exchangeRatesService;
    
    exchangeRatesService.getExchangeRate('btcusd').then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "high": "58.59",
      "last": "55.81",
      "timestamp": "1534800601",
      "bid": "55.80",
      "vwap": "56.32",
      "volume": "20266.31083135",
      "low": "54.78",
      "ask": "55.92",
      "open": "57.95"
    }
    

    This endpoint retrieves the latest exchange rate from bitstamp.

    HTTP Request

    http://localhost:3009/v0/exchange-rates/:pair/current_rate

    URL Parameters

    Parameter Description
    pair A currency pair supported by bitstamp.

    Get Network Info

    curl "http://localhost:3009/v0/network-info"
    
    const networkInfoService = require('@coinmesh/bitcoin-adapter').networkInfoService;
    
    networkInfoService.getNetworkInfo().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": {
        "version": 150100,
        "subversion": "/BitcoinCore:0.17.0/",
        "protocolversion": 70015,
        "localservices": "000000000000000d",
        "localrelay": true,
        "timeoffset": 0,
        "networkactive": true,
        "connections": 0,
        "networks": [
          {
            "name": "ipv4",
            "limited": false,
            "reachable": true,
            "proxy": "",
            "proxy_randomize_credentials": false
          }
        ],
        "relayfee": 0.00001,
        "incrementalfee": 0.00001,
        "localaddresses": [],
        "warnings": ""
      },
      "error": null,
      "id": "getnetworkinfo"
    }
    

    This endpoint retrieves the current network information for the node.

    HTTP Request

    http://localhost:3009/v0/network-info

    URL Parameters

    Parameter Description
    none none

    Get Peer Info

    curl "http://localhost:3009/v0/peers/getpeerinfo"
    
    const peersService = require('@coinmesh/Bitcoind-adapter').peersService;
    
    peersService.getPeerInfo().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": [],
      "error": null,
      "id": "getpeerinfo"
    }
    

    This endpoint retrieves information about the peers the node is currently connected to.

    HTTP Request

    http://localhost:3009/v0/peers/getpeerinfo

    URL Parameters

    Parameter Description
    none none

    Get Recent Transactions

    curl "http://localhost:3009/v0/transactions"
    
    const transactionsService = require('@coinmesh/bitcoind-adapter').transactionsService;
    
    transactionsService.getTransactions().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "result": [
        {
          "account": "",
          "address": "mx4vtMBLn2mMUq6HnZQDCmr7ZwXaW73ni1",
          "category": "immature",
          "amount": 0.00076293,
          "vout": 0,
          "confirmations": 8,
          "generated": true,
          "blockhash": "665a25b74e321ea123f61b58db50b3ee018a77ad23bd36762a3ca1c0f34a5baf",
          "blockindex": 0,
          "blocktime": 1534801960,
          "txid": "26ecd89229badd6ad337337ff2c3ff11e55cbaa3e6960297267d62ad0c0e47e7",
          "walletconflicts": [],
          "time": 1534801936,
          "timereceived": 1534801936,
          "bip125-replaceable": "no"
        },
      ],
      "error": null,
      "id": "listtransactions"
    }
    

    This endpoint retrieves the recent transactions that have been made to or from the node.

    HTTP Request

    http://localhost:3009/v0/transactions

    URL Parameters

    Parameter Description
    none none

    Get Wallet Info

    curl "http://localhost:3009/v0/wallet-info"
    
    const walletInfoService = require('@coinmesh/bitcoind-adapter').walletInfoService;
    
    walletInfoService.getTransactions().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "error": null,
      "id": "getwalletinfo",
      "result": {
        "balance": 14947.23096741,
        "hdmasterkeyid": "fef59a7b971dbc208322e56075a99b973b623443",
        "immature_balance": 0.04680321,
        "keypoololdest": 1534784895,
        "keypoolsize": 999,
        "keypoolsize_hd_internal": 1000,
        "paytxfee": 0,
        "txcount": 2970,
        "unconfirmed_balance": 0,
        "walletname": "wallet.dat",
        "walletversion": 139900
      }
    }
    

    This endpoint retrieves the information about the wallet.

    HTTP Request

    http://localhost:3009/v0/wallet-info

    URL Parameters

    Parameter Description
    none none

    Lnd-adapter

    The lnd-adapter is a wrapper project on top of @AlexBosworth 's ln-service. It is currently available thanks to his tireless work on maintaining and improving it.

    The differences in what is exported from this adapter is that the service is instantiated and the methods are available grouped on services to provide the common API layer for CoinMesh.

    When using the REST interface you will need to supply a basic authentication token as show here -

    const username = 'rpcuser';
    const password = 'rpcpassword';
    let token = btoa(`${username}:${password}`);
    

    The token will be used below in the curl examples

    Create Address

    curl -X POST
      -d '{
          "format": "np2wpkh"
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/addresses/"
    
    const addressesService = require('@coinmesh/lnd-adapter').addressesService;
    
    addressesService.getNewAddress('np2wpkh').then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "address": "2NEWwwQ959SLvZsWhaVYuUoEvQG9LxbJSU2",
      "type": "chain_address"
    }
    

    This endpoint retrieves a new address created in the wallet.

    HTTP Request

    POST http://localhost:3098/v0/addresses/

    Body Parameters

    Parameter Default Description
    format np2wkh Format of the address to return

    Send To Chain Address

    curl -X POST
      -d '{
          "address": "{{address}}",
          "tokens": 20000
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/transactions/"
    
    const addressesService = require('@coinmesh/lnd-adapter').addressesService;
    
    const address = `${address}`;
    const amount = 20000; // satoshis
    
    addressesService.sendToAddress(address, amount).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "txid": "{{transaction id}}"
    }
    

    This endpoint sends coins from this wallet to an address on chain.

    HTTP Request

    POST http://localhost:3098/v0/transactions/

    Body Parameters

    Parameter Default Description
    address null Address to send coins to
    tokens null number of tokens to send, in satoshis

    Get Chain Balance

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/balance/"
    
    const balancesService = require('@coinmesh/lnd-adapter').balancesService;
    
    balancesService.getChainBalance().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "chain_balance": 5000000000,
      "channel_balance": 0,
      "pending_chain_balance": 0,
      "pending_channel_balance": 0,
      "type":"balances"
    }
    

    This endpoint returns the chain and channel balances.

    HTTP Request

    GET http://localhost:3098/v0/balance/

    Body Parameters

    None

    Get Connections

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/connections/"
    
    const balancesService = require('@coinmesh/lnd-adapter').balancesService;
    
    balancesService.getChainBalance().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "connections": [{
        "channels": [{
          "id": "<Channel Id String>",
          "is_active": "<Channel Active Bool>",
          "is_closing": "<Channel Closing Bool>",
          "is_opening": "<Channel Opening Bool>",
          "local_balance": "<Local Balance Satoshis Number>",
          "received": "<Received Satoshis Number>",
          "remote_balance": "<Remote Balance Satoshis Number>",
          "sent": "<Sent Satoshis Number>",
          "transaction_id": "<Blockchain Transaction Id>",
          "transaction_vout": "<Blockchain Transaction Vout Number>",
          "transfers_count": "<Channel Transfers Total Number>",
          "unsettled_balance": "<Unsettled Balance Satoshis Number>"
        }],
        "peers": [{
          "bytes_received": "<Bytes Received Number>",
          "bytes_sent": "<Bytes Sent Number>",
          "network_address": "<Network Address String>",
          "ping_time": "<Milliseconds Number>",
          "tokens_received": "<Amount Received Satoshis Number>",
          "tokens_sent": "<Amount Sent Satoshis Number>"
        }],
        "public_key": "<Public Key String>",
        "type": "<Type String>"
      }]
    }
    

    This endpoint returns an aggregate of the connections (channels and nodes) to the node.

    HTTP Request

    GET http://localhost:3098/v0/connections/

    Body Parameters

    None

    Get Channels

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/channels/"
    
    const channelsService = require('@coinmesh/lnd-adapter').channelsService;
    
    channelsService.getChannels().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "channels": [{
        "capacity": "<Channel Token Capacity Number>",
        "commit_transaction_fee": "<Commit Transaction Fee Number>",
        "commit_transaction_weight": "<Commit Transaction Weight Number>",
        "id": "<Channel Id String>",
        "is_active": "<Channel Active Bool>",
        "is_closing": "<Channel Is Closing Bool>",
        "is_opening": "<Channel Is Opening Bool>",
        "is_private": "<Channel Is Private Bool>",
        "local_balance": "<Local Balance Satoshis Number>",
        "partner_public_key": "<Channel Partner Public Key String>",
        "pending_payments": [{
          "id": "<Payment Preimage Hash Hex String>",
          "is_outgoing": "<Payment Is Outgoing Bool>",
          "timeout": "<Chain Height Expiration Number>",
          "tokens": "<Payment Tokens Number>"
        }],
        "received": "<Received Satoshis Number>",
        "remote_balance": "<Remote Balance Satoshis Number>",
        "sent": "<Sent Satoshis Number>",
        "transaction_id": "<Blockchain Transaction Id String>",
        "transaction_vout": "<Blockchain Transaction Vout Number>",
        "unsettled_balance": "<Unsettled Balance Satoshis Number>"
      }]
    }
    

    This endpoint retrieves all of the channels connected to this node.

    HTTP Request

    GET http://localhost:3098/v0/channels/

    Close Channel

    curl -X DELETE
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/channels/{{channel id}}"
    
    const channelsService = require('@coinmesh/lnd-adapter').channelsService;
    
    channelsService.closeChannel(channelId).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "transaction_id": "<Closing Transaction Id Hex String>",
      "type": "close_channel"
    }
    

    This endpoint closes a channel connected to this node.

    HTTP Request

    DELETE http://localhost:3098/v0/channels/{{channel id}}

    URL Parameters

    Parameter Default Description
    channel_id null Id of channel to close

    Open Channel

    curl -X POST
      -d '{
          "chain_fee_tokens_per_vbyte": 1e3,
          "give_tokens": 0,
          "local_tokens": 100000,
          "partner_public_key": "{{public key of other node}}"
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/channels/"
    
    const channelsService = require('@coinmesh/lnd-adapter').channelsService;
    
    const targetNodePublicKey = `${publicKey}`;
    const localTokens = 100000;
    const giveTokens = 0;
    const fee = 1e3;
    
    channelsService.openChannel(targetNodePublicKey, localTokens, giveTokens, fee).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "transaction_id": "<Funding Transaction Id String>",
      "transaction_vout": "<Funding Transaction Output Index Number>",
      "type": "channel_pending"
    }
    

    This endpoint opens a channel with a connected peer.

    HTTP Request

    POST http://localhost:3098/v0/channels/

    Body Parameters

    Parameter Default Description
    chain_fee_tokens_per_vbyte 1e3 Chain Fee Tokens Per VByte Number
    give_tokens 0 Number of tokens to gift to peer
    local_tokens null Number of tokens to fund channel with
    partner_public_key null Public key of peer node

    Sign Message

    curl -X POST
      -d '{
          "message": "A message to sign."
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/crypto/sign/"
    
    const cryptoService = require('@coinmesh/lnd-adapter').cryptoService;
    
    const message = 'A message to sign.';
    
    cryptoService.signMessage(message).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "signature": "{{signature}}"
    }
    

    This endpoint opens a channel with a connected peer.

    HTTP Request

    POST http://localhost:3098/v0/crypto/sign/

    Body Parameters

    Parameter Default Description
    message null Message to sign

    Verify Message

    curl -X POST
      -d '{
          "message": "A message to verify."
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/crypto/verify/"
    
    const cryptoService = require('@coinmesh/lnd-adapter').cryptoService;
    
    const message = 'A message to sign.';
    
    cryptoService.signMessage(message).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "signed_by": "{{public key of signer}}"
    }
    

    This endpoint opens a channel with a connected peer.

    HTTP Request

    POST http://localhost:3098/v0/crypto/sign/

    Body Parameters

    Parameter Default Description
    message null Message to sign
    signature null Signature to check the message

    Create Invoice

    curl -X POST
      -d '{
            "description": "Fake description",
            "expires_at": "new Date()",
            "tokens": 20001,
            "internal_description": "receipt info",
            "is_fallback_included": false,
            "is_fallback_nested": false,
            "secret": "sshhhh",
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/invoices/"
    
    const invoicesService = require('@coinmesh/lnd-adapter').invoicesService;
    
    const invoiceRequestObject = {
      description: "Fake description",
      expires_at: new Date(),
      tokens: 20001,
      internal_description: "receipt info",
      is_fallback_included: false,
      is_fallback_nested: false,
      secret: "sshhhh"
    };
    
    invoicesService.createInvoice(invoiceRequestObject).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "chain_address": "<Backup Address String>",
      "created_at": "<ISO 8601 Date String>",
      "description": "Fake description",
      "id": "<Payment Hash Hex String>",
      "request": "<BOLT 11 Encoded Payment Request String>",
      "secret": "sshhh",
      "tokens": 20001,
      "type": "create_invoice"
    }
    

    This endpoint creates an invoice to be paid via a channel.

    HTTP Request

    POST http://localhost:3098/v0/channels/

    Body Parameters

    Parameter Default Description
    description null Description of the invoice
    expires_at null When the invoice expires
    internal_description null Description to use internally
    is_fallback_included null Include a fallback address?
    is_fallback_nested null Should fallback address be nested
    secret null Secret
    tokens null Number of tokens in satoshis

    Get Invoice

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/invoices/{{request}}"
    
    const invoicesService = require('@coinmesh/lnd-adapter').invoicesService;
    
    invoicesService.getInvoice(invoice.id).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "description": "Fake description",
      "expires_at": "new Date()",
      "id": "Invoice id string",
      "is_confirmed": true,
      "is_outgoing": false,
      "request": "<BOLT 11 Encoded Payment Request String>",
      "secret": "ssshhhh",
      "tokens": 20001,
      "type": "get_invoice"
    }
    

    This endpoint retrieves details of a specific invoice.

    HTTP Request

    GET http://localhost:3098/v0/invoices/{{request}}

    Get Invoices

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/invoices/"
    
    const invoicesService = require('@coinmesh/lnd-adapter').invoicesService;
    
    invoicesService.getInvoices().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "description": "Fake description",
      "expires_at": "new Date()",
      "id": "invoice.id",
      "is_confirmed": true,
      "is_outgoing": false,
      "request": "<BOLT 11 Encoded Payment Request String>",
      "secret": "ssshhh",
      "tokens": 20001,
      "type": "get_invoices"
    }
    

    This endpoint retrieves all of the invoices open for this node.

    HTTP Request

    GET http://localhost:3098/v0/invoices/

    Get Network Info

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/network-info/"
    
    const networkInfosService = require('@coinmesh/lnd-adapter').networkInfosService;
    
    networkInfosService.getNetworkInfo().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "average_channel_size": 100000,
      "channel_count": 20,
      "maximum_channel_size": 10000000000,
      "minimum_channel_size": 10000,
      "node_count": 10,
      "total_capacity": 1000000,
      "type": "network-info"
    }
    

    This endpoint retrieves network information about the node.

    HTTP Request

    GET http://localhost:3098/v0/network_info/

    Get Network Graph

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/network-info/graph"
    
    const networkInfosService = require('@coinmesh/lnd-adapter').networkInfosService;
    
    networkInfosService.getNetworkGraph().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "edges": [{
        "capacity": 1000000000,
        "from_self": false,
        "id": "Channel id",
        "policies": [{
          "base_fee_mtokens": 0,
          "cltv_delta": 0,
          "fee_rate": 0,
          "is_disabled": false,
          "minimum_htlc_mtokens": 0
        }],
        "source": "{{source public key}}",
        "target": "{{target public key}}",
        "to_self": false,
        "transaction_id": "{{transaction id}}",
        "transaction_output_index": "{{ transaction output index }}",
        "updated_at": "new Date()",
      }],
      "nodes": [{
        "alias": "",
        "color": "",
        "community": "",
        "id": "Public key of node",
        "is_self": false,
        "sockets": [""],
        "updated_at": "new Date()"
      }],
      "own_node": {
        "channel_count": 1,
        "id": ""
      }
    }
    

    This endpoint retrieves a graph of information about the peers and edges node.

    HTTP Request

    GET http://localhost:3098/v0/network_info/graph

    Get Payments

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/history/"
    
    const paymentsService = require('@coinmesh/lnd-adapter').paymentsService;
    
    paymentsService.getPayments().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "history": [{
        "block_id": "{{block id}}",
        "chain_address": "{{ fallback chain address }}",
        "confirmation_count": 1,
        "confirmed_at": "new Date()",
        "created_at": "new Date()",
        "description": "Fake description",
        "description_hash": "",
        "destination": "",
        "expires_at": "new Date()",
        "fee": 1000,
        "hop_count": 5,
        "id": "{{id}}",
        "is_confirmed": true,
        "is_outgoing": false,
        "request": "<BOLT 11 Payment Request String>",
        "tokens": 20001,
        "type": "history"
      }]
    }
    

    This endpoint retrieves all of the payments made from this wallet.

    HTTP Request

    GET http://localhost:3098/v0/history/

    Pay Invoice

    curl -X POST
      -d '{
            "fee": 1000,
            "request": "<BOLT 11 Payment Request String>",
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/payments/"
    
    const paymentsService = require('@coinmesh/lnd-adapter').paymentsService;
    
    const request = '<BOLT 11 Payment Request String>';
    const fee = 1000;
    
    paymentsService.pay(request, fee).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "fee": 1000,
      "fee_mtokens": 1000000,
      "hops": [{
        "channel_capacity": 10000,
        "channel_id": "",
        "fee_mtokens": 1000,
        "forward_mtokens": 1000,
        "timeout": "<Hop CLTV Expiry Block Height Number>"
      }],
      "id": "",
      "is_confirmed": true,
      "is_outgoing": false,
      "mtokens": 100000,
      "secret": "sshh",
      "tokens": 20001,
      "type": "payments"
    }
    

    This endpoint pays an invoice request.

    HTTP Request

    POST http://localhost:3098/v0/payments/

    Body Parameters

    Parameter Default Description
    fee null Fee to pay
    request null The payment request from an invoice

    Add Peer

    curl -X POST
      -d '{
            "public_key": "{{public key}}",
            "host": "localhost",
            "port": "9735"
        }'
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/peers/"
    
    const peersService = require('@coinmesh/lnd-adapter').peersService;
    
    const socket = `localhost:9735`;
    const publicKey = '{{pubkey}}';
    peersService.addPeer(socket, publicKey).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "error": "TODO: Fill this in :)"
    }
    

    This endpoint connects to a new node.

    HTTP Request

    POST http://localhost:3098/v0/peers/

    Body Parameters

    Parameter Default Description
    public_key null Public Key
    host null Host of the remote node
    port 9735 Port the remote node is running on

    Remove Peer

    curl -X DELETE
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/peers/{{peer public key}}"
    
    const peersService = require('@coinmesh/lnd-adapter').peersService;
    
    peersService.removePeer(peer.public_key).then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "error": "TODO: Fill this in :)"
    }
    

    This endpoint removes a connected peer.

    HTTP Request

    DELETE http://localhost:3098/v0/peers/{{peer public key}}

    URL Parameters

    Parameter Default Description
    public_key null Public key of the node to disconnect from

    List Peers

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/peers/"
    
    const paymentsService = require('@coinmesh/lnd-adapter').paymentsService;
    
    paymentsService.getPeers().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

    {
      "peers": [{
        "bytes_received": 10,
        "bytes_sent": 10,
        "is_inbound": true,
        "ping_time": 110,
        "public_key": "{{public key}}",
        "socket": "localhost:9735",
        "tokens_received": 30000,
        "tokens_sent": 20000,
        "type": "peers"
      }]
    }
    

    This endpoint retrieves all of the peers connected to this node.

    HTTP Request

    GET http://localhost:3098/v0/peers/

    Get Chain Transactions

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/transactions/"
    
    const transactionsService = require('@coinmesh/lnd-adapter').transactionsService;
    
    transactionsService.getChainTransactions().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

      {
        "transactions": [{
          "block_id": "{{block hash}}",
          "confirmation_count": 1,
          "confirmation_height": 1000,
          "created_at": "new Date()",
          "is_confirmed": true,
          "is_outgoing": false,
          "fee": 1000,
          "id": "{{transaction id}}",
          "output_addresses": "[\"{{address}}\"]",
          "tokens": 20001,
          "type": "transactions"
        }]
      }
    

    This endpoint retrieves all of the transactions made on chain from this node.

    HTTP Request

    GET http://localhost:3098/v0/transactions/

    Get Wallet Info

    curl -X GET
      -H "Content-Type: application/json"
      -H "Authorization: Basic cnBjdXNlcjpycGNwYXNzd29yZA=="
      "http://localhost:3098/v0/wallet_info/"
    
    const walletInfoService = require('@coinmesh/lnd-adapter').walletInfoService;
    
    walletInfoService.getWalletInfo().then(result => {
      console.log(result);
    });
    

    The above command returns JSON structured like this:

      {
        "active_channels_count": 1,
        "alias": "Patricks node",
        "current_block_hash": "{{block hash}}",
        "current_block_height": 1000,
        "is_synced_to_chain": true,
        "is_testnet": false,
        "latest_block_at": "new Date()",
        "peers_count": 1,
        "pending_channels_count": 2,
        "public_key": "{{public key}}",
        "type": "wallet_info",
      }
    

    This endpoint retrieves the wallet information.

    HTTP Request

    GET http://localhost:3098/v0/wallet_info/

    Errors

    The Kittn API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- The kitten requested is hidden for administrators only.
    404 Not Found -- The specified kitten could not be found.
    405 Method Not Allowed -- You tried to access a kitten with an invalid method.
    406 Not Acceptable -- You requested a format that isn't json.
    410 Gone -- The kitten requested has been removed from our servers.
    418 I'm a teapot.
    429 Too Many Requests -- You're requesting too many kittens! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.