curl -X GET "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2" \
-H "Authorization: Bearer <YOUR_API_KEY>"fetch("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2", { headers: { "Authorization": "Bearer <YOUR_API_KEY>"} })
.then(response => response.json())
.then(data => console.log(data))require('axios')
.get("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2", { headers: { Authorization: 'Bearer <YOUR_API_KEY>' } })
.then(response => console.log(response))require 'net/http'
uri = URI("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer <YOUR_API_KEY>"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.bodyimport requests
headers = {'Authorization': 'Bearer <YOUR_API_KEY>'}
url = "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2"
print(requests.get(url, headers=headers).json())<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total")
.header("Authorization", "Bearer <token>")
.asString();{
"status": {
"code": 200,
"message": "success"
},
"result": {
"window": "day",
"data": [
{
"datetime": "2019-10-02",
"metric_type": "tx_count",
"metric_unit": "number",
"result": {
"network_capacity": null,
"network_capacity_usd": null,
"capacity_per_channel_mean": null,
"capacity_per_channel_mean_usd": null,
"capacity_per_node_mean": null,
"capacity_per_node_mean_usd": null,
"number_of_node": null,
"number_of_channel": null,
"channel_per_node_mean": null,
"node_age_days": null,
"channel_age_days": null,
"base_fee_median": null,
"base_fee_median_usd": null,
"fee_rate_median": null,
"fee_rate_median_usd": null
}
}
]
}
}BTC Lightning Statistics
Lightning Network Statistics contains various metrics which are calculated from lightning network.
Supported Stats
| Stas | Description |
|---|---|
network_capacity | The total network capacity (sum of balances available across all lightning payment channels) (BTC) |
network_capacity_usd | The total network capacity (sum of balances available across all lightning payment channels) (USD) |
capacity_per_channel_mean | The average channel capacity (BTC) |
capacity_per_channel_mean_usd | The average channel capacity (USD) |
capacity_per_node_mean | The average node capacity (BTC) |
capacity_per_node_mean_usd | The average node capacity (USD) |
number_of_node | The total number of available nodes (Number) |
number_of_channel | The total number of available payment channels (Number) |
channel_per_node_mean | The average number of channels per node (Number) |
node_age_days | The average day of duration of nodes (Number) |
channel_age_days | The average day of duration of channels (Number) |
base_fee_median | The median base fee of transactions (Sat) |
base_fee_median_usd | The median base fee of transactions (USD) |
fee_rate_median | The median fee rates of transactions (Sat) |
fee_rate_median_usd | The median fee rates of transactions (USD) |
Supported Windows
| Supported Windows |
|---|
hour, day* |
(*) Default
curl -X GET "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2" \
-H "Authorization: Bearer <YOUR_API_KEY>"fetch("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2", { headers: { "Authorization": "Bearer <YOUR_API_KEY>"} })
.then(response => response.json())
.then(data => console.log(data))require('axios')
.get("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2", { headers: { Authorization: 'Bearer <YOUR_API_KEY>' } })
.then(response => console.log(response))require 'net/http'
uri = URI("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer <YOUR_API_KEY>"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.bodyimport requests
headers = {'Authorization': 'Bearer <YOUR_API_KEY>'}
url = "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total?window=day&limit=2"
print(requests.get(url, headers=headers).json())<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cryptoquant.com/v1/btc/lightning/stats-in-total"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cryptoquant.com/v1/btc/lightning/stats-in-total")
.header("Authorization", "Bearer <token>")
.asString();{
"status": {
"code": 200,
"message": "success"
},
"result": {
"window": "day",
"data": [
{
"datetime": "2019-10-02",
"metric_type": "tx_count",
"metric_unit": "number",
"result": {
"network_capacity": null,
"network_capacity_usd": null,
"capacity_per_channel_mean": null,
"capacity_per_channel_mean_usd": null,
"capacity_per_node_mean": null,
"capacity_per_node_mean_usd": null,
"number_of_node": null,
"number_of_channel": null,
"channel_per_node_mean": null,
"node_age_days": null,
"channel_age_days": null,
"base_fee_median": null,
"base_fee_median_usd": null,
"fee_rate_median": null,
"fee_rate_median_usd": null
}
}
]
}
}Authorizations
For each API request, include this HTTP header:
Authorization with the Bearer <YOUR_API_KEY>. Bearer access token is the type of HTTP Authorization. You have to include access token to the HTTP header and note that leading bearer is required.
You must include your access token in HTTP header in every request you make. The token is unique, issued for each client, and regularly changed(once a year). To obtain an access token, please upgrade your plan to Professional or Premium plan. You'll be able to see your access token on the API tab of your profile page after the subscription.
Query Parameters
Currently, we support day and hour.
This defines the starting time for which data will be gathered, formatted as YYYYMMDDTHHMMSS (indicating YYYY-MM-DDTHH:MM:SS, UTC time). If window=day is used, it can also be formatted as YYYYMMDD (date). If window=block is used, you can also specify the exact block height (e.g. 510000). If this field is not specified, response will include data from the earliest time.
This defines the ending time for which data will be gathered, formatted as YYYYMMDDTHHMMSS (indicating YYYY-MM-DDTHH:MM:SS, UTC time). If window=day is used, it can also be formatted as YYYYMMDD (date). If window=block is used, you can also specify the exact block height (e.g. 510000). If this field is not specified, response will include data from the latest time.
The maximum number of entries to return before the latest data point (or before to if specified). This field ranges from 1 to 100,000.
1 <= x <= 100000A format type about return message type. Supported formats are json, csv.