BitcoinMethods
gettxoutsetinfo
The gettxoutsetinfo RPC method returns detailed information about the set of unspent transaction outputs (UTXOs).
gettxoutsetinfo
Overview
The 'gettxoutsetinfo' RPC method returns detailed information about the set of unspent transaction outputs (UTXOs).
Request
shell
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--body-data '{"jsonrpc":"2.0","id":1,"method":"gettxoutsetinfo","params": [ ]}' \
'https://bitcoin-mainnet.node.coinapi.io'csharp
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://bitcoin-mainnet.node.coinapi.io");
request.Headers.Add("accept", "application/json");
request.Headers.Add("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY");
var content = new StringContent("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"gettxoutsetinfo\",\"params\": [ ]}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());php
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json',
'accept' => 'application/json',
'X-CoinAPI-Key' => '73034021-THIS-IS-SAMPLE-KEY'
];
$body = '{
"jsonrpc": "2.0",
"id": 1,
"method": "gettxoutsetinfo",
"params": []
}';
$request = new Request('POST', 'https://bitcoin-mainnet.node.coinapi.io', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>python
import http.client
import json
conn = http.client.HTTPSConnection("mainnet-bitcoin.node.coinapi.io")
payload = json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "gettxoutsetinfo",
"params": []
})
headers = {
'Content-Type': 'application/json',
'accept': 'application/json',
'X-CoinAPI-Key': '73034021-THIS-IS-SAMPLE-KEY'
}
conn.request("POST", "/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))javascript
var settings = {
"url": "https://bitcoin-mainnet.node.coinapi.io",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"accept": "application/json",
"X-CoinAPI-Key": "73034021-THIS-IS-SAMPLE-KEY"
},
"data": JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "gettxoutsetinfo",
"params": []
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://bitcoin-mainnet.node.coinapi.io"
method := "POST"
payload := strings.NewReader(`{"jsonrpc":"2.0","id":1,"method":"gettxoutsetinfo","params": [ ]}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("accept", "application/json")
req.Header.Add("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}ruby
require "uri"
require "json"
require "net/http"
url = URI("https://bitcoin-mainnet.node.coinapi.io")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["accept"] = "application/json"
request["X-CoinAPI-Key"] = "73034021-THIS-IS-SAMPLE-KEY"
request.body = JSON.dump({
"jsonrpc": "2.0",
"id": 1,
"method": "gettxoutsetinfo",
"params": []
})
response = https.request(request)
puts response.read_bodyjava
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"gettxoutsetinfo\",\"params\": [ ]}");
Request request = new Request.Builder()
.url("https://bitcoin-mainnet.node.coinapi.io")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("accept", "application/json")
.addHeader("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY")
.build();
Response response = client.newCall(request).execute();Request Parameters
- hash_type (string)
- default: hash_serialized_2
- Description: Specifies the type of UTXO set hash to be calculated.
- Options:
- "hash_serialized_2": Computes a serialized hash which helps in verifying the UTXO set's integrity by comparing it with other nodes.
- "none": Does not calculate a hash.
Response
{
"result": {
"height": 687293,
"bestblock": "00000000000000000008adb1c65c7358b2989d183a5e875a3b853f12ac4b89d7",
"txouts": 9552849,
"bogosize": 676484713,
"hash_serialized_2": "3e4f22d8fd4ea1c1fb5da1c3f6d0297b12f1f602699ada01e9ad608aa13f7969",
"total_amount": 18546728.293476,
"transactions": 5362819,
"disk_size": 25467893456,
"error": null
},
"id": "curltest",
"status": "success"
}A JSON object containing the following fields:
- result: An object encapsulating the response data with the following attributes:
- height: Indicates the height of the current block in the blockchain.
- bestblock: The hash of the most recent block at the tip of the blockchain.
- txouts: Represents the number of unspent transaction outputs.
- bogosize: A metric representing the UTXO set size; however, it doesn't convey any meaningful information.
- hash_serialized_2: This field contains the serialized hash value (only appears if the hash_type is set to 'hash_serialized_2'). It assists in verifying the integrity of the UTXO set through comparison with other nodes.
- total_amount: The cumulative value (in BTC) of all unspent outputs.
- transactions: Denotes the number of transactions with unspent outputs.
- disk_size: The estimated size of the chainstate on the disk in bytes.
- error: If an error occurs during the execution, this field will contain the error message; otherwise, it remains empty.
gettxoutproof
The gettxoutproof RPC method facilitates the verification of transaction inclusion within a specific block, returning a serialized proof of transaction inclusion.
help
The help method allows you to list all available commands or get detailed help on a specified command in the CoinAPI Bitcoin API. It is a versatile tool for developers to understand and navigate th...