Bitcoin Vault (BTCV)
General Information
Get Node Information
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/info' \
-H 'ContentType: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/info HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/info').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/info",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/info');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/info")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/info'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/info")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/info")
}
Response Body
{
"payload": {
"difficulty": 7182852313938.317,
"headers": 546904,
"chain": "main",
"chainWork": "000000000000000000000000000000000000000003b8fe71a1bf647effbc862f",
"mediantime": 1540234846,
"blocks": 546904,
"bestBlockHash": "0000000000000000001c940339b65f3c1d85006041e9602bc9bda2c495e2ca82",
"currency": "btcv",
"transactions": 342149347,
"verificationProgress": 0.9999964749471614
}
}
Info
General information about a blockchain is available by GET-ing the base resource.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/info
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
The returned object contains a litany of information about the blockchain, including its height, the time/hash of the latest block, and more.
Get Block By Hash
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89")
}
Response Body
{
"payload": {
"hash": "000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"strippedsize": 10839,
"size": 11850,
"weight": 44367,
"height": 48714,
"version": 536870912,
"versionHex": "20000000",
"merkleroot": "34d35b294771c0d5accb7785fab7f85df16bbd120cd4e894530182254dd929ea",
"datetime": "2020-09-10 14:55:00 UTC",
"time": "2020-09-10 14:55:00 UTC",
"mediantime": "2020-09-10 13:44:35 UTC",
"nonce": 476492713,
"bits": "1806ae25",
"difficulty": 164588826616.6743,
"chainwork": "0000000000000000000000000000000000000000003d2cbcbea87bd8c17ff1b9",
"previousblockhash": "000000000000000006a0a060d941d7fc90424a232eb7be25157d04cfbafcf145",
"transactions": 11,
"tx": [
"e0153cd28a61ef76fdbd4ed911394a44c4843e2bae7c720a2675b0601df593ee",
"dd667c73866be0a423747fe76e4a6c1804e86d3c6a64eb3e46f3fe2ff962694c",
"15f0705c644b68ff975fc290e8f030d68241e5f548a00bf0a08cf8c2a691de16",
"62c8a3ea7ed86985caa64798daf3214048d6cada380bb80afb165a1a302dfb3c",
"13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"932bce622b7c5e2592f50175f3291f02db3aab94767758a1ebf4b7fdff47f95b",
"0af2fd91858ad30a1fe7f831e4613c2d4cc7b7ffd02cebdecf241cef2a32278e",
"741482db41295f743a373a0fb0021743572daf34ce4fc4be77a22d08e4d5aeaa",
"67a5fd164eff6489bf46d26130bd3cbccb0e11d1dcd9f4fec32a2c447dc3d63e",
"2d612c0207af5bc0dbf22071f77f2d62ba6882a43f999989fc8477f9e52bd1c7",
"d04b1b687ce60d120a9e3e184e40ddf55518b559ee87cb34c248160d9467a4f1"
],
"confirmations": 1,
"timestamp": 1599749700
}
}
Info
Block Hash endpoint gives you detail information for particular block in the blockchain
HTTP Request
GET /v1/bc/btcv/${NETWORK}/blocks/${BLOCK_HASH}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
BLOCK_HASH | ------- | Hash of the block in blockchain |
BLOCK_HASH is a string
representing the hash of the block you’re interested in querying, for example:
000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89
The returned object contains information about the block in JSON format, including its height, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block, and more.
Get Block by Height
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/blocks/48714 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/blocks/48714",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/48714")
}
Response Body
{
"payload": {
"hash": "000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"strippedsize": 10839,
"size": 11850,
"weight": 44367,
"height": 48714,
"version": 536870912,
"versionHex": "20000000",
"merkleroot": "34d35b294771c0d5accb7785fab7f85df16bbd120cd4e894530182254dd929ea",
"datetime": "2020-09-10 14:55:00 UTC",
"time": "2020-09-10 14:55:00 UTC",
"mediantime": "2020-09-10 13:44:35 UTC",
"nonce": 476492713,
"bits": "1806ae25",
"difficulty": 164588826616.6743,
"chainwork": "0000000000000000000000000000000000000000003d2cbcbea87bd8c17ff1b9",
"previousblockhash": "000000000000000006a0a060d941d7fc90424a232eb7be25157d04cfbafcf145",
"transactions": 11,
"tx": [
"e0153cd28a61ef76fdbd4ed911394a44c4843e2bae7c720a2675b0601df593ee",
"dd667c73866be0a423747fe76e4a6c1804e86d3c6a64eb3e46f3fe2ff962694c",
"15f0705c644b68ff975fc290e8f030d68241e5f548a00bf0a08cf8c2a691de16",
"62c8a3ea7ed86985caa64798daf3214048d6cada380bb80afb165a1a302dfb3c",
"13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"932bce622b7c5e2592f50175f3291f02db3aab94767758a1ebf4b7fdff47f95b",
"0af2fd91858ad30a1fe7f831e4613c2d4cc7b7ffd02cebdecf241cef2a32278e",
"741482db41295f743a373a0fb0021743572daf34ce4fc4be77a22d08e4d5aeaa",
"67a5fd164eff6489bf46d26130bd3cbccb0e11d1dcd9f4fec32a2c447dc3d63e",
"2d612c0207af5bc0dbf22071f77f2d62ba6882a43f999989fc8477f9e52bd1c7",
"d04b1b687ce60d120a9e3e184e40ddf55518b559ee87cb34c248160d9467a4f1"
],
"confirmations": 1,
"timestamp": 1599749700
}
}
Info
Block Height endpoint gives you detail information for particular block in the blockchain
HTTP Request
GET /v1/bc/btcv/${NETWORK}/blocks/${BLOCK_HEIGHT}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
BLOCK_HEIGHT | ------- | Height of the block in blockchain |
BLOCK_HEIGHT is a integer
representing the height of the block you’re interested in querying, for example:
48714
The returned object contains information about the block in JSON format, including its height, the number of transactions in it, transaction hashes listed in the canonical order in which they appear in the block, and more.
Get Latest Block
Sample Data
curl -X GET https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/latest \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/blocks/latest HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/latest",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": [
"https://api.cryptoapis.io"
],
"port": "8021",
"path": [
"v1",
"bc",
"btcv",
"mainnet",
"blocks",
"latest"
],
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/latest');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/latest")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("GET", "v1,bc,btcv,mainnet,blocks,latest", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/latest")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/blocks/latest"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hash": "000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"strippedsize": 10839,
"size": 11850,
"weight": 44367,
"height": 48714,
"version": 536870912,
"versionHex": "20000000",
"merkleroot": "34d35b294771c0d5accb7785fab7f85df16bbd120cd4e894530182254dd929ea",
"datetime": "2020-09-10 14:55:00 UTC",
"time": "2020-09-10 14:55:00 UTC",
"mediantime": "2020-09-10 13:44:35 UTC",
"nonce": 476492713,
"bits": "1806ae25",
"difficulty": 164588826616.6743,
"chainwork": "0000000000000000000000000000000000000000003d2cbcbea87bd8c17ff1b9",
"previousblockhash": "000000000000000006a0a060d941d7fc90424a232eb7be25157d04cfbafcf145",
"transactions": 11,
"tx": [
"e0153cd28a61ef76fdbd4ed911394a44c4843e2bae7c720a2675b0601df593ee",
"dd667c73866be0a423747fe76e4a6c1804e86d3c6a64eb3e46f3fe2ff962694c",
"15f0705c644b68ff975fc290e8f030d68241e5f548a00bf0a08cf8c2a691de16",
"62c8a3ea7ed86985caa64798daf3214048d6cada380bb80afb165a1a302dfb3c",
"13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"932bce622b7c5e2592f50175f3291f02db3aab94767758a1ebf4b7fdff47f95b",
"0af2fd91858ad30a1fe7f831e4613c2d4cc7b7ffd02cebdecf241cef2a32278e",
"741482db41295f743a373a0fb0021743572daf34ce4fc4be77a22d08e4d5aeaa",
"67a5fd164eff6489bf46d26130bd3cbccb0e11d1dcd9f4fec32a2c447dc3d63e",
"2d612c0207af5bc0dbf22071f77f2d62ba6882a43f999989fc8477f9e52bd1c7",
"d04b1b687ce60d120a9e3e184e40ddf55518b559ee87cb34c248160d9467a4f1"
],
"confirmations": 1,
"timestamp": 1599749700
}
}
Info
Latest Block Endpoint gives you detail information for the latest block in the blockchain
HTTP Request
GET /v1/bc/btcv/${NETWORK}/blocks/latest
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
The returned object contains information about the latest block in JSON format, including its height, the number of transactions in it and more.
Addresses
Crypto APIs Address API allows you to generate single-use, low-value key pairs with corresponding addresses based on the coin/chain resource you’ve selected for your endpoints.
If you’re new to blockchains, you can think of public addresses as similar to bank account numbers in a traditional ledger. The biggest differences:
- Anyone can generate a public address themselves (through ECDSA in Bitcoin). No single authority is needed to generate new addresses; it’s just public-private key cryptography.
- Public addresses are significantly more lightweight. Consequently, and unlike traditional bank accounts, you can (and should!) generate new addresses for every transaction.
- Addresses can also leverage pay-to-script-hash, which means they can represent exotic things beyond a single private-public key pair; the most prominent example being multi-signature addresses that require n-of-m signatures to spend.
Generate Address
Sample Data
curl -X POST 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
POST /v1/bc/btcv/mainnet/address HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.post('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address')
.then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/address",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.post(url, headers=headers, data={})
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Post("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address")
}
Response Body
{
"payload": {
"privateKey": "4530bf12e68d260178ba2b5a6ecf6aa7f8be2c7845e01e9683e8554fe57ec0e6",
"publicKey": "0352a1d503582d379d14abcf54b6cac6ded5d77a4e413a08f9dad4db89eeea30eb",
"address": "Yab49mPwpntS5TF5W887EQyeTo6yG9ab2b",
"wif": "KyYD1zTQb7XiRj7BNgiXbxS6Rm1sR1RQGSjAkGg6KyPbdX4PQvuM"
}
}
Info
The Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address. No information is required with this POST request.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/address
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
The returned object contains a private key in hex-encoded and wif-encoded format, a public key, and a public address.
Addresses & Transactions Data
Crypto APIs Addresses & Transactions Data API allows you to look up information about public addresses on the blockchain as well as to look up information about unconfirmed transactions, query transactions based on hash or block.
Get Address Details
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX")
}
Response Body
{
"payload": {
"address": "RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX",
"totalSpent": "0.01759874",
"totalReceived": "0.01759874",
"balance": "0",
"txi": 1,
"txo": 1,
"txsCount": 2,
"addresses": [
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX"
]
}
}
Info
The default Address Endpoint strikes a general information about addresses.
If you want to see the unconfirmed balance, set checkUnconfirmedbalance
to true
.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/address/${ADDRESS}?checkUnconfirmedBalance=true
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
checkUnconfirmedBalance | false | (boolean) returns unconfirmedBalance |
ADDRESS is a string representing the public address (or wallet/HD wallet name) you’re interested in querying, for example:
RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX
The returned object contains information about the address, including its balance in bitcoins and the number of transactions associated with it. The endpoint omits any detailed transaction information, but if that isn’t required by your application, then it’s the fastest and preferred way to get public address information.
<h5 id="btcv-basic-address-transactions-endpoint">Get Basic Transactions By Address</h5>
> Sample Data
```shell
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/basic/transactions")
}
Response Body
{
"payload": [
{
"txid": "13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"amount": "0.06351817",
"fee": "0.00025903",
"unit": "btcv",
"datetime": "2020-09-10 14:55:00 UTC",
"timestamp": 1599749700,
"confirmations": 112,
"sent": {
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX": "0.01759874",
"RC6tNdRYCzaRcikmAtorzE9Ef3YN6zRoyU": "0.04617846"
},
"received": {
"YdevmFny3okGrrWBMHYanDG6qqvxUFBVj9": "0.04905132",
"RMgEJ9oxuGXsMqEZ34EvCDnXMBjX2mY1Bg": "0.01446685"
}
},
{
"txid": "79b2f3d3d1910132658fb3832c221d38e16e46cf322fc5d2c2d14dbba309a977",
"amount": "0.02555809",
"fee": "0.00025903",
"unit": "btcv",
"datetime": "2020-09-10 14:45:26 UTC",
"timestamp": 1599749126,
"confirmations": 114,
"sent": {
"RU9o7w8CVfXDkgvXucWkkNPHewaBXDBrzA": "0.01342023",
"RKjBwh6Eb1h4a9iGKHJGmbNjymi6xuvkRE": "0.01239689"
},
"received": {
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX": "0.01759874",
"YSG9yf6VQch3LQdoeHw3z5CdUt2ybL1EKS": "0.00795935"
}
}
],
"meta": {
"totalCount": 2,
"index": 0,
"limit": 50,
"results": 2
}
}
Info
The Address Basic Transactions Endpoint returns basic information available about a particular address, including an array of basic transactions.
HTTP Request
GET /v1/bc/btcv/${NETWORK}address/${ADDRESS}/basic/transactions?index=0&limit=50
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
index | 0 | First index of returned txs |
limit | 50 | Sets the number of returned txs |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The default values of the query parameters index
and limit
are as follows: 0 and 50.
ADDRESS is a string representing the public address you’re interested in querying, for example:
RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX
The returned object contains an array with basic transaction records associated with this address in descending order by blocktime.
Get Confirmed Transactions By Address
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions")
}
Response Body
{
"payload": [
{
"txid": "13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"hash": "50f4a35982fd2b991a267d3261406e2818298ac526e1485cf8252adcb207b611",
"index": 4,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 48711,
"datetime": "2020-09-10 14:55:00 UTC",
"time": "2020-09-10 14:55:00 UTC",
"blockhash": "000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"blockheight": 48714,
"blocktime": "2020-09-10 14:55:00 UTC",
"timestamp": 1599749700,
"confirmations": 1,
"fee": "0.00025903",
"txins": [
{
"txout": "79b2f3d3d1910132658fb3832c221d38e16e46cf322fc5d2c2d14dbba309a977",
"vout": 0,
"amount": "0.01759874",
"addresses": [
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX"
],
"script": {
"asm": "0014c0475c1fb66a3a761173c77a57a9d5e2cd97134f",
"hex": "160014c0475c1fb66a3a761173c77a57a9d5e2cd97134f"
},
"votype": "scripthash",
"witness": [
"304402202fed8535b88b6b5e0490c9ce3f8cf49d29dafa51692da63005463007ccb33e9502201eaf37c4c29cf19b459977b226cad252f5741aecbeebeea29aa1b4f66d8afc3401",
"02180e9d7e925942da3fdc9c5415c70a860d2c40f61046bb38f148c8f2274d8fda"
],
"sequence": 4294967294
},
{
"txout": "bb67e06a89e442391ddb88b5696d93a2d0fc93905ff3fb195694fcdf1acc1437",
"vout": 0,
"amount": "0.04617846",
"addresses": [
"RC6tNdRYCzaRcikmAtorzE9Ef3YN6zRoyU"
],
"script": {
"asm": "00147b2d8bb77d4a1dcc574837962233e7c24488d792",
"hex": "1600147b2d8bb77d4a1dcc574837962233e7c24488d792"
},
"votype": "scripthash",
"witness": [
"30440220630f72618c728f160d9d156de19c7a3fba070e670e10ac42bdb3b7e025a4f427022045458dc1451d895d2aff65dfe8c841939467b65f447c583c2ff396cd9c15f13101",
"035e54ae3986e0638116426a1d22f5ac0811c0c2fd4db7c893714dab6459124c5f"
],
"sequence": 4294967294
}
],
"txouts": [
{
"amount": "0.04905132",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"YdevmFny3okGrrWBMHYanDG6qqvxUFBVj9"
],
"script": {
"asm": "OP_DUP OP_HASH160 9cc2f5073cb298a47774d68277a6f18a44a702f3 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9149cc2f5073cb298a47774d68277a6f18a44a702f388ac",
"reqsigs": 1
}
},
{
"amount": "0.01446685",
"type": "scripthash",
"spent": false,
"addresses": [
"RMgEJ9oxuGXsMqEZ34EvCDnXMBjX2mY1Bg"
],
"script": {
"asm": "OP_HASH160 87fced8bc253b968daaa2bb00397743a6faaa7f1 OP_EQUAL",
"hex": "a91487fced8bc253b968daaa2bb00397743a6faaa7f187",
"reqsigs": 1
}
}
]
},
{
"txid": "79b2f3d3d1910132658fb3832c221d38e16e46cf322fc5d2c2d14dbba309a977",
"hash": "962091b95d9bde7a4bc51d2e1b571af3d6ac8b3e9aeecb00a781fa8a6625ca56",
"index": 32,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 48711,
"datetime": "2020-09-10 14:45:26 UTC",
"time": "2020-09-10 14:45:26 UTC",
"blockhash": "00000000000000000093b1181acb20b2e8f23c676ddae78306ad068888456e72",
"blockheight": 48712,
"blocktime": "2020-09-10 14:45:26 UTC",
"timestamp": 1599749126,
"confirmations": 3,
"fee": "0.00025903",
"txins": [
{
"txout": "376a300da37672ae009d3b58147ecc9723b0fd3c86d4d0da02bc3b3be7c0a215",
"vout": 0,
"amount": "0.01239689",
"addresses": [
"RKjBwh6Eb1h4a9iGKHJGmbNjymi6xuvkRE"
],
"script": {
"asm": "001496fcda902b17c1061fb336fbb229c638abad02b2",
"hex": "16001496fcda902b17c1061fb336fbb229c638abad02b2"
},
"votype": "scripthash",
"witness": [
"3044022016a40248515326552c2101270838dd6cf109e1c98a8616231d55bd709018df030220355185dbbea707ec7e473e5e301fe2bdb5c95ceff88ff915d32340acf8a405b701",
"037821bae4170ec6e262c9e96a77e961c1ce2f70ad514cbd2365b6164b7f6a076e"
],
"sequence": 4294967294
},
{
"txout": "646139a1fc6696fcb58a818fcddd411939ff7575f12d5d122df6ebc4a6737bb8",
"vout": 0,
"amount": "0.01342023",
"addresses": [
"RU9o7w8CVfXDkgvXucWkkNPHewaBXDBrzA"
],
"script": {
"asm": "0014a3889ae626dbe9b82dd1ad39d948a5aff82206dd",
"hex": "160014a3889ae626dbe9b82dd1ad39d948a5aff82206dd"
},
"votype": "scripthash",
"witness": [
"304402201c283579d7b0b283ef8b65738f56d213ddce93d37c9c3eb7018afc882a4b601b022070e4dd4b094073bebbaf1dd7c2ce976e427481fd8e01c711cdb71d8e5bd12eb701",
"03b29339478464cd9409abdd553af9057f7615fafbda832341d1a28c6cd0c3a8c8"
],
"sequence": 4294967294
}
],
"txouts": [
{
"amount": "0.01759874",
"type": "scripthash",
"spent": true,
"addresses": [
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX"
],
"script": {
"asm": "OP_HASH160 23513e123ee4f44c7976c3f11b7ddf6d7b1270c4 OP_EQUAL",
"hex": "a91423513e123ee4f44c7976c3f11b7ddf6d7b1270c487",
"reqsigs": 1
}
},
{
"amount": "0.00795935",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"YSG9yf6VQch3LQdoeHw3z5CdUt2ybL1EKS"
],
"script": {
"asm": "OP_DUP OP_HASH160 1fcb09680286eb15c21df4e6a29369ee7e99dcb7 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9141fcb09680286eb15c21df4e6a29369ee7e99dcb788ac",
"reqsigs": 1
}
}
]
}
],
"meta": {
"totalCount": 2,
"index": 0,
"limit": 50,
"results": 2
}
}
Info
The Address Confirmed Transactions Endpoint returns all information available about a particular address, including an array of complete transactions.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/address/${ADDRESS}/transactions?index=0&limit=50
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
index | 0 | First index of returned txs |
limit | 50 | Sets the number of returned txs |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The default values of the query parameters index
and limit
are as follows: 0 and 50.
ADDRESS is a string representing the public address you’re interested in querying, for example:
RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX
The returned object contains information about the address, including the number of transactions associated with it, and the corresponding full transaction records in descending order by blocktime.
Get Confirmed Transactions For Address By Range
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294/transactions-by-range/1551095270/1551096294")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294"")
}
Response Body
{
"payload": [
{
"txid": "13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"hash": "50f4a35982fd2b991a267d3261406e2818298ac526e1485cf8252adcb207b611",
"index": 4,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 48711,
"datetime": "2020-09-10 14:55:00 UTC",
"time": "2020-09-10 14:55:00 UTC",
"blockhash": "000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"blockheight": 48714,
"blocktime": "2020-09-10 14:55:00 UTC",
"timestamp": 1599749700,
"confirmations": 1,
"fee": "0.00025903",
"txins": [
{
"txout": "79b2f3d3d1910132658fb3832c221d38e16e46cf322fc5d2c2d14dbba309a977",
"vout": 0,
"amount": "0.01759874",
"addresses": [
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX"
],
"script": {
"asm": "0014c0475c1fb66a3a761173c77a57a9d5e2cd97134f",
"hex": "160014c0475c1fb66a3a761173c77a57a9d5e2cd97134f"
},
"votype": "scripthash",
"witness": [
"304402202fed8535b88b6b5e0490c9ce3f8cf49d29dafa51692da63005463007ccb33e9502201eaf37c4c29cf19b459977b226cad252f5741aecbeebeea29aa1b4f66d8afc3401",
"02180e9d7e925942da3fdc9c5415c70a860d2c40f61046bb38f148c8f2274d8fda"
],
"sequence": 4294967294
},
{
"txout": "bb67e06a89e442391ddb88b5696d93a2d0fc93905ff3fb195694fcdf1acc1437",
"vout": 0,
"amount": "0.04617846",
"addresses": [
"RC6tNdRYCzaRcikmAtorzE9Ef3YN6zRoyU"
],
"script": {
"asm": "00147b2d8bb77d4a1dcc574837962233e7c24488d792",
"hex": "1600147b2d8bb77d4a1dcc574837962233e7c24488d792"
},
"votype": "scripthash",
"witness": [
"30440220630f72618c728f160d9d156de19c7a3fba070e670e10ac42bdb3b7e025a4f427022045458dc1451d895d2aff65dfe8c841939467b65f447c583c2ff396cd9c15f13101",
"035e54ae3986e0638116426a1d22f5ac0811c0c2fd4db7c893714dab6459124c5f"
],
"sequence": 4294967294
}
],
"txouts": [
{
"amount": "0.04905132",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"YdevmFny3okGrrWBMHYanDG6qqvxUFBVj9"
],
"script": {
"asm": "OP_DUP OP_HASH160 9cc2f5073cb298a47774d68277a6f18a44a702f3 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9149cc2f5073cb298a47774d68277a6f18a44a702f388ac",
"reqsigs": 1
}
},
{
"amount": "0.01446685",
"type": "scripthash",
"spent": false,
"addresses": [
"RMgEJ9oxuGXsMqEZ34EvCDnXMBjX2mY1Bg"
],
"script": {
"asm": "OP_HASH160 87fced8bc253b968daaa2bb00397743a6faaa7f1 OP_EQUAL",
"hex": "a91487fced8bc253b968daaa2bb00397743a6faaa7f187",
"reqsigs": 1
}
}
]
},
{
"txid": "79b2f3d3d1910132658fb3832c221d38e16e46cf322fc5d2c2d14dbba309a977",
"hash": "962091b95d9bde7a4bc51d2e1b571af3d6ac8b3e9aeecb00a781fa8a6625ca56",
"index": 32,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 48711,
"datetime": "2020-09-10 14:45:26 UTC",
"time": "2020-09-10 14:45:26 UTC",
"blockhash": "00000000000000000093b1181acb20b2e8f23c676ddae78306ad068888456e72",
"blockheight": 48712,
"blocktime": "2020-09-10 14:45:26 UTC",
"timestamp": 1599749126,
"confirmations": 3,
"fee": "0.00025903",
"txins": [
{
"txout": "376a300da37672ae009d3b58147ecc9723b0fd3c86d4d0da02bc3b3be7c0a215",
"vout": 0,
"amount": "0.01239689",
"addresses": [
"RKjBwh6Eb1h4a9iGKHJGmbNjymi6xuvkRE"
],
"script": {
"asm": "001496fcda902b17c1061fb336fbb229c638abad02b2",
"hex": "16001496fcda902b17c1061fb336fbb229c638abad02b2"
},
"votype": "scripthash",
"witness": [
"3044022016a40248515326552c2101270838dd6cf109e1c98a8616231d55bd709018df030220355185dbbea707ec7e473e5e301fe2bdb5c95ceff88ff915d32340acf8a405b701",
"037821bae4170ec6e262c9e96a77e961c1ce2f70ad514cbd2365b6164b7f6a076e"
],
"sequence": 4294967294
},
{
"txout": "646139a1fc6696fcb58a818fcddd411939ff7575f12d5d122df6ebc4a6737bb8",
"vout": 0,
"amount": "0.01342023",
"addresses": [
"RU9o7w8CVfXDkgvXucWkkNPHewaBXDBrzA"
],
"script": {
"asm": "0014a3889ae626dbe9b82dd1ad39d948a5aff82206dd",
"hex": "160014a3889ae626dbe9b82dd1ad39d948a5aff82206dd"
},
"votype": "scripthash",
"witness": [
"304402201c283579d7b0b283ef8b65738f56d213ddce93d37c9c3eb7018afc882a4b601b022070e4dd4b094073bebbaf1dd7c2ce976e427481fd8e01c711cdb71d8e5bd12eb701",
"03b29339478464cd9409abdd553af9057f7615fafbda832341d1a28c6cd0c3a8c8"
],
"sequence": 4294967294
}
],
"txouts": [
{
"amount": "0.01759874",
"type": "scripthash",
"spent": true,
"addresses": [
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX"
],
"script": {
"asm": "OP_HASH160 23513e123ee4f44c7976c3f11b7ddf6d7b1270c4 OP_EQUAL",
"hex": "a91423513e123ee4f44c7976c3f11b7ddf6d7b1270c487",
"reqsigs": 1
}
},
{
"amount": "0.00795935",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"YSG9yf6VQch3LQdoeHw3z5CdUt2ybL1EKS"
],
"script": {
"asm": "OP_DUP OP_HASH160 1fcb09680286eb15c21df4e6a29369ee7e99dcb7 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9141fcb09680286eb15c21df4e6a29369ee7e99dcb788ac",
"reqsigs": 1
}
}
]
}
],
"meta": {
"totalCount": 2,
"index": 0,
"limit": 50,
"results": 2
}
}
Info
The Address Confirmed Transactions By Range Endpoint returns all information available about a particular address, including an array of complete transactions.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/address/${ADDRESS}/transactions-by-range/${FROM_TIMESTAMP}/${TO_TIMESTAMP}?index=0&limit=50/
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
FROM_TIMESTAMP | ------- | From timestamp of desired txs |
TO_TIMESTAMP | ------- | To timestamp of desired txs |
index | 0 | First index of returned txs |
limit | 50 | Sets the number of returned txs |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The default values of the query parameters index
and limit
are as follows: 0 and 50.
FROM_TIMESTAMP
and TO_TIMESTAMP
must be provided to get transactions with date range.
ADDRESS is a string representing the public address you’re interested in querying, for example:
RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX/transactions-by-range/1001095270/1851096294
The returned object contains information about the address, including the number of transactions associated with it, and the corresponding full transaction records in descending order by blocktime.
Get Unconfirmed Transactions By Address
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm/unconfirmed-transactions")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/address/RBirQqvEJTmsMroBqHntjzk9fw9eBiPAEj/unconfirmed-transactions")
}
Response Body
{
"payload": [
{
"txid": "70e41bed25a1985e85109ef4ecaa975e1d0937972bbb021699aa102c9247506a",
"hash": "217bef710e02a78e9d04089bd1a30b48e1ccee3762e3960c8736ed694133181c",
"version": 2,
"size": 901,
"vsize": 499,
"locktime": 48810,
"time": "2020-09-11 06:56:03 UTC",
"datetime": "2020-09-11 06:56:03 UTC",
"timestamp": 1599807363,
"fee": "0.00000832",
"txins": [
{
"txout": "9a1c62194979eaa08aaf22e97571512b12bf96c3073387eeb2b523f2c0af06ca",
"vout": 0,
"amount": "0.08324728",
"addresses": [
"RBirQqvEJTmsMroBqHntjzk9fw9eBiPAEj"
],
"script": {
"asm": "0014416b9dbd293a32054d4478a49f8bbd37269ff98c",
"hex": "160014416b9dbd293a32054d4478a49f8bbd37269ff98c"
},
"votype": "scripthash",
"witness": [
"304402207f5280a43ad1b1ebf191915b49e0206629c448598442e3f09a0e5c53eeff7991022073e039cf0d41024f51c2f89fa3800a3072935a11d6133e83ab326d63a7e7796a01",
"03237938acc3771762a0cc2b5d064b6b5f87310d6a33f58642f897d1660240c07e"
],
"sequence": 4294967294
},
{
"txout": "aa0dd41849cc4dd9ca46ba1a1f864ad96e47f97a4836fb293cb74c792cb80884",
"vout": 0,
"amount": "0.4219",
"addresses": [
"RMrhddVWvuzkhXN5RNGgCBFhg3TuZdfDcF"
],
"script": {
"asm": "00146ff3e9af6c8445cad7a959d7101eba2e461de18a",
"hex": "1600146ff3e9af6c8445cad7a959d7101eba2e461de18a"
},
"votype": "scripthash",
"witness": [
"30440220571880bd27575e8f7e4fe340c4c7842d82e7ad85c28ca67db26bb2d5d794e076022016d506df6bf1fe15c34f64a59bc10f1314ad15c79373840c2926cbe1199782e701",
"0304053561e4875cf124fe84bac3e46bba97d7cddeed20a65a4961d4b0939e8a0f"
],
"sequence": 4294967294
},
{
"txout": "49ccb214dc4223ddf2b30573e38ee7007774d28a694990ecad896e8dc471cfb1",
"vout": 1,
"amount": "28.35",
"addresses": [
"RUFhHMtgtYtcuxnGxzKyagzHLCGDmYJmRR"
],
"script": {
"asm": "0014283f5bf3603afb2bf64e1ee1e5bbbb1dd3eab08b",
"hex": "160014283f5bf3603afb2bf64e1ee1e5bbbb1dd3eab08b"
},
"votype": "scripthash",
"witness": [
"30440220042d3731149e5a09ad375fa9aa911c2644dffd3ec00111f7240c959f1b2fa91f02204416e1658fa26319b018dac54b757c6a79b7608697dc9b780edadae134df98fa01",
"03dd049b9b32ff2dc3e5f4e53f26a8833fdd93505cd0a9eb798e921c2f8d5ce427"
],
"sequence": 4294967294
},
{
"txout": "27da5e2b994d2c530f7957529e4a5ac7b3844f24307b6afd3eeb017b2d46c206",
"vout": 1,
"amount": "0.76979599",
"addresses": [
"RRtHW7myxTBMiTLmV9SZAdFxuQyw8P5tHV"
],
"script": {
"asm": "0014339c6e4237794297e236ef8be162e896b5ca8ad1",
"hex": "160014339c6e4237794297e236ef8be162e896b5ca8ad1"
},
"votype": "scripthash",
"witness": [
"30440220062ba54e33f2891a3ab0320e533ce5e341185f369f7d64646a7d4b6eb640c85d02205a11e0b19a254881fce06196df24f186e53bddce100e1356d7701cfc6d299fb501",
"0270246560f0132e8ddc5689ce4e4812368e06f132650d847f1ff03a4907cca953"
],
"sequence": 4294967294
},
{
"txout": "87af6464fad86d204534f9967e17c038b91118037f26bc6b1e4ec94731303538",
"vout": 0,
"amount": "0.01006505",
"addresses": [
"RR1wGTdNDmFqpW1bkaXoYN8GRRrJEBb4d1"
],
"script": {
"asm": "0014cb02325a9812c76057d9d8b87a43267c6e6bb324",
"hex": "160014cb02325a9812c76057d9d8b87a43267c6e6bb324"
},
"votype": "scripthash",
"witness": [
"304402202f833dccdda7803bd58e9ba1c8167e640d4ee040ac62ca707610f659544c25ca022029df0607bd486e8cb8afa0d69b92967356c73a67326c4421366655f00efd2a1f01",
"02d659400dca00b0ae71c8509520471b5788182fd959e96930220c1b3a313746af"
],
"sequence": 4294967294
}
],
"txouts": [
{
"amount": "29.635",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"Yj3wGaSPm2q6EV7d8n5RgiZUCoxPZKE6PA"
],
"script": {
"asm": "OP_DUP OP_HASH160 d7f5933f7ba5f54b7be5302ea870a71221ccb5c7 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914d7f5933f7ba5f54b7be5302ea870a71221ccb5c788ac",
"reqsigs": 1
}
}
]
}
],
"meta": {
"totalCount": 1,
"index": 0,
"limit": 50,
"results": 1
}
}
Info
The Address Unconfirmed Transactions Endpoint returns all information available about a particular address, including an array of unconfirmed transactions.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/address/${ADDRESS}/unconfirmed-transactions?index=0&limit=50
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
index | 0 | First index of returned txs |
limit | 50 | Sets the number of returned txs |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The default values of the query parameters index
and limit
are as follows: 0 and 50.
ADDRESS is a string representing the public address you’re interested in querying, for example:
XeBZBM6V6KKgPGcuqJThPbohU8DjY823Mm
The returned object contains information about the address, including the number of transactions associated with it, and the corresponding full transaction records in descending order by blocktime.
Multiple Addresses Details
Code samples
curl -X POST 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/show-multiple' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'\
-d '{
"addresses" : ["YeSZavPYQNQjNLdkDcz61HcoykiApytSK3","YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP", "2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg"]
}'
POST /v1/bc/btcv/testnet/address/show-multiple HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"addresses" : ["YeSZavPYQNQjNLdkDcz61HcoykiApytSK3","YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP", "2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg"]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/address/show-multiple",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"addresses\": [\"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP\"]}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/address/show-multiple",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ addresses:
["YeSZavPYQNQjNLdkDcz61HcoykiApytSK3","YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP", "2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg"],
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/show-multiple');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"addresses": ["YeSZavPYQNQjNLdkDcz61HcoykiApytSK3","YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP", "2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg"]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/show-multiple")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"addresses\": [\"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP\"]}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"addresses\": [\"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP\"]}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/addresses/show-multiple, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"addresses\": [\"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP\"]}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/show-multiple")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/address/show-multiple"
payload := strings.NewReader("{\n\t\"addresses\": [\"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP\"]}");
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"address": "YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP",
"totalSpent": "8332670.66913089",
"totalReceived": "8333723.45412098",
"balance": "1052.78499009",
"txi": 9731,
"txo": 9736,
"txsCount": 9734,
"addresses": [
"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP"
]
},
{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"totalSpent": "22358.70101622",
"totalReceived": "22379.98769351",
"balance": "21.28667729",
"txi": 505,
"txo": 506,
"txsCount": 981,
"addresses": [
"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3"
]
}
],
"meta": {
"totalCount": 2,
"limit": 2,
"results": 2
}
}
Info
The Multiple Addresses Details Endpoint strikes a general information about the given addresses in the array.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/address/show-multiple
Request Object
{
"addresses": [
"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"YQtE6m8ac9FPcjN9kkM6FHCQtZ5mgqUvQP",
"2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg"
]
}
Max length of the array is 10 elements
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
As you can see from the code example, you need to provide several public addresses within the addresses array.
The endpoint returns a string array with information about the addresses, including its balance in btcv and the number of transactions associated with it.
Get Basic Transaction Details By Transaction ID (Txid)
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/basic/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed")
}
Response Body
{
"payload": {
"amount": "0.06351817",
"fee": "0.00025903",
"unit": "btcv",
"datetime": "2020-09-10 14:55:00 UTC",
"timestamp": 1599749700,
"confirmations": 98,
"sent": {
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX": "0.01759874",
"RC6tNdRYCzaRcikmAtorzE9Ef3YN6zRoyU": "0.04617846"
},
"received": {
"YdevmFny3okGrrWBMHYanDG6qqvxUFBVj9": "0.04905132",
"RMgEJ9oxuGXsMqEZ34EvCDnXMBjX2mY1Bg": "0.01446685"
}
}
}
Info
The Basic Transaction By Txid Endpoint returns basic information about a given transaction based on its id.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/basic/txid/${TXID}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
TXID | ------- | Id of the transaction in blockchain |
TXID is a string
representing the id of the transaction you’re interested in querying, for example:
13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed
The returned object contains information about the transaction in JSON format, including the total amount transacted, sent, received and more.
Get Transaction Details By Transaction ID (Txid)
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/txid/13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed")
}
Response Body
{
"payload": {
"txid": "13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed",
"hash": "50f4a35982fd2b991a267d3261406e2818298ac526e1485cf8252adcb207b611",
"index": 4,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 48711,
"datetime": "2020-09-10 14:55:00 UTC",
"time": "2020-09-10 14:55:00 UTC",
"blockhash": "000000000000000004dfc6fe64d6250bca723ab4a69d6f1ae64a37d572b1bb89",
"blockheight": 48714,
"blocktime": "2020-09-10 14:55:00 UTC",
"timestamp": 1599749700,
"confirmations": 1,
"fee": "0.00025903",
"txins": [
{
"txout": "79b2f3d3d1910132658fb3832c221d38e16e46cf322fc5d2c2d14dbba309a977",
"vout": 0,
"amount": "0.01759874",
"addresses": [
"RCVw44BMX2sCF6QvYWdRGBbU7wPCmhESSX"
],
"script": {
"asm": "0014c0475c1fb66a3a761173c77a57a9d5e2cd97134f",
"hex": "160014c0475c1fb66a3a761173c77a57a9d5e2cd97134f"
},
"votype": "scripthash",
"witness": [
"304402202fed8535b88b6b5e0490c9ce3f8cf49d29dafa51692da63005463007ccb33e9502201eaf37c4c29cf19b459977b226cad252f5741aecbeebeea29aa1b4f66d8afc3401",
"02180e9d7e925942da3fdc9c5415c70a860d2c40f61046bb38f148c8f2274d8fda"
],
"sequence": 4294967294
},
{
"txout": "bb67e06a89e442391ddb88b5696d93a2d0fc93905ff3fb195694fcdf1acc1437",
"vout": 0,
"amount": "0.04617846",
"addresses": [
"RC6tNdRYCzaRcikmAtorzE9Ef3YN6zRoyU"
],
"script": {
"asm": "00147b2d8bb77d4a1dcc574837962233e7c24488d792",
"hex": "1600147b2d8bb77d4a1dcc574837962233e7c24488d792"
},
"votype": "scripthash",
"witness": [
"30440220630f72618c728f160d9d156de19c7a3fba070e670e10ac42bdb3b7e025a4f427022045458dc1451d895d2aff65dfe8c841939467b65f447c583c2ff396cd9c15f13101",
"035e54ae3986e0638116426a1d22f5ac0811c0c2fd4db7c893714dab6459124c5f"
],
"sequence": 4294967294
}
],
"txouts": [
{
"amount": "0.04905132",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"YdevmFny3okGrrWBMHYanDG6qqvxUFBVj9"
],
"script": {
"asm": "OP_DUP OP_HASH160 9cc2f5073cb298a47774d68277a6f18a44a702f3 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9149cc2f5073cb298a47774d68277a6f18a44a702f388ac",
"reqsigs": 1
}
},
{
"amount": "0.01446685",
"type": "scripthash",
"spent": false,
"addresses": [
"RMgEJ9oxuGXsMqEZ34EvCDnXMBjX2mY1Bg"
],
"script": {
"asm": "OP_HASH160 87fced8bc253b968daaa2bb00397743a6faaa7f1 OP_EQUAL",
"hex": "a91487fced8bc253b968daaa2bb00397743a6faaa7f187",
"reqsigs": 1
}
}
]
}
}
Info
The Transaction Txid Endpoint returns detailed information about a given transaction based on its id.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/txid/${TXID}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
TXID | ------- | Id of the transaction in blockchain |
TXID is a string
representing the id of the block you’re interested in querying, for example:
13436ea7e04ce5cf58bffd093460bb9c4afbee34166fc4f664ad6d698a61aaed
The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it (in bitcoins), the inputs and outputs, and more.
Get Unconfirmed Transaction Details By Transaction ID (Txid)
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/unconfirmed/txid/25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148")
}
Response Body
{
"payload": {
"txid": "25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148",
"hash": "25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148",
"version": 1,
"size": 224,
"vsize": 224,
"locktime": 0,
"time": "2020-09-11 06:44:50 UTC",
"datetime": "2020-09-11 06:44:50 UTC",
"txins": [
{
"txout": "5fa038e294488622bb6225756341a8941207fc53a2308b1874d8171ba8167828",
"vout": 1,
"amount": "883.815812",
"addresses": [
"Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE"
],
"script": {
"asm": "3045022100edeed912477e20eaaf41758c1dd038de69a9a748b386fdda3721b408383192a302203b4c72268c8f0885db110f67b3ae5deceafe4d0e26a2276f7cbdfcf68ef56784[ALL] 0212469aa07a59560da7066b5b86f030eb62a0fd5ac71e6e3ef2a6f24a3fe5f5e8",
"hex": "483045022100edeed912477e20eaaf41758c1dd038de69a9a748b386fdda3721b408383192a302203b4c72268c8f0885db110f67b3ae5deceafe4d0e26a2276f7cbdfcf68ef5678401210212469aa07a59560da7066b5b86f030eb62a0fd5ac71e6e3ef2a6f24a3fe5f5e8"
},
"votype": "pubkeyhash",
"sequence": 4294967295
}
],
"txouts": [
{
"amount": "26.1211441",
"type": "scripthash",
"spent": false,
"addresses": [
"RMLtFBy35EXaY1MvKv57a3Y7nAfaubXE6g"
],
"script": {
"asm": "OP_HASH160 8454496e4015b2847a8574df1cf1ad5c797f0da9 OP_EQUAL",
"hex": "a9148454496e4015b2847a8574df1cf1ad5c797f0da987",
"reqsigs": 1
}
},
{
"amount": "857.6896679",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE"
],
"script": {
"asm": "OP_DUP OP_HASH160 b620047e2947a5c036aff69c677a75b589231684 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914b620047e2947a5c036aff69c677a75b58923168488ac",
"reqsigs": 1
}
}
]
}
}
Info
The Unconfirmed Transaction By Txid Endpoint returns detailed information about a given transaction based on its id.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/unconfirmed/txid/${TXID}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
TXID | ------- | Id of the transaction in blockchain |
TXID is a string
representing the id of the block you’re interested in querying, for example:
25dcc96293b90cd03cdd816f5d4f0634bae533f04cd62ae5d7d92bfef391b148
The returned object contains information about the transaction in JSON format, the total amount transacted with it (in bitcoins), the inputs and outputs, and more.
Get Transactions By Block Number
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/block/00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf")
}
Response Body
{
"payload": [
{
"txid": "395604bca51a23a3bcfbb8ecf688267af847d9880304f22768862c6d00c12d0a",
"hash": "7bf3eb471a8d3b333a5ed92cc7f664b4e6b684385e3a479032f5363c556175f3",
"index": 0,
"version": 2,
"size": 197,
"vsize": 170,
"locktime": 0,
"datetime": "2020-09-10 15:30:33 UTC",
"time": "2020-09-10 15:30:33 UTC",
"blockhash": "00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf",
"blockheight": 48715,
"blocktime": "2020-09-10 15:30:33 UTC",
"timestamp": 1599751833,
"confirmations": 111,
"fee": "0",
"txins": [
{
"coinbase": "034bbe000499465a5f2f57444d4f2e322f080447d2ee1ae00000000000",
"addresses": [],
"sequence": 4294967295
}
],
"txouts": [
{
"amount": "150.06083466",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"YhZ5F3s9GJZBg1URrLyyGH7YuLAScLFuqK"
],
"script": {
"asm": "OP_DUP OP_HASH160 c7880ae79a6e2e46444a8dcf54618ee5820955e0 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914c7880ae79a6e2e46444a8dcf54618ee5820955e088ac",
"reqsigs": 1
}
},
{
"amount": "0",
"type": "nulldata",
"spent": true,
"addresses": [],
"script": {
"asm": "OP_RETURN aa21a9ed31a2e230e2cf04f86c2a52568dc215597e0798484cebcc50c3993836e25babdf",
"hex": "6a24aa21a9ed31a2e230e2cf04f86c2a52568dc215597e0798484cebcc50c3993836e25babdf"
}
}
]
},
...
{
"txid": "abc75e07527ed92af5a9d5ab68a413ae0bead55cc0e6048e1b5b8b8548abc23e",
"hash": "b582e4e27275cab97920ae660803024b474254f96de6ce8cc40887dae41b5165",
"index": 23,
"version": 2,
"size": 519,
"vsize": 276,
"locktime": 48714,
"datetime": "2020-09-10 15:30:33 UTC",
"time": "2020-09-10 15:30:33 UTC",
"blockhash": "00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf",
"blockheight": 48715,
"blocktime": "2020-09-10 15:30:33 UTC",
"timestamp": 1599751833,
"confirmations": 111,
"fee": "0.00000277",
"txins": [
{
"txout": "837b694b00f368d06055691b714b9dfa691aefabc08fd1cc58fb9d02e1042dd1",
"vout": 1,
"amount": "0.00793843",
"addresses": [
"royale1qm9k3lmkltuejaeagge4rk6h98gh9rcsyw85ukp"
],
"script": {
"asm": "",
"hex": ""
},
"votype": "witness_v0_keyhash",
"witness": [
"30440220582c32552391b742ab560058ab65df61b119444e9d73061ba86cea183b0ccf7a02203f6b16b1b9b63a75edd2e448e0255a9568b13eff15cde1bb4f5b866652a103f601",
"0360a64756bb08a45fcc510ef17dc46999ed9f13af6742e3c152f07177c228e86f"
],
"sequence": 4294967293
},
{
"txout": "1151e25124c1a9a9a7fcb8a96397604db1b3f180738074135a8609befecf284e",
"vout": 1,
"amount": "0.00102068",
"addresses": [
"royale1qmvnfzch9xs6udez6mfd2wsvqdjxnnmyyn9uqrs"
],
"script": {
"asm": "",
"hex": ""
},
"votype": "witness_v0_keyhash",
"witness": [
"30450221009a0651e4e846d59bee1125a475b4e1901bfe4480425c424806c9ebda9f72329f02200e200cacfe4662a7f3cdc210a10d5140016aacafdd9bbf72355d3f211508d19501",
"0269e0a4ed8d8018e12090dced23e342ba73fd2d256a8c9cdc8db96e2b7565cfb9"
],
"sequence": 4294967293
},
{
"txout": "64e1e2972c7f3d653bd24d3c74302c60050b9686710dab265e98951bbc4031f0",
"vout": 0,
"amount": "0.00440381",
"addresses": [
"royale1q2vcfs7zeel7ykxjy02tzcejeypkdv7dtn3l97c"
],
"script": {
"asm": "",
"hex": ""
},
"votype": "witness_v0_keyhash",
"witness": [
"304402200776cacc3d9d972cb7d9ae5f11a690b55c017fb1732160f6bebacd22f1cd06ae0220379214c9995bee2e0f2b1d2d72bae9a0639f4d4f70b0da9cd8e478de5166eaaa01",
"038f68f10e18e27b27a6d76dd49e24f4e19a5878f276a54339f30b3ff01530f5dd"
],
"sequence": 4294967293
}
],
"txouts": [
{
"amount": "0.00323607",
"type": "witness_v0_keyhash",
"spent": false,
"addresses": [
"royale1qlqnpzpsn8v7jnamzc6693v82xmmw0qk923tn2e"
],
"script": {
"asm": "0 f8261106133b3d29f762c6b458b0ea36f6e782c5",
"hex": "0014f8261106133b3d29f762c6b458b0ea36f6e782c5",
"reqsigs": 1
}
},
{
"amount": "0.01012408",
"type": "witness_v0_keyhash",
"spent": false,
"addresses": [
"royale1qxjsazvzugj2ctwy9ka0p6hmgucg8x02pj3f59s"
],
"script": {
"asm": "0 34a1d1305c449585b885b75e1d5f68e610733d41",
"hex": "001434a1d1305c449585b885b75e1d5f68e610733d41",
"reqsigs": 1
}
}
]
}
],
"meta": {
"totalCount": 24,
"index": 0,
"limit": 50,
"results": 24
}
}
Info
The Transaction Index by Block Endpoint returns detailed information about a list of transactions. The endpoint is useable both with block height and block hash. index
and limit
query parameters might also be used, as their default values are, as follows: 0, 1. Therefore, if none is specified the returned object will be the first transaction (the coinbase transaction) included in the block.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/block/${BLOCK}?index=0&limit=1
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
BLOCK | ------- | Block height or block hash in blockchain |
index | 0 | index to start from |
limit | 1 | number of transactions to be returned |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
BLOCK is a string
or an integer
representing the hash or the height of the block you’re interested in querying, for example:
00000000000000000558bdf85c4fc979355f0c35181972528b5112a415c7afbf
or
48715
The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it (in bitcoins), the inputs and outputs, and more.
Get Unconfirmed Transactions
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs/unconfirmed HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed",
"method": "GET",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("https");
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"port": null,
"path": "/v1/bc/btcv/mainnet/txs/unconfirmed",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed"
headers = {
'content-type': "application/json",
'authorization': "my-api-key"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed")
.get()
.addHeader("authorization", "my-api-key")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/unconfirmed"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "my-api-key")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"txid": "154f966557268d848654630bafe8f3e3a3d5098c50c4ae6b3c2b9d76747b1dc3",
"hash": "154f966557268d848654630bafe8f3e3a3d5098c50c4ae6b3c2b9d76747b1dc3",
"version": 1,
"size": 224,
"vsize": 224,
"locktime": 0,
"time": "2020-09-11 06:30:40 UTC",
"datetime": "2020-09-11 06:30:40 UTC",
"timestamp": 1599805840,
"txins": [
{
"txout": "3421676035ff640719c60520904f07dfbcc5abddb4f9a9845f51daf62e689cc3",
"vout": 1,
"amount": "20.181275",
"addresses": [
"Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE"
],
"script": {
"asm": "3045022100e9381c15bc340cb7e9c5052673e05991d26535dd21d4993738c8bed9e943a01102201d4f8b0bc14ff4318f91cc44294e1dc0ebb9e2bdaaf1e8d7fac127bd7e07c929[ALL] 0212469aa07a59560da7066b5b86f030eb62a0fd5ac71e6e3ef2a6f24a3fe5f5e8",
"hex": "483045022100e9381c15bc340cb7e9c5052673e05991d26535dd21d4993738c8bed9e943a01102201d4f8b0bc14ff4318f91cc44294e1dc0ebb9e2bdaaf1e8d7fac127bd7e07c92901210212469aa07a59560da7066b5b86f030eb62a0fd5ac71e6e3ef2a6f24a3fe5f5e8"
},
"votype": "pubkeyhash",
"sequence": 4294967295
}
],
"txouts": [
{
"amount": "1.095",
"type": "scripthash",
"spent": false,
"addresses": [
"RQuPAZ37L5SPjDJYnxWngHxsyQ4YxdAyvb"
],
"script": {
"asm": "OP_HASH160 ab621dc03d407071d09d63708d86515ee2968e53 OP_EQUAL",
"hex": "a914ab621dc03d407071d09d63708d86515ee2968e5387",
"reqsigs": 1
}
},
{
"amount": "19.081275",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE"
],
"script": {
"asm": "OP_DUP OP_HASH160 b620047e2947a5c036aff69c677a75b589231684 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914b620047e2947a5c036aff69c677a75b58923168488ac",
"reqsigs": 1
}
}
]
}
],
"meta": {
"totalCount": 1,
"index": 0,
"limit": 50,
"results": 1
}
}
Info
The Unconfirmed Transactions Endpoint returns an array of the latest transactions relayed by nodes in a blockchain that haven’t been included in any blocks.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/unconfirmed?index=0&limit=100
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
index | 0 | skip parameter |
limit | ------- | Sets the number of returned txs |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
The returned object is an array of transactions that haven’t been included in blocks, arranged in reverse chronological order (latest is first, then older transactions follow).
Get Raw Transaction Hex By Transaction ID (Txid)
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/raw/txid/0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64")
}
Response Body
{
"payload": {
"hex": "0200000000010277a909a3bb4dd1c2d2c52f32cf466ee1381d222c83b38f65320191d1d3f3b2790000000017160014c0475c1fb66a3a761173c77a57a9d5e2cd97134ffeffffff3714cc1adffc945619fbf35f9093fcd0a2936d69b588db1d3942e4896ae067bb00000000171600147b2d8bb77d4a1dcc574837962233e7c24488d792feffffff02acd84a00000000001976a9149cc2f5073cb298a47774d68277a6f18a44a702f388ac1d1316000000000017a91487fced8bc253b968daaa2bb00397743a6faaa7f1870247304402202fed8535b88b6b5e0490c9ce3f8cf49d29dafa51692da63005463007ccb33e9502201eaf37c4c29cf19b459977b226cad252f5741aecbeebeea29aa1b4f66d8afc34012102180e9d7e925942da3fdc9c5415c70a860d2c40f61046bb38f148c8f2274d8fda024730440220630f72618c728f160d9d156de19c7a3fba070e670e10ac42bdb3b7e025a4f427022045458dc1451d895d2aff65dfe8c841939467b65f447c583c2ff396cd9c15f1310121035e54ae3986e0638116426a1d22f5ac0811c0c2fd4db7c893714dab6459124c5f47be0000"
}
}
Info
The Get Raw Transaction Endpoint returns raw transaction hex about a given transaction based on its id.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/raw/txid/${TXID}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
TXID | ------- | Id of the transaction in blockchain |
TXID is a string
representing the id of the transaction you’re interested in querying, for example:
0092e56ef024f79c76cbd9a55efb6e28a7ff22c950f65521e3b380f889c28d64
The returned object contains information about the transaction in JSON format, including its raw transaction hex.
Get Unspent Transaction Outputs By Address
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/testnet/address/Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE/unspent-transactions")
}
Response Body
{
"payload": [
{
"txid": "96302ce4528c8c0da3279266056611aa9281d78ed8cd2ab25dcac87ce61d6670",
"vout": 1,
"amount": 62.270655
},
{
"txid": "7a28341eb0d0553db1eba32deb00e4304b6eab8042588591e4ed39e207813fd9",
"vout": 1,
"amount": 199.99983788
}
],
"meta": {
"totalCount": 2850,
"results": 2850
}
}
Info
The Unspent Transaction Outputs Endpoint returns the needed information of the previous unspent transaction outputs (also known as UTXOs) to build new transaction.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/address/${ADDRESS}/unspent-transactions
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
Meta Response
Variable | Type | Description |
---|---|---|
totalCount | int | Total count of the items in the listing for the given criteria |
index | int | Sequential index number of the items list start position (depends on the skip parameter) for the given criteria |
limit | int | Limit number of the items list (depends on the limit parameter) for the given criteria. |
results | int | Count of the items listed in the current response for the given criteria |
ADDRESS is a string representing the public address you’re interested in querying, for example:
Yfy3915VPWXgnSxgs14em39uB7fXBy4MSE
The returned object contains the needed information about the unspent transaction outputs of an address to build a transaction.
HD Wallets
Hierarchical Deterministic (HD) Wallets
We also offer support for HD Wallets, which make it easy to manage multiple addresses under a single name. All HD wallet addresses are derived from a single seed. Please see BIP32 for more background on HD wallets.
HD Wallets can be created, deleted, and have new addresses generated. However, unlike normal Wallets, addresses cannot be removed.
When creating a wallet, one can optionally include one or more “subchain” indexes. These subchains can later be referenced when generating new addresses or sending txs. If none are provided in wallet creation, the wallet will derive & use addresses straight from the given extended pubkey. If no index is given when using the wallet with other APIs, it defaults to using the wallet’s first (sub) chain.
In BIP32 notation, the wallet layout is m/0, m/1, … and m/i/0, m/i/1, … for each subchain i if the wallet has subchains. For example, the path of the fourth address generated is m/3 for a non-subchain wallet. The path of the fourth address at subchain index two is m/2/3. Note that this is different from the default BIP32 wallet layout.
If you want to use BIP32 default wallet layout you can submit the extended public key of m/0’ (which can only be derived from your master private key) with subchain indexes = [0, 1]. Subchain index 0 represents the external chain (of account 0) and will discover all k keypairs that look like: m/0’/0/k. Subchain index 1 represents the internal chain (of account 0) and will discover all k keypairs in m/0’/1/k.
If you want to use BIP 44 layout (for btcv), you can submit the extended public key of m/44’/0’/0’. (which can only be derived from your master private key) with subchain indexes = [0, 1]. Subchain index 0 represents the external chain (of account 0) and will discover all k keypairs in m/44’/0’/0’/0/k. Subchain index 1 represents the internal chain (of account 0) and will discover all k keypairs in m/44’/0’/0’/1/k.
If an address ahead of current addresses listed in an HD Wallet receives a transaction, it will be added, along with any addresses between the new address and the last used one.
Using Hierarchical Deterministic (HD) Wallets
HD Wallets can be leveraged by the Address API, just by using their $NAME instead of $ADDRESS. They can also be used with Events and with the Transaction API. In general, using a wallet instead of an address in an API will have the effect of batching the set of addresses contained in the wallet
The following code examples should be considered serially; that is to say, the results will appear as if each API call were done sequentially. Also, $NAME is a string representing the name of your wallet, for example:
alice
Create HD Wallet
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/ \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"walletName" : "demohdwallet",
"addressCount" : 5,
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}'
POST /v1/bc/btcv/testnet/wallets/hd HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"walletName" : "demohdwallet",
"addressCount" : 5,
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
walletName: 'demohdwallet',
addressCount: 5,
password: '8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"walletName" : "demohdwallet",
"addressCount" : 5,
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/wallets/hd", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd"
payload := strings.NewReader("{\n\t\"walletName\" : \"demohdwallet\",\n\t\"addressCount\" : 5,\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"walletName": "btcv_wallet",
"addresses": [
{
"address": "mmyJbPNd5xHMnqHsMqr8q3soEGCUywjRej",
"path": "M/0H/0/0"
},
{
"address": "mkyRyp4FaCHbSYLKHnnAuZAB9GJxKysS2v",
"path": "M/0H/0/1"
},
{
"address": "mrJ2sVXRF9oeKC3WnFaFVeLhKTdEwE4URB",
"path": "M/0H/0/2"
},
{
"address": "mi7xjFk55ucfUeyeG1QeKQyb6GjtwMBtaG",
"path": "M/0H/0/3"
},
{
"address": "msdPCVKdVRtCvsLoLdV1VkRpH52J8nkwfu",
"path": "M/0H/0/4"
}
],
"totalBalance": "0.00000000"
},
"meta": {
"totalCount": 5,
"limit": 14979,
"results": 5
}
}
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
HD_WALLET_NAME | ------- | Wallet name |
ADDRESSES | ------- | Array of addresses that will be added to wallet |
ADDRESS_COUNT | ------- | Number of addresses that should be generated in the new wallet |
PASSWORD | ------- | Wallet password |
Request HD Wallet Object
{
"walletName" : ${HD_WALLET_NAME},
"addressCount" : ${ADDRESS_COUNT},
"password" : ${PASSWORD}
}
This endpoint allows you to create a new wallet, by POSTing a partially filled out Wallet or HDWallet object, depending on the endpoint.
For HD wallets, you must include HD_WALLET_NAME, the ADDRESS_COUNT and the PASSWORD attributes.
If successful, it will return a Wallet or HDWallet object with the data you requested.
List My HD Wallets
Sample Data
curl -X GET \
https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd \
-H 'Content-Type: application/json'
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/wallets/hd HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
"Content-Type": "application/json",
"X-API-Key", "my-api-key"
}
conn.request("GET", "/v1/bc/btcv/testnet/wallets/hd", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
"newhdwallet",
"specialhdwallet"
],
"meta": {
"totalCount": 2,
"results": 2
}
}
HTTP Request
GET /v1/bc/btcv/${NETWORK}/wallets/hd
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
This endpoint returns a string array ($NAMEARRAY) of active HD Wallets names under the token you queried. You can then query detailed information on individual wallets (via their names) by leveraging the Get HD Wallet Endpoint.
Get HD Wallet Details
Sample Data
curl -X GET \
https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/wallets/hd/btcv_wallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd/btcv_wallet",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
"Content-Type": "application/json",
"X-API-Key", "my-api-key"
}
conn.request("GET", "/v1/bc/btcv/testnet/wallets/hd/btcv_wallet", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"walletName": "btcv_wallet",
"addresses": [
{
"address": "mmyJbPNd5xHMnqHsMqr8q3soEGCUywjRej",
"path": "M/0H/0/0",
"balance": "0.00000000"
},
{
"address": "mkyRyp4FaCHbSYLKHnnAuZAB9GJxKysS2v",
"path": "M/0H/0/1",
"balance": "0.00000000"
},
{
"address": "mrJ2sVXRF9oeKC3WnFaFVeLhKTdEwE4URB",
"path": "M/0H/0/2",
"balance": "0.00000000"
},
{
"address": "mi7xjFk55ucfUeyeG1QeKQyb6GjtwMBtaG",
"path": "M/0H/0/3",
"balance": "0.00000000"
},
{
"address": "msdPCVKdVRtCvsLoLdV1VkRpH52J8nkwfu",
"path": "M/0H/0/4",
"balance": "0.00000000"
}
],
"totalBalance": "0.00000000"
}
}
HTTP Request
GET /v1/bc/btcv/${NETWORK}/wallets/hd/${HD_WALLET_NAME}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
HD_WALLET_NAME | ------- | Wallet name |
This endpoint returns a Wallet or HDWallet based on its HD_WALLET_NAME.
Get HD Wallet Transactions
Sample Data
curl -X GET \
https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions",
"method": "GET",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
"Content-Type": "application/json",
"X-API-Key", "my-api-key"
}
conn.request("GET", "/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions")
.get()
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/btcv_wallet/transactions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": [
{
"txid": "fde8b314d25aee0037406dfda4dccba203bed73d10959979b522b871d62863cc",
"hash": "9728dc15f8cade1188710dcf0afc25e1b9da26095dfbeed10c95b5d5c20d5a4f",
"index": 1,
"version": 2,
"size": 251,
"vsize": 170,
"locktime": 0,
"datetime": "2020-07-13 07:10:56 UTC",
"time": "2020-07-13 07:10:56 UTC",
"blockhash": "0000000000000eb92338aee4b5efc3c4a410a62f992b3b436be4b2728e86708c",
"blockheight": 92959,
"blocktime": "2020-07-13 07:10:56 UTC",
"timestamp": 1594624256,
"confirmations": 1041,
"fee": "0.01",
"txins": [
{
"txout": "a2b5f1bd26537d319607beb018598d71498d760ea132627e216f49f81bbbf567",
"vout": 0,
"amount": "100",
"addresses": [
"2N2TDuwue63w4nghHXQouHZRA4EBxaEcava"
],
"script": {
"asm": "001455003a1bd1257d2083e747be58656ad6f638b82b",
"hex": "16001455003a1bd1257d2083e747be58656ad6f638b82b"
},
"votype": "scripthash",
"witness": [
"30440220283df13d21630f03a70a9affaf0a80734c8c7660e63092148da654347c15729802201b858e7fc7515400da77dd1c33a71cbe94119082dd4b81d3da603a24670bb7e401",
"03cb96d45fb8da752edd0804bfbd656d68c0955b7c24abfbfc435eff2f6822d64b"
],
"sequence": 4294967295
}
],
"txouts": [
{
"amount": "99.99",
"type": "scripthash",
"spent": false,
"addresses": [
"2N2TDuwue63w4nghHXQouHZRA4EBxaEcava"
],
"script": {
"asm": "OP_HASH160 64fe0fa9ba56e06b14fdcde5773fa3113bd2e505 OP_EQUAL",
"hex": "a91464fe0fa9ba56e06b14fdcde5773fa3113bd2e50587",
"reqsigs": 1
}
},
{
"amount": "0",
"type": "nulldata",
"spent": true,
"addresses": [],
"script": {
"asm": "OP_RETURN 4c5478aa430bbcae530aae9d82b54412cd51e89a63bc910000",
"hex": "6a194c5478aa430bbcae530aae9d82b54412cd51e89a63bc910000"
}
}
]
}
],
"meta": {
"totalCount": 1,
"index": 0,
"limit": 50,
"results": 1
}
}
HTTP Request
GET /v1/bc/btcv/${NETWORK}/wallets/hd/${HD_WALLET_NAME}/transactions
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
HD_WALLET_NAME | ------- | Wallet name |
This endpoint returns array of the Transactions associated with the HDWallet based on its HD_WALLET_NAME.
Generate Address in HD Wallet
Sample Data
#### hd wallet
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate \
-H 'content-type: application/json' \
-H 'authorization: my-api-key' \
-d '{
"addressCount": 3,
"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}'
#### hd wallet
POST /v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json
{
"addressCount": 3,
"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate",
"method": "POST",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
},
"processData": false,
"data": "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("https");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"port": null,
"path": "/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ addressCount: 3, password: '8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'my-api-key'
));
$request->setBody('{
"addressCount": 3,
"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["authorization"] = 'my-api-key'
request["content-type"] = 'application/json'
request.body = "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cryptoapis.io")
payload = "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}"
headers = {
'authorization': "my-api-key",
'content-type': "application/json"
}
conn.request("POST", "/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate")
.post(body)
.addHeader("authorization", "my-api-key")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet/addresses/generate"
payload := strings.NewReader("{\n\t\"addressCount\": 3,\n\t\"password\": \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "my-api-key")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"addresses": [
{
"address": "YT4NJiQ855WDtYiYSoQwLLnhr4CGKcPmZu",
"path": "M/0H/0/3"
},
{
"address": "YZSVLfaUFPPf1cw3y57Z2h1aBieWX1vvTR",
"path": "M/0H/0/4"
},
{
"address": "YYawFQBYWjntFZpp8Lm4kMDbSQ7SbyW2Wt",
"path": "M/0H/0/5"
}
],
"walletName": "demohdwallet"
}
}
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/${HD_WALLET_NAME}/addresses/generate
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
HD_WALLET_NAME | ------- | HD Wallet name |
Request HD Wallet Object
{
"addressCount" : ${ADDRESS_COUNT},
"password" : ${ENCRYPTED_PASSWORD}
}
This endpoint allows you to generate a new address associated with the HD_WALLET_NAME wallet, similar to the Generate Address Endpoint. If successful, it will return the newly created addresses.
Delete HD Wallet
curl -X DELETE \
https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
DELETE /v1/bc/btcv/mainnet/wallets/hd/demohdwallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet",
"method": "DELETE",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "DELETE",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/wallets/hd/demohdwallet",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("DELETE", "/v1/bc/btcv/mainnet/wallets/hd/demohdwallet", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet")
.delete(null)
.addHeader("content-type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/demohdwallet"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("content-type", "application/json")
req.Header.Add("cache-control", "no-cache")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"message": "Wallet demohdwallet was successfully deleted!"
}
}
HTTP Request
DELETE /v1/bc/btcv/${NETWORK}/wallets/hd/${HD_WALLET_NAME}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
HD_WALLET_NAME | ------- | Wallet name |
This endpoint deletes HD Wallet with HD_WALLET_NAME.
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
HD_WALLET_NAME | ------- | Wallet name |
Import Address as an HD Wallet
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/import\
-H 'content-type: application/json' \
-H 'authorization: my-api-key' \
-d '{
"walletName": "testImportWallet",
"password": "SECRET123456",
"privateKey": "8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b",
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1"
}'
POST /v1/bc/btcv/testnet/wallets/hd/import HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json
{
"walletName": "testImportWallet",
"password": "SECRET123456",
"privateKey": "8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b",
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/import",
"method": "POST",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
},
"processData": false,
"data": "{\n \"walletName\": \"testImportWallet\",\n \"password\": \"SECRET123456\",\n \"privateKey\": \"8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b\",\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("https");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd/import,
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ walletName: 'testImportWallet',
password: 'SECRET123456',
privateKey: '8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b',
address: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/import');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'my-api-key'
));
$request->setBody('{
"walletName": "testImportWallet",
"password": "SECRET123456",
"privateKey": "8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b",
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["authorization"] = 'my-api-key'
request["content-type"] = 'application/json'
request.body = "{\n \"walletName\": \"testImportWallet\",\n \"password\": \"SECRET123456\",\n \"privateKey\": \"8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b\",\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.cryptoapis.io")
payload = "{\n \"walletName\": \"testImportWallet\",\n \"password\": \"SECRET123456\",\n \"privateKey\": \"8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b\",\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\"\n}"
headers = {
'authorization': "my-api-key",
'content-type': "application/json"
}
conn.request("POST", "/v1/bc/btcv/testnet/wallets/hd/demohdwallet/addresses/generate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"walletName\": \"testImportWallet\",\n \"password\": \"SECRET123456\",\n \"privateKey\": \"8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b\",\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/import")
.post(body)
.addHeader("authorization", "my-api-key")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/import"
payload := strings.NewReader("{\n \"walletName\": \"testImportWallet\",\n \"password\": \"SECRET123456\",\n \"privateKey\": \"8aeb39b5f9b0xxxxxxxc7001c1cecc112712c9448b\",\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "my-api-key")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"walletName": "testImportWallet",
"addresses": [
{
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1"
}
]
}
}
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/import
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
Request HD Wallet Object
{
"password" : ${ENCRYPTED_PASSWORD},
"walletName": ${HD_WALLET_NAME},
"privateKey": ${ADDRESS_PRIVATE_KEY},
"address": ${ADDRESS}
}
This endpoint allows you to import a btcv address. Although it is only an address it will be treated as an HDwallet. Therefore, with the imported wallet users can make transactions and payment forwardings. Moreover, imported wallets can be listed and deleted.
Transactions
Crypto APIs Transaction API allows you to create and propagate your own transactions, including multisignature transactions, and embed data on the blockchain—all based on the coin/chain resource you’ve selected for your endpoints.
If you’re new to blockchains, the idea of transactions is relatively self-explanatory. Here’s what’s going on underneath the hood: a transaction takes previous “unspent transaction outputs” (also known as UTXOs) as “transaction inputs” and creates new “locking scripts” on those inputs such that they are “sent” to new addresses (to become new UTXOs). While most of these public addresses are reference points for single private keys that can “unlock” the newly created UTXOs, occasionally they are sent to more exotic addresses through pay-to-script-hash, typically multisignature addresses.
Generally speaking, UTXOs are generated from previous transactions (except for Coinbase inputs).
Prepare a Transaction
Info
Using Crypto APIs, you can push transactions to blockchains one of two ways:
Use our two-endpoint process outlined below, wherein we generate a TXSkeleton based on your input address, output address, and value to transfer. In either case, for security reasons, we never take possession of your private keys. We do use private keys with our Microtransaction API, but they are for low-value transactions and we discard them immediately from our servers’ memory.
New Transaction Endpoint
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"inputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0004
}, {
"address": "RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE",
"value": 0.0004
}],
"outputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0008
}],
"fee": {
"address" : "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.00023141
}
}'
POST /v1/bc/btcv/testnet/txs/size HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"inputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0004
}, {
"address": "RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE",
"value": 0.0004
}],
"outputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0008
}],
"fee": {
"address" : "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.00023141
}
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/txs/size",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ inputs:
[ { address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb', value: 0.0004 },
{ address: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1', value: 0.0004 } ],
outputs: [ { address: 'mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9', value: 0.0008 } ],
fee:
{ address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb',
value: 0.00023141 },
data: 'CRYPTOAPISROCKS'}));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"inputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0004
}, {
"address": "RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE",
"value": 0.0004
}],
"outputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0008
}],
"fee": {
"address" : "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.00023141
}
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/txs/size, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size"
payload := strings.NewReader("{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000"
}
}
To use Crypto APIs two-endpoint transaction creation tool, first you need to provide the input address(es), output address, and value to transfer (in bitcoin). Provide this in a partially-filled out TX request object.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/create
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
As you can see from the code example, you only need to provide a single public address within the addresses array of both the input and output of your TX request object. You also need to fill in the value with the amount you’d like to transfer from one address to another.
Required fields are:
{
"inputs": [{
"address": "...",
"value": ...
},
...],
"outputs": [{
"address": "...",
"value": ...
},
...],
"fee": {
"address": "...",
"value": ...
}
}
As a return object, you’ll receive a JSON containing a slightly-more complete TX alongside data you need to sign in the tosign array. You’ll need this object for the next steps of the transaction creation process.
Validating the Data to Sign
For the extra cautious, you can protect yourself from a potential malicious attack on Crypto APIs by validating the data we’re asking you to sign. Unfortunately, it’s impossible to do so directly, as pre-signed signature data is hashed twice using SHA256. To get around this, set the includeToSignTx URL flag to true. The optional tosign_tx array will be returned within the JSON, which you can use in the following way:
- Decoding the hex-encoded string using our /txs/decode endpoint (or an independent, client-side source) should give you the output addresses and amounts that match your work-in-progress transaction.
Sign a Transaction
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/sign \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"hex":"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"wifs" : [
"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc"
]
}'
POST /v1/bc/btcv/testnet/txs/sign HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex":"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"wifs" : [
"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc"
]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/sign",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wifs\" : [\n \"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc\"\n ]\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/sign",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ hex: '020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000',
wifs: [ 'cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc' ] }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/sign');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex":"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"wifs" : [
"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc"
]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/sign")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wifs\" : [\n \"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc\"\n ]\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wifs\" : [\n \"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc\"\n ]\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/txs/sign", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wifs\" : [\n \"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc\"\n ]\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/sign")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/sign"
payload := strings.NewReader("{\n \"hex\":\"020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd9810000000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00100000000ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be00200000000ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wifs\" : [\n \"cSCpMqmAdbdsyj7PNg3iz6..........hN79AGyScDYc4j7Wo2mc\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"hex": "020000000393d3ba1a02fd978b494e79ed199247079eb4f766fadc0b807c0734d4b18bd981000000006a47304402202769801183cd50eb2bd6c316a55add49fa4c0fd7216b523f394b97fe410b582d02205c76f4009b38b82a20f88b5f6af45f09220ba43d7e1c2064fa74807ddb299d7f012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be0010000006a47304402204a24a1de4b4e552d1f53121825d139b1d1739d149df5a01d2ead760b865635c2022047a9b8f4d29dac29e9eacff6aea67249dcf716d576a00dbe24cf92c34a272909012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff7dbd03383a240f27c7735af707e823da894e11732c5fe5919adff1672b817be0020000006a473044022057a3fa58744fffebcb8a1bea4a99bd61049678d4ee9250c5f66ea17198ebd97a022078abef9098838d06e9a51099ce010f0dc74c6b1284de03a929bcdabab8fd4cd40121039299b5f32a4834e27662397b7ade9cacdd9cd7243b83c039c22da3c6dc0b28c7ffffffff0320bf0200000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac08c60000000000001976a9148bafc8dad0c87025278b4cc1c80ac8d402cb59eb88ac0c8c0000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"complete": true
}
}
Info
The Sign a Transaction Endpoint allows users to sign a raw transaction.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/sign
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
The returned object is a hexadecimal string that represents the signed transaction. This hexadecimal is used by the Broadcast a Signed Transaction Endpoint in order to broadcast the transaction into the Bitcoin blockchain.
Broadcast a Signed Transaction
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/send/ \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"hex" : "02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000"
}'
POST /v1/bc/btcv/testnet/txs/send HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex" : "02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/send",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/send",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ hex: '02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/send');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex" : "02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/send")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/txs/send", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/send")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/send"
payload := strings.NewReader("{\n\t\"hex\" : \"02000000012ef6ff4aaa76aaff4bea235df134923a830a89d2fbdea5fdc330c9a42eb920a8010000006a47304402205c44fb58b3eaa907cccb2cac87749f00cb52f0d050d183ebba80d672413b9a540220749c8b53665db9f36d5e760ad627b0e22072a6cf91a5d77d35ac2b95d4c1ea54012102275753690ab58df3c923001e94d407e30b03e60b1f2461729a1dd4f37ebe2469ffffffff02c8320000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac80380100000000001976a9147b9a627a184897f10d31d73d87c2eea191d8f50188ac00000000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"txid": "00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a",
"view_in_explorer": "https://blockexplorer.one/btcv/testnet/tx/00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a/?utm_source=cryptoapis.io"
}
}
Transaction Send Endpoint allows users to broadcast the signed transaction to the Bitcoin blockchain.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/send
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
If broadcasting is successful, you’ll receive a JSON with the hash of the unconfirmed transaction.
Prepare, Sign and Broadcast a Transaction
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/new \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"createTx": {
"inputs": [{
"address": "2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE",
"value": 0.00005
}],
"outputs": [{
"address": "troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324",
"value": 0.00018
}],
"fee": {
"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"value": 0.00023141
}
},
"wifs" : [
"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX", "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud", "cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ"
]
}'
POST /v1/bc/btcv/testnet/txs/new HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"createTx": {
"inputs": [{
"address": "2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE",
"value": 0.00005
}],
"outputs": [{
"address": "troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324",
"value": 0.00018
}],
"fee": {
"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"value": 0.00023141
}
},
"wifs" : [
"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX", "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud", "cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ"
]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/new",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\": {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n ]\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/txs/new",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ createTx:
{ inputs:
[{ address: '2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE',
value: 0.00005 } ],
outputs:
[ { address: 'troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324',
value: 0.00018 } ],
fee:
{ address: 'mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz',
value: 0.00023141 } },
wifs:
[ 'cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX',
'cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud',
'cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ' ] }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/new');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"createTx": {
"inputs": [{
"address": "2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE",
"value": 0.00005
}],
"outputs": [{
"address": "troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324",
"value": 0.00018
}],
"fee": {
"address": "mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"value": 0.00023141
}
},
"wifs" : [
"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX", "cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud", "cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ"
]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/new")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"createTx\": { \n\t\t\t\"inputs\": [{\n\t\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\": {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n ]\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"createTx\": {{\n\t\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\": {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n ]\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/txs/new", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"createTx\": {{\n\t\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\": {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n ]\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/new")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/new"
payload := strings.NewReader("{\n\t\"createTx\": {{\n\t\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\t\"value\": 0.00005\n\t\t}],\n\t\t\"outputs\": [{\n\t\t\t\"address\": \"troyale1qel8lstcqahg565z7xuvau6z85d4d7l8hexu324\",\n\t\t\t\"value\": 0.00018\n\t\t}],\n\t\t\n\t\t\"fee\": {\n\t\t\t\"address\": \"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\",\n\t\t\t\"value\": 0.00023141\n\t\t}\n\t}, \n\t \"wifs\" : [\n \"cUGddnJmuzfzpWXNwt1SRnQ8GMqZdQ1vg8BtwjG8f275pvExPzaX\", \"cSEjySAREyai8eQhgoqixzmxCeSP8QtbwHxptL8ijofg68ZMjoud\", \"cV2u6dqfiQthWfPixJ7ucFW5Tza1ubLr6ipM35vSTy9xGEKbCbaJ\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"txid":"00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a",
"view_in_explorer": "https://blockexplorer.one/btcv/testnet/tx/00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a/?utm_source=cryptoapis.io"
}
}
The Prepare, Sign and Broadcast a Transaction Endpoint combines the other three endpoints: Create, Sign and Send Endpoints. Users should provide the inputs and outputs fields with the corresponding data, as well as the fee and the wifs(private ECDSA keys) of the addresses. Therefore, the endpoint creates, signs and broadcasts the new transaction to the Bitcoin Blockchain. For more information, see the examples.
Users can set three optional fields within the createTx
object: data
and locktime
.
"createTx": {
"inputs": [ {
"address": "...",
"value": ...
}],
"outputs": [{
"address": "...",
"value": ...
}],
"fee": {
"address": "...",
"value": ...
},
"locktime": ...,
"data": "CRYPTOAPISROCKS",
"replaceable": false/true
}
Locktime
(integer) has a default value of zero. Use locktime
if a transaction should be delayed to a specific time.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/new
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
Prepare, Sign and Broadcast a Transaction Using HDWallet
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/hdwallet \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"walletName": "demohdwallet",
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
"outputs": [{
"address": "2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE",
"value": 0.004
}],
"fee": {
"value": 0.00023141
},
"locktime": 0
}'
POST /v1/bc/btcv/testnet/txs/hdwallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"walletName": "demohdwallet",
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
"outputs": [{
"address": "2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE",
"value": 0.004
}],
"fee": {
"value": 0.00023141
},
"locktime": 0
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/hdwallet",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\": {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/txs/hdwallet",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ walletName: 'demohdwallet',
password: '8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32',
outputs: [ { address: '2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE', value: 0.004 } ],
fee: { value: 0.00023141 },
locktime: 0 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/hdwallet');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"walletName": "demohdwallet",
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
"outputs": [{
"address": "2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE",
"value": 0.004
}],
"fee": {
"value": 0.00023141
},
"locktime": 0
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/hdwallet")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\": {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\": {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/txs/hdwallet", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\": {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/hdwallet")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/hdwallet"
payload := strings.NewReader("{\n\t\"walletName\": \"demohdwallet\",\n\t\"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\t\"outputs\": [{\n\t\t\"address\": \"2N7HHqnGx3CZnLdoMcKfnkFYoz8fJtsB6rE\",\n\t\t\"value\": 0.004\n\t}],\n\t\n\t\"fee\": {\n\t\t\"value\": 0.00023141\n\t},\n\t\"locktime\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"txid": "64b038f59114512ec7c41141d8f518c55c4e81383eb5af974c2d9ecc7ece5deb",
"view_in_explorer": "https://blockexplorer.one/btcv/testnet/tx/64b038f59114512ec7c41141d8f518c55c4e81383eb5af974c2d9ecc7ece5deb/?utm_source=cryptoapis.io"
}
}
Prepare, Sign and Broadcast a Transaction Using HDWallet Endpoint provides the possibility to create, sign and send new transactions using your HDWallet. The mandatory fields are: walletName, password, outputs and fee (see example). There are a few optional fields, such as: inputs, fee address and locktime. If input addresses are not included, then the system will automatically choose addresses from the wallet. However, if included, a list of addresses from the wallet and the values should be specified. Fee address is optional and if is specified the fee will be proportionally distributed among the input addresses.
Three optional fields are available:
{
"locktime": ...,
"data": "...",
"replaceable": false/true
}
You need to include data
(string) field only if you want to send messages/metadata with the transaction. replaceable
(boolean) field is only required if you want to allow the transaction to be replaced by a transaction with higher fees (e.g. if you set a low fee and miners are not picking the transaction up for a long period of time). By default replaceable
is set to false.
Locktime
(integer) has a default value of zero. Use locktime
if a transaction should be delayed to a specific time.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/hdwallet
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
See the example where the complete JSON object request (mandatory* and optional fields included) is shown.
The complete JSON object request:
{
"walletName*": "walletName",
"password*" : "...",
"inputs":[{
"address":"n...",
"value":0.1
},{
"address":"n...",
"value":0.3
}],
"outputs*": [{
"address": "m...",
"value": 0.4
}],
"fee": {
"address": "n...",
"value*": 0.0002314
},
"locktime": 0
}
Decode a Raw Transaction
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/decode \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"hex": "02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000"
}'
POST /v1/bc/btcv/mainnet/txs/decode HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex": "02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/decode",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"hex\": \"02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/decode",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ hex: '02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/decode');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex": "02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/decode")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"hex\": \"02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"hex\": \"02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/mainnet/txs/decode", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"hex\": \"02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/decode")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/decode"
payload := strings.NewReader("{\n\t\"hex\": \"02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"txid": "11152322b315ae3915f3a9aa302172151871a2812a13fcf31cb9e351a340bb90",
"hash": "11152322b315ae3915f3a9aa302172151871a2812a13fcf31cb9e351a340bb90",
"size": 158,
"vsize": 158,
"version": 2,
"locktime": 0,
"vin": [
{
"txid": "06172402be2423cb0a423e191b419d0f72f6a72ec6ec328b1bfc8b471e42cd0e",
"sequence": 4294967295,
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
}
},
{
"txid": "aaba986a5497e8ae51dcc48e50456b0d644f88ac1f0c77bfcc59085fd5b8e3c3",
"sequence": 4294967295,
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
}
}
],
"vout": [
{
"value": "18.01016859",
"n": 0,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 a56469a88b63e646a1a167c58ce739d9c9f832db OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"mvbU5WE3qKheMeEc2Tyc1RbmkQDJLi5uUg"
]
}
},
{
"value": "29.9896",
"n": 1,
"scriptPubKey": {
"asm": "OP_HASH160 542d0c5e88b0f6ef85896939af614ef7d618e03c OP_EQUAL",
"hex": "a914542d0c5e88b0f6ef85896939af614ef7d618e03c87",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"2MzvJiQiQqPyiBJTYuUnpgy71f374k6G9L3"
]
}
}
]
}
}
Info
We also offer the ability to decode raw transactions without sending propagating them to the network; perhaps you want to double-check another client library or confirm that another service is sending proper transactions.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/decode
Request Object
{
"hex": "${HEX}"
}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
HEX | ------- | hex of raw transaction |
$HEX is a hex-encoded raw representation of your transaction, for example:
02000000020ecd421e478bfc1b8b32ecc62ea7f6720f9d411b193e420acb2324be022417060000000000ffffffffc3e3b8d55f0859ccbf770c1fac884f640d6b45508ec4dc51aee897546a98baaa0000000000ffffffff021b56596b000000001976a914a56469a88b63e646a1a167c58ce739d9c9f832db88ac807fc0b20000000017a914542d0c5e88b0f6ef85896939af614ef7d618e03c8700000000
If it succeeds, you’ll receive your decoded TX object.
Refund a Transaction
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/refund \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"txid" : "00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a",
"wif": "cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ",
"fee": 0.000123
}'
POST /v1/bc/btcv/mainnet/txs/refund HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"txid" : "00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a",
"wif": "cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ",
"fee": 0.000123
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/refund",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"txid\" : \"00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a\",\n\t\"wif\": \"cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ\",\n\t\"fee\": 0.000123\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/refund",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ txid: '00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a',
wif: 'cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ',
fee: 0.000123 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/refund');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"txid" : "00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a",
"wif": "cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ",
"fee": 0.000123
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/refund")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"txid\" : \"00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a\",\n\t\"wif\": \"cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ\",\n\t\"fee\": 0.000123\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"txid\" : \"00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a\",\n\t\"wif\": \"cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ\",\n\t\"fee\": 0.000123\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/mainnet/txs/refund", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"txid\" : \"00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a\",\n\t\"wif\": \"cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ\",\n\t\"fee\": 0.000123\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/refund")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/refund"
payload := strings.NewReader("{\n\t\"txid\" : \"00fe892169711a1f744065be921b89861cebe6cad895586fdb9964efb2dbb63a\",\n\t\"wif\": \"cV2u6dqfiQthW......M35vSTy9xGEKbCbaJ\",\n\t\"fee\": 0.000123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"txid":"83cc2977743434adddb8acd755d019699ee1837cdf2d783a23e24b27a69f33d0",
}
}
The Refund a Transaction Endpoint allows users easily to return the amount in btcv they have received from an unknown source.
Only two fields are required: the txid
of the transcation and the wif
of the recipient address (see examples).
There is an optional field fee
. If fee
field is not set the system will set the recommended fee from the Transaction Fee Endpoint.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/refund
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
Transactions Fees
Every transaction on Blockchain has fee, the fee is not a fixed amount or % of the amount. The fee depends mainly on how much the network is overloaded. The higher fee you pay, the faster your transaction will be mined. You can use our different endpoints to get information all the time about fees and decide what fee you would set for your transactions.
Transaction Size
Info
Using Crypto APIs, you can calculate the approximate size of a standard transaction.
Required fields are:
{
"inputs": [{
"address": "...",
"value": ...
},
...],
"outputs": [{
"address": "...",
"value": ...
},
...],
"fee": {
"address": "...",
"value": ...
}
}
Optional fields include:
{
"locktime": ...,
"data": "...",
"replaceable": false/true
}
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"inputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0004
}, {
"address": "RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE",
"value": 0.0004
}],
"outputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0008
}],
"fee": {
"address" : "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.00023141
}
}'
POST /v1/bc/btcv/testnet/txs/size HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"inputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0004
}, {
"address": "RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE",
"value": 0.0004
}],
"outputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0008
}],
"fee": {
"address" : "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.00023141
}
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/txs/size",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ inputs:
[ { address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb', value: 0.0004 },
{ address: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1', value: 0.0004 } ],
outputs: [ { address: 'mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9', value: 0.0008 } ],
fee:
{ address: 'mtFYoSowT3i649wnBDYjCjewenh8AuofQb',
value: 0.00023141 },
data: 'CRYPTOAPISROCKS',
replaceable: true }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"inputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0004
}, {
"address": "RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE",
"value": 0.0004
}],
"outputs": [{
"address": "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.0008
}],
"fee": {
"address" : "YeSZavPYQNQjNLdkDcz61HcoykiApytSK3",
"value": 0.00023141
}
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/txs/size, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/txs/size"
payload := strings.NewReader("{\n \"inputs\": [{\n \"address\": \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\nYeSZavPYQNQjNLdkDcz61HcoykiApytSK3value\": 0.0004\n }, {\n \"address\": \"RGxGoeBEGrxYxMVmaRVUjv624S4n3UkZoE\",\n \"value\": 0.0004\n }],\n \"outputs\": [{\n \"address\": \"mrnWMV41vXivQX9yiY9ACSK5uPo3TfJdv9\",\n \"value\": 0.0008\n }],\n \"fee\": {\n \t\"address\" : \"YeSZavPYQNQjNLdkDcz61HcoykiApytSK3\",\n \"value\": 0.00023141\n }}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"tx_size_bytes": 316
}
}
HTTP Request
POST /v1/bc/btcv/${NETWORK}/txs/size
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
Transaction Size for HD Wallet
Info
Using this endpoint you can get the approximate size of a transaction in HD wallet.
Required fields are:
{
"walletName": "......",
"password" : "......",
"outputs": [{
"address": "......",
"value": ........
}]
}
Optional fields include:
{
"locktime": ...,
"data": "...",
"fee": {
"address" : ............,
"value": ..............
}
}
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/txs/size \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"walletName": "demohdwallet",
"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
"outputs": [
{
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.007
}
]
}'
POST /v1/bc/btcv/testnet/wallets/hd/txs/size HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"walletName": "demohdwallet",
"password" : "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
"outputs": [{
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.007
}]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/txs/size",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"walletName\": \"demohdwallet\",\n \"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\"outputs\": [{\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n \"value\": 0.007\n }],\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd/txs/size",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify("{\n \"walletName\": \"demohdwallet\",\n \"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\"outputs\": [{\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n \"value\": 0.007\n }],\n}");
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/txs/size');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"walletName": "demohdwallet",
"password": "8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32",
"outputs": [{
"address": "mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.007
}]}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/txs/size")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n \"walletName\": \"demohdwallet\",\n \"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\"outputs\": [{\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n \"value\": 0.007\n }],\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"walletName\": \"demohdwallet\",\n \"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\"outputs\": [{\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n \"value\": 0.007\n }],\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btcv/testnet/wallets/hd/txs/size, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, ""{\n \"walletName\": \"demohdwallet\",\n \"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\"outputs\": [{\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n \"value\": 0.007\n }],\n}"");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/txs/size")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/txs/size"
payload := strings.NewReader("{\n \"walletName\": \"demohdwallet\",\n \"password\" : \"8a0690d2cd4fad1371090225217bb1425b3700210f51be6111eb225d5142ac32\",\n\"outputs\": [{\n \"address\": \"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\",\n \"value\": 0.007\n }],\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-Key", "my-api-key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"tx_size_bytes": 238
}
}
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/txs/size
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
Transactions Fee
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs HTTP/1.1
Host: api.cryptoapis.io
X-API-Key: my-api-key
Content-Type: application/json
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee",
"method": "GET",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("https");
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"port": null,
"path": "/v1/bc/btcv/mainnet/txs",
"headers": {
"authorization": "my-api-key",
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'content-type' => 'application/json',
'authorization' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee"
headers = {
'content-type': "application/json",
'authorization': "my-api-key"
}
response = requests.request("GET", url, headers=headers)
print(response.text)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee")
.get()
.addHeader("authorization", "my-api-key")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/fee"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "my-api-key")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response Body
{
"payload": {
"min": "0.00000113",
"max": "0.05992189",
"average": "0.00014718",
"min_fee_per_byte": "0.00000001",
"average_fee_per_byte": "0.00000027",
"max_fee_per_byte": "0.00011151",
"average_bytes": "545", //deprecated
"recommended": "0.00012508", //deprecated
"slow_fee_per_byte": "0.00000078",
"standard_fee_per_byte": "0.00000157",
"fast_fee_per_byte": "0.00000264",
"unit": "btcv"
}
}
Info
Transactions Fee Endpoint gives information about the fees for all transactions included in the last 70 blocks. min
shows the lowest fee, max
is the highest and average
- the average fee. recommended
is the fee that we consider as the one that corresponds to a cheap and fast execution. However, it is only a suggestion and should be used at users' sole discretion. average_bytes
represents the average size of the transactions in bytes and is used for the calculations of the recommended
fee price.
min_fee_per_byte
, average_fee_per_byte
and max_fee_per_byte
represent the lowest, average and highest values per byte.
slow_fee_per_byte
, standard_fee_per_byte
and fast_fee_per_byte
represent the slowest, standard and fastest values per byte for a transaction fee.
Crypto APIs provides an endpoint where you can get the size of your transaction in bytes. Using the provided data you can easily calculate and set your fee.
All fees are in btcv!
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/fee
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
Estimate Smart Fee
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee' \
-H 'ContentType: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btcv/mainnet/txs/estimate-fee HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
}
});
$.get('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee').then(function(d) {console.log(d)});mainnet/txsbtcv
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/txs/estimate-fee",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
response = requests.get(url, headers=headers)
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
Get("https://api.cryptoapis.io/v1/bc/btcv/mainnet/txs/estimate-fee")
}
Response Body
{
"payload": {
"feeRate": "0.00012290",
"blocks": "2",
"unit" : "btcv"
}
}
Info
Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within confTarget
blocks if possible and return the number of blocks for which the estimate is valid.
HTTP Request
GET /v1/bc/btcv/${NETWORK}/txs/estimate-fee
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
estimateMode | CONSERVATIVE | The fee estimate mode. (“UNSET” “ECONOMICAL” “CONSERVATIVE”) |
confTarget | 1 | Confirmation target in blocks (1 - 1008) |
The returned object contains information about the estimated fee rate in btcv/kB and the block number where estimated fee value was found.
xPub, yPub, zPub
What is Xpub?
Every child key pair can define an xPub (Extended Public Key). As the name suggests, an Xpub doesn’t contain information about private keys, but only public ones. This means that an xPub will not give you access to the funds in a wallet, but the user can also view the child wallet’s addresses, transactions, and balances. You can think of it as a read-only view of a wallet.
What are Ypub and Zpub?
After the adoption of SegWit, theBIP49 standard gave origin to the yPub. A yPub key is the same as an xPub key. However, it follows the new standard and has an address type P2SH-P2WPKH. yPub is for backward-compatible SegWit Wallets.
After the xPub and yPub, the newest Public Extended Key is zPub. Just as its predecessor the zPub follows the BIP49 standard, but the address type is P2WPKH. zPub is for native compatible SegWit wallets.
Create Public Extended Key (xPub, yPub, zPub)
Sample Data
curl -X POST 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"password": "SECRET123456"
}'
POST /v1/bc/btcv/mainnet/wallets/hd/xpub HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"password": "SECRET123456"
}
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"password\": \"SECRET123456\"\n}"
});
$.post('https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub')
.then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/wallets/hd/xpub",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
req.write(JSON.stringify({ password: 'SECRET123456' }));
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"password": "SECRET123456"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"password\": \"SECRET123456\"\n}"
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
payload = "{\n\t\"password\": \"SECRET123456\"\n}"
response = requests.post(url, payload, headers)
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(mediaType, "{\n\t\"password\": \"SECRET123456\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub"
payload := strings.NewReader("{\n\t\"password\": \"SECRET123456\"\n}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
}
Response Body
{
"payload": {
"xpriv": "xprv9ucuj1F17mBG6aZx3nav3pXZcYDdvqgC6uARu35DFZeGVmDyGUrhsVbek6sTuPzEu2KW156QLmhkDegnvxGKkGAzLtVZMuWj3cy8zKkakJw",
"xpub": "xpub68cG8Wmtx8jZK4eR9p7vQxUJAa48LJQ3U862hRUpouBFNZZ7p2AxRHv8bQHV2csNkb82iY4khQgXvkkZn7JouoYRiadKaCHuVddfwjif45X",
"wif": "KwLHiSPQ39ehEQrYy8b5ybznYSMHsHH4cCS1ccSdTVeQvGNsSkj8"
}
}
Info
Create Public Extended Key (xPub, yPub, zPub) Endpoint allows you to create a random extended public key (based on your password), xpriv and wif.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/xpub
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
Get Public Extended Key Addresses (xPub, yPub, zPub)
Sample Data
curl -X POST 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"xpub":"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk"
}'
POST /v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3 HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"xpub":"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk"
}
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"xpub\":\"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk\"\n}"
});
$.post('https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3')
.then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
req.write(JSON.stringify({ xpub: 'xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk'
}));
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"xpub":"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"xpub\":\"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk\"\n}"
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
payload = "{\n\t\"xpub\":\"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk\"\n}"
response = requests.post(url, payload, headers)
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(mediaType, "{\n\t\"xpub\":\"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
url := "https://api.cryptoapis.io/v1/bc/btcv/mainnet/wallets/hd/xpub/addresses?limit=3"
payload := strings.NewReader("{\n\t\"xpub\":\"xpub68MP6APrnq8Pp5wpL77MWevxkTE62PLnhM9u71xxHxJMrnKvLKaXWfoGNhyUEr7LmwPf4k872fbL2yeimSae3JBQUnD5uaMnuzuEsjkz6Zk\"\n}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
}
Response Body
{
"payload": [
"YhVLFu39SV54cn11fw4PdfN3pizFJHGRrQ",
"Yd7SsiUbggAbCScpKp7Wpj954dmwSgrYGK",
"YaJTBd4HN1Ms5vbXqVQRwe1c6KxmV8o425"
],
"meta": {
"totalCount": 3,
"index": 0,
"limit": 3,
"results": 3
}
}
Info
Get Pub Addresses Endpoint allows you to get addresses associated with the specified extended public key. Supported BIP formats are: bip39, bip44, bip49 and bip84.
Since addresses are hierarchically ordered we provide the query params index
and limit
, in order to be able to get the addresses in specific positions. Default values are: 0 and 100, accordingly. The default values will return the first one hundred receive addresses.
If you want to get the change addresses of the extended public key you should set type
to be equal to "change" as a query parameter.
If you want to get addresses in P2PKH
(eg: YhVLFu39SV54cn11fw4PdfN3pizFJHGRrQ)
address format type you should set address_type
to be equal to P2PKH
.
If you want to get addresses in P2SH
(eg: RED3skeyLx7UNJp75Nh8w1LW2tfMuAzMNs)
address format type you should set address_type
to be equal to P2SH
.
If you want to get addresses in Bech32
(Bech32 which begin with royale, eg: royale1qcmfwnrwcf297twa2g9upy3w8r0w37cgkcurda6)
address format type you should set address_type
to be equal to Bech32
.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/xpub/addresses
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
index | 0 | starting point (integer) |
limit | 100 | result count (integer) |
type | receive | address type (string) |
address_type | P2PKH | address format type (string) (Allowed types are: P2PKH , P2SH , Bech32 ) |
Get Public Extended Key Transactions (xPub, yPub, zPub)
Sample Data
curl -X POST 'https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"xpub":"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w"
}'
POST /v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"xpub":"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w"
}
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}"
});
$.post('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions')
.then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
req.write(JSON.stringify({ xpub: 'tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w' }));
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"xpub":"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}"
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
payload = "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}"
response = requests.post(url, payload, headers)
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(mediaType, "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/addresses/transactions"
payload := strings.NewReader("{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
}
Response Body
{
"payload": [
{
"address": "muRDqTkswqGrZ55HMYqtdm96RQRkfGVcDM",
"transactions": [
{
"txid": "f7679a1b272c0fda6338294b4b7e24364090ee86e15f38599d757313555c0d7f",
"hash": "b7f0215a98475c5cc62f7cd093fb5d0e3e9d1710630e088cc9d30cf84b7b1480",
"index": 301,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 1610277,
"datetime": "2019-11-29 12:37:59 UTC",
"time": "2019-11-29 12:37:59 UTC",
"blockhash": "00000000c59d5a76d8566860f50f996a8109cda5b3e28f39a2befb486d91b7ae",
"blockheight": 1610278,
"blocktime": "2019-11-29 12:37:59 UTC",
"timestamp": 1575031079,
"txins": [
{
"txout": "faecc547363bba171dc665c1752e027d0ef5e1078eb21fecbfa69a114642f12c",
"vout": 1,
"amount": "0.01197137",
"addresses": [
"2N61UpBStVekzUiQi2MeJX13rWxvANZxB1n"
],
"script": {
"asm": "0014d9dd40344f1ca7ce0e0ca507efb238d987909931",
"hex": "160014d9dd40344f1ca7ce0e0ca507efb238d987909931"
},
"votype": "scripthash"
},
{
"txout": "2d6d4cd15fcf215b77f214a9651a1883bc69de861574e45955287c747f44dfb8",
"vout": 1,
"amount": "0.01298794",
"addresses": [
"2NAV3t8PWbKR4q73umkrGDTBsVBCzJW8NKw"
],
"script": {
"asm": "001439ce1d2265364559d3ce51fcca6bf3e32f1e7c2a",
"hex": "16001439ce1d2265364559d3ce51fcca6bf3e32f1e7c2a"
},
"votype": "scripthash"
}
],
"txouts": [
{
"amount": "0.01495673",
"type": "scripthash",
"spent": true,
"addresses": [
"2N5zAb2cGcFYiH6YfbYp1W1q8ZuPHwwahPv"
],
"script": {
"asm": "OP_HASH160 8bc08e89a3cfef2009c49de8431b0e4013d987a0 OP_EQUAL",
"hex": "a9148bc08e89a3cfef2009c49de8431b0e4013d987a087",
"reqsigs": 1
}
},
{
"amount": "0.01",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"muRDqTkswqGrZ55HMYqtdm96RQRkfGVcDM"
],
"script": {
"asm": "OP_DUP OP_HASH160 987c3d157bcb14be27dc76dc583ca6e94e78cb9e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914987c3d157bcb14be27dc76dc583ca6e94e78cb9e88ac",
"reqsigs": 1
}
}
]
}
]
},
...
{
"address": "migKHiN2651seZVTGwkkQMqXefVsjHJhGf",
"transactions": [
{
"txid": "84cf9f79cb957b0c0c64c7ce3ec1850063c1d889e11f5c771536e8d42abb94ad",
"hash": "63bdd807f64eb1b1793941ac002e73a8595b16388f2ad5ad4c59239e12c17d6a",
"index": 126,
"version": 2,
"size": 249,
"vsize": 168,
"locktime": 1610279,
"datetime": "2019-11-29 13:02:22 UTC",
"time": "2019-11-29 13:02:22 UTC",
"blockhash": "000000003e9b3aa4b4461e0b6444f5cd400b6625f682ceacde19e25d691f8ea8",
"blockheight": 1610280,
"blocktime": "2019-11-29 13:02:22 UTC",
"timestamp": 1575032542,
"txins": [
{
"txout": "3f72598d9c8d1869dbd8add6989fa5a5c068b4dc4ea61534a575bddf606df4f7",
"vout": 6,
"amount": "0.042",
"addresses": [
"2N62xSz56QSUbJeQNME6jpkPFQHditMAGcy"
],
"script": {
"asm": "001423494ac4d10970f3f62d00ddde9264b1f4c4636d",
"hex": "16001423494ac4d10970f3f62d00ddde9264b1f4c4636d"
},
"votype": "scripthash"
}
],
"txouts": [
{
"amount": "0.01",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"migKHiN2651seZVTGwkkQMqXefVsjHJhGf"
],
"script": {
"asm": "OP_DUP OP_HASH160 22ada5623f07c707e51e58e16f62272e9c1ec357 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91422ada5623f07c707e51e58e16f62272e9c1ec35788ac",
"reqsigs": 1
}
},
{
"amount": "0.03199832",
"type": "scripthash",
"spent": true,
"addresses": [
"2NG1Ec1f1phzjQiCs9z1524FzufMioFSHoz"
],
"script": {
"asm": "OP_HASH160 f9a59572491c55dc1c9de21ad877e0797681d9c7 OP_EQUAL",
"hex": "a914f9a59572491c55dc1c9de21ad877e0797681d9c787",
"reqsigs": 1
}
}
]
}
]
}
],
"meta": {
"totalCount": 3,
"index": 0,
"limit": 3,
"results": 3
}
}
Info
Get Pub Addresses Endpoint allows you to get transactions associated with the specified extended public key. Supported BIP formats are: bip39, bip44, bip49 and bip84.
Since addresses are hierarchically ordered we provide the query params index
and limit
, in order to be able to get the addresses and their transactions in specific positions. Default values are: 0 and 100, accordingly. The default values will return the transactions for the first one hundred receive addresses.
If you want to get the change addresses of the extended public key you should set type
to be equal to "change" as a query parameter.
If you want to get addresses in P2PKH
(eg: YhVLFu39SV54cn11fw4PdfN3pizFJHGRrQ)
address format type you should set address_type
to be equal to P2PKH
.
If you want to get addresses in P2SH
(eg: RED3skeyLx7UNJp75Nh8w1LW2tfMuAzMNs)
address format type you should set address_type
to be equal to P2SH
.
If you want to get addresses in Bech32
(Bech32 which begin with royale, eg: royale1qcmfwnrwcf297twa2g9upy3w8r0w37cgkcurda6)
address format type you should set address_type
to be equal to Bech32
.
If the transactions you are looking for are transactions from addresses in ALL
(P2PKH
, P2SH
, Bech32
) formats type you should set address_type
to be equal to ALL
.
results
property in the response shows the number of addresses that have transactions for the specified query.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/xpub/addresses/transactions
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
index | 0 | starting point (integer) |
limit | 100 | result count (integer) |
type | receive | address type (string) |
address_type | P2PKH | address format type (string) (Allowed types are: P2PKH , P2SH , Bech32 , ALL ) |
Get Public Extended Key Details (xPub, yPub, zPub)
Sample Data
curl -X POST 'https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
-d '{
"xpub":"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w"
}'
POST /v1/bc/btcv/testnet/wallets/hd/xpub/details HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"xpub":"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w"
}
$.ajaxSetup({
headers:{
"Content-Type": "application/json" ,
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}"
});
$.post('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details')
.then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btcv/testnet/wallets/hd/xpub/details",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
};
var request = https.request(options, function (response) {
response.on("data", function (data) {
console.log(data);
});
});
req.write(JSON.stringify({ xpub: 'tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w' }));
request.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"xpub":"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w"
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
require 'uri'
require 'net/http'
url = URI("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["X-API-Key"] = 'my-api-key'
request.body = "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}"
response = http.request(request)
puts response.read_body
import requests
url = 'https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details'
headers = {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
}
payload = "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}"
response = requests.post(url, payload, headers)
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(mediaType, "{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-Key", "my-api-key")
.build();
Response response = client.newCall(request).execute();
import (
"gopkg.in/resty.v0"
)
func main()
{
resp, err := resty.R().
SetHeader("Content-Type", "application/json").
SetHeader("X-API-Key", "my-api-key").
url := "https://api.cryptoapis.io/v1/bc/btcv/testnet/wallets/hd/xpub/details"
payload := strings.NewReader("{\n\t\"xpub\":\"tpubD9GMECjiZHCaF9NHSMAeMbQMXnM7CviEJZsYBuztVwsUjPHWjxewWAUXWV2UExaAtoEvQGXDBmVWo6ZHGtj6TsH6Pop7D9DskQwGHA1gu1w\"\n}")
req, _ := http.NewRequest("POST", url, payload)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
}
Response Body
{
"payload": {
"resultsBalance": {
"amount": "0.042105",
"unit": "btcv"
},
"transactions": [
{
"txid": "51a3d45e786eec861d80863c840aeffc2718833c614a851e988bc3812d87ec75",
"hash": "51a3d45e786eec861d80863c840aeffc2718833c614a851e988bc3812d87ec75",
"index": 69,
"version": 2,
"size": 361,
"vsize": 361,
"locktime": 0,
"datetime": "2020-06-03 14:40:01 UTC",
"time": "2020-06-03 14:40:01 UTC",
"blockhash": "000000003d0a33ecbb7734be1f552cf09d149cbb19e74bdd6cbe57ad868326e3",
"blockheight": 1747514,
"blocktime": "2020-06-03 14:40:01 UTC",
"timestamp": 1591195201,
"txins": [
{
"txout": "b0c0efbb9c52c5233499adaf51c2b064ca27c43f3391894da482cf389729e178",
"vout": 0,
"amount": "0.00022",
"addresses": [
"mi7iSsKcvyFYNsiYdDZqJmH75RmoHomwmo"
],
"script": {
"asm": "3044022023ee96be91a9196b13614508365828831751d85bde8013807a3d1fa081d21122022003cdbcb9a520f0b62699bfc1199d10ea0f105cd5a53caec217a6fab8bcdcc807[ALL] 0379b68be3079ad43e4bbe27a35b78a435f482045b39bd3771b6e307dd8b63e50a",
"hex": "473044022023ee96be91a9196b13614508365828831751d85bde8013807a3d1fa081d21122022003cdbcb9a520f0b62699bfc1199d10ea0f105cd5a53caec217a6fab8bcdcc80701210379b68be3079ad43e4bbe27a35b78a435f482045b39bd3771b6e307dd8b63e50a"
},
"votype": "pubkeyhash"
}
],
"txouts": [
{
"amount": "0.000001",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"migKHiN2651seZVTGwkkQMqXefVsjHJhGf"
],
"script": {
"asm": "OP_DUP OP_HASH160 22ada5623f07c707e51e58e16f62272e9c1ec357 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91422ada5623f07c707e51e58e16f62272e9c1ec35788ac",
"reqsigs": 1
}
},
{
"amount": "0.000001",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"mrD8ABr5wafvauTi9UgLcjGBevkYwkyUXy"
],
"script": {
"asm": "OP_DUP OP_HASH160 754a2173f5907131b261f6e24bb55f0e7441887c OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914754a2173f5907131b261f6e24bb55f0e7441887c88ac",
"reqsigs": 1
}
},
{
"amount": "0.000001",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"mm2mrzGkeEVZ4cBUd4bGmhctmNBk3adKWj"
],
"script": {
"asm": "OP_DUP OP_HASH160 3c7c664180b88c2f30bc6ba3b29d123e8dcf5542 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9143c7c664180b88c2f30bc6ba3b29d123e8dcf554288ac",
"reqsigs": 1
}
},
{
"amount": "0.00021",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"mi7iSsKcvyFYNsiYdDZqJmH75RmoHomwmo"
],
"script": {
"asm": "OP_DUP OP_HASH160 1c83401f626bd655e980f8a98a01b035349e9c98 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a9141c83401f626bd655e980f8a98a01b035349e9c9888ac",
"reqsigs": 1
}
},
{
"amount": "0.000001",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"mq5heovJvP3W5azH4YNP3A5k97jFNzQCg3"
],
"script": {
"asm": "OP_DUP OP_HASH160 68eaa2da9b48489d4e55aaa2e772bb4d4651c5e3 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91468eaa2da9b48489d4e55aaa2e772bb4d4651c5e388ac",
"reqsigs": 1
}
},
{
"amount": "0.000001",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"muRDqTkswqGrZ55HMYqtdm96RQRkfGVcDM"
],
"script": {
"asm": "OP_DUP OP_HASH160 987c3d157bcb14be27dc76dc583ca6e94e78cb9e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914987c3d157bcb14be27dc76dc583ca6e94e78cb9e88ac",
"reqsigs": 1
}
}
]
},
...
{
"txid": "f7679a1b272c0fda6338294b4b7e24364090ee86e15f38599d757313555c0d7f",
"hash": "b7f0215a98475c5cc62f7cd093fb5d0e3e9d1710630e088cc9d30cf84b7b1480",
"index": 301,
"version": 2,
"size": 420,
"vsize": 258,
"locktime": 1610277,
"datetime": "2019-11-29 12:37:59 UTC",
"time": "2019-11-29 12:37:59 UTC",
"blockhash": "00000000c59d5a76d8566860f50f996a8109cda5b3e28f39a2befb486d91b7ae",
"blockheight": 1610278,
"blocktime": "2019-11-29 12:37:59 UTC",
"timestamp": 1575031079,
"txins": [
{
"txout": "faecc547363bba171dc665c1752e027d0ef5e1078eb21fecbfa69a114642f12c",
"vout": 1,
"amount": "0.01197137",
"addresses": [
"2N61UpBStVekzUiQi2MeJX13rWxvANZxB1n"
],
"script": {
"asm": "0014d9dd40344f1ca7ce0e0ca507efb238d987909931",
"hex": "160014d9dd40344f1ca7ce0e0ca507efb238d987909931"
},
"votype": "scripthash"
},
{
"txout": "2d6d4cd15fcf215b77f214a9651a1883bc69de861574e45955287c747f44dfb8",
"vout": 1,
"amount": "0.01298794",
"addresses": [
"2NAV3t8PWbKR4q73umkrGDTBsVBCzJW8NKw"
],
"script": {
"asm": "001439ce1d2265364559d3ce51fcca6bf3e32f1e7c2a",
"hex": "16001439ce1d2265364559d3ce51fcca6bf3e32f1e7c2a"
},
"votype": "scripthash"
}
],
"txouts": [
{
"amount": "0.01495673",
"type": "scripthash",
"spent": true,
"addresses": [
"2N5zAb2cGcFYiH6YfbYp1W1q8ZuPHwwahPv"
],
"script": {
"asm": "OP_HASH160 8bc08e89a3cfef2009c49de8431b0e4013d987a0 OP_EQUAL",
"hex": "a9148bc08e89a3cfef2009c49de8431b0e4013d987a087",
"reqsigs": 1
}
},
{
"amount": "0.01",
"type": "pubkeyhash",
"spent": false,
"addresses": [
"muRDqTkswqGrZ55HMYqtdm96RQRkfGVcDM"
],
"script": {
"asm": "OP_DUP OP_HASH160 987c3d157bcb14be27dc76dc583ca6e94e78cb9e OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914987c3d157bcb14be27dc76dc583ca6e94e78cb9e88ac",
"reqsigs": 1
}
}
]
}
]
},
"meta": {
"totalCount": 8,
"index": 0,
"results": 8
}
}
Info
Get Pub Details Endpoint allows you to get transactions associated with the specified extended public key and the total balance of the results. Supported BIP formats are: bip39, bip44, bip49 and bip84.
Since addresses are hierarchically ordered we provide the query params index
and limit
, in order to be able to get the addresses and their transactions in specific positions. Default values are: 0 and 100, accordingly. The default values will return the transactions for the first one hundred receive addresses.
If you want to get the change addresses of the extended public key you should set type
to be equal to "change" as a query parameter.
If you want to get addresses in P2PKH
(eg: YhVLFu39SV54cn11fw4PdfN3pizFJHGRrQ)
address format type you should set address_type
to be equal to P2PKH
.
If you want to get addresses in P2SH
(eg: RED3skeyLx7UNJp75Nh8w1LW2tfMuAzMNs)
address format type you should set address_type
to be equal to P2SH
.
If you want to get addresses in Bech32
(Bech32 which begin with royale, eg: royale1qcmfwnrwcf297twa2g9upy3w8r0w37cgkcurda6)
address format type you should set address_type
to be equal to Bech32
.
If you are looking for the details from addresses in ALL
(P2PKH
, P2SH
, Bech32
) formats type you should set address_type
to be equal to ALL
.
results
property in the response shows the number of addresses that have transactions for the specified query.
HTTP Request
POST /v1/bc/btcv/${NETWORK}/wallets/hd/xpub/details
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. mainnet or testnet) |
index | 0 | starting point (integer) |
limit | 100 | result count (integer) |
address_type | receive | address type (string) |
address_format | P2PKH | address format type (string) (Allowed types are: P2PKH , P2SH , Bech32 , ALL ) |