Omni Layer
General Information
Get Node Information
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/info' \
-H 'ContentType: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/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/btc/omni/mainnet/info').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/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/btc/omni/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/btc/omni/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/btc/omni/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/btc/omni/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/btc/omni/mainnet/info")
}
Response Body
{
"payload": {
"block": 590368,
"blocktime": 1565949629,
"blocktransactions": 207,
"totaltrades": 1834,
"totaltransactions": 12525805
}
}
Info
General information about the Omni Layer's Node.
HTTP Request
GET /v1/bc/btc/omni/${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 of the latest block, the number of transactions in the latest block, total trades and the total count of all omni transactions.
Addresses & Transactions Data
Get Address Details
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n 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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n",
"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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n');
$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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n")
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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n'
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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n")
.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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n")
}
Response Body
{
"payload": [
{
"propertyid": 1,
"name": "Omni tokens",
"balance": "0.00058000",
"reserved": "0.00000000",
"frozen": "0.00000000"
},
{
"propertyid": 2,
"name": "Test Omni tokens",
"balance": "4.05543809",
"reserved": "0.00000000",
"frozen": "0.00000000"
},
...
{
"propertyid": 2147483737,
"name": "Demo Token",
"balance": "83.66300000",
"reserved": "0.00000000",
"frozen": "0.00000000"
},
{
"propertyid": 2147483739,
"name": "ManagedGrantTest",
"balance": "1.00000505",
"reserved": "0.00000000",
"frozen": "0.00000000"
}
],
"meta": {
"totalCount": 12,
"limit": 50,
"results": 12
}
}
Info
The default Address Endpoint strikes a general information about addresses.
HTTP Request
GET /v1/bc/btc/omni/${NETWORK}/address/${ADDRESS}
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
ADDRESS | ------- | Address in blockchain |
ADDRESS is a string representing the public address (or wallet/HD wallet name) you’re interested in querying, for example:
1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n
The returned object contains information about the specified address, all the tokens that it posses, their value and name.
Get Transaction Details By Transaction ID (Txid)
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a 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/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a",
"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/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a');
$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/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a")
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/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a'
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/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a")
.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/btc/omni/mainnet/txs/txid/fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a")
}
Response Body
{
"payload": {
"txid": "fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a",
"fee": "0.001",
"sendingAddress": "1Po1oWkD2LmodfkBYiAktwh76vkF93LKnh",
"referenceAddress": "3GN7adzMX5znTVF9jWUaZ5v3Y7EvN4HDEk",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "1209990",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 7,
"block": 590000,
"confirmations": 1828
}
}
Info
The Transaction Txid Endpoint returns detailed information about a given transaction based on its txid.
HTTP Request
GET /v1/bc/btc/omni/${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:
fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a
The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it, the from and to addresses, and more.
Get Transactions By Block Number
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/txs/block/590000?limit=3&index=1' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/mainnet/txs/block/590000?limit=3&index=1 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/btc/omni/mainnet/txs/block/590000?limit=3&index=1').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/mainnet/txs/block/590000?limit=3&index=1",
"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/btc/omni/mainnet/txs/block/590000?limit=3&index=1');
$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/btc/omni/mainnet/txs/block/590000?limit=3&index=1")
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/btc/omni/mainnet/txs/block/590000?limit=3&index=1'
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/btc/omni/mainnet/txs/block/590000?limit=3&index=1")
.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/btc/omni/mainnet/txs/block/590000?limit=3&index=1")
}
Response Body
{
"meta": {
"totalCount": 236,
"index": 1,
"limit": 3,
"results": 3
},
"payload": [
{
"txid": "f43ecd605d8d733d02684c17c3a61d66aed7a9ec4c627fb060b763c348696259",
"fee": "0.0007",
"sendingAddress": "1MRyVg2dyZNEFDy8G6i1hNcerkeZiXYK4S",
"referenceAddress": "3Ld5yZ4fqTrW44cUGxpjEuBwAEtCsYUP28",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "798.483157",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 18,
"block": 590000,
"confirmations": 1829
},
{
"txid": "62ce6d1829ac610898c8ff562fa312a15ac85a097f18b3e4dafb43ed4aa217d0",
"fee": "0.00052",
"sendingAddress": "14jeVDsafh7Tz1NYMjsLmrWFVa69i19T7q",
"referenceAddress": "1BMbMuMfAoMEitsHSRzQKupGpDAczBNWG2",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "2500",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 41,
"block": 590000,
"confirmations": 1829
},
{
"txid": "591b990e340cbb88d20488be49ea0af1539523327eb6f6b737332a96b414b403",
"fee": "0.000514",
"sendingAddress": "1MSEVNB9FuomfKvDjzxL34awefQ3haeHTm",
"referenceAddress": "1HnTSAJi1ApVbfuJ24hQ5V6LUmw2ccDtR2",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "93.8502",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 48,
"block": 590000,
"confirmations": 1829
}
]
}
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/btc/omni/${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:
000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1
or
544704
The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it, the from and to addresses, and more.
Get Transactions by Property ID
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/txs/propertyid/31' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/mainnet/txs/propertyid/31 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/btc/omni/mainnet/txs/propertyid/31').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/mainnet/txs/propertyid/31",
"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/btc/omni/mainnet/txs/propertyid/31');
$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/btc/omni/mainnet/txs/propertyid/31")
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/btc/omni/mainnet/txs/propertyid/31'
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/btc/omni/mainnet/txs/propertyid/31")
.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/btc/omni/mainnet/txs/propertyid/31")
}
Response Body
{
"meta": {
"totalCount": 11855927,
"index": 0,
"limit": 50,
"results": 50
},
"payload": [
{
"txid": "fa34c1741214627c59addd22d87c5a9d0bde04b95ad6b5b7402ee5d1481cbf1a",
"fee": "0.001",
"sendingAddress": "1Po1oWkD2LmodfkBYiAktwh76vkF93LKnh",
"referenceAddress": "3GN7adzMX5znTVF9jWUaZ5v3Y7EvN4HDEk",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "1209990",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 7,
"block": 590000,
"confirmations": 1829
},
{
"txid": "f43ecd605d8d733d02684c17c3a61d66aed7a9ec4c627fb060b763c348696259",
"fee": "0.0007",
"sendingAddress": "1MRyVg2dyZNEFDy8G6i1hNcerkeZiXYK4S",
"referenceAddress": "3Ld5yZ4fqTrW44cUGxpjEuBwAEtCsYUP28",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "798.483157",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 18,
"block": 590000,
"confirmations": 1829
},
...
{
"txid": "c5e83d2c3fd2d381e873b2836655a1053a7a08fc77fafbd626bc7d3d16920cdb",
"fee": "0.0002056",
"sendingAddress": "1L3ssabEW43GTdmGJojuCM6yXiLfv2zBKm",
"referenceAddress": "1NaUpj8sZki4gpXRd7n6BYsDK769M5XgFn",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 31,
"divisible": true,
"amount": "283.5756",
"valid": true,
"blockHash": "000000000000000000061610767eaa0394cab83c70ff1c09dd6b2a2bdad5d1d1",
"blocktime": 1565743888,
"positionInBlock": 391,
"block": 590000,
"confirmations": 1829
}
]
}
Info
The Transaction by Property Id Endpoint returns detailed information about a list of transactions by property. index
and limit
query parameters might also be used, as their default values are, as follows: 0, 50.
The number 31 stands for Tether.
HTTP Request
GET /v1/bc/btc/omni/${NETWORK}/txs/propertyid/${PROPERTYID}?index=0&limit=50
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
PROPERTYID | ------- | the id of the token |
index | 0 | index to start from |
limit | 50 | 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 |
The returned object contains information about the transaction in JSON format, including its block information, the total amount transacted with it, the from and to addresses, and more.
Get Unconfirmed Transactions
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/unconfirmed' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/testnet/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/btc/omni/testnet/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/btc/omni/testnet/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/btc/omni/testnet/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/btc/omni/testnet/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/btc/omni/testnet/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/btc/omni/testnet/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/btc/omni/testnet/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": "ebac2e0d4e511bbc31f7a40b1801cda2857bc77eb9753b425513b75d6f42ca55",
"fee": "0.00003616",
"sendingAddress": "mzj7TdgY4aW8YV2udkRwpjS6GXLjCjLh3w",
"referenceAddress": "mg9fpJ2LNg2KdDDGgnzpy3eCpdTeXWb5Q9",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 2,
"divisible": true,
"amount": "0.00000001"
},
{
"txid": "1819b1b91174eace199b405ecca457da81bb7590a7c256ff8be560ad3bfd4dc7",
"fee": "0.00003616",
"sendingAddress": "mm9hYE5fEvW2Yqfzo2QMM8b3tFo4raeMkp",
"referenceAddress": "mx9pdDGK7EoX3BtQXyUjN9xxJvbbzA48Bx",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 2,
"divisible": true,
"amount": "0.00000001"
},
{
"txid": "095f7a5c89e3596131d40adba11072db1dff1159ae13cf08485470205acdd91a",
"fee": "0.00000257",
"sendingAddress": "muMG31F9553rRtq9omJnUfh8zavMqMr2bw",
"referenceAddress": "msfBCwwbhPBu6jtpsB6jq6GY6jX16cAJ2k",
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyId": 1,
"divisible": true,
"amount": "1"
}
],
"meta": {
"totalCount": 3,
"index": 0,
"limit": 50,
"results": 3
}
}
Info
The endpoint returns an array of the latest transactions relayed in the blockchain that haven’t been included in any blocks.
HTTP Request
GET /v1/bc/btc/omni/${NETWORK}/txs/unconfirmed
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 Confirmed Transactions By Address
Sample Data
curl -X GET 'https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key'
GET /v1/bc/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100 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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100').then(function(d) {console.log(d)});
const https = require('https');
var options = {
"method": "GET",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100",
"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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100');
$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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100")
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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100'
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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100")
.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/btc/omni/mainnet/address/1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n/transactions?limit=100")
}
Response Body
{
"meta": {
"totalCount": 138,
"index": 0,
"limit": 100,
"results": 100
},
"payload": [
{
"txid": "94a6835b6cb0d481e9125a65f1948384476bbb59d464d0878cec9631ad9a1c62",
"sendingAddress": "1PSr7yqcPXrzEiEFdTEPQYAHU6uoXXXZ5i",
"type": "DEx Purchase",
"blockHash": "00000000000000000020de60638af2e98472900dff6d9c23d605e5186d3fcb85",
"blocktime": 1555198807,
"block": 571540,
"confirmations": 78402,
"purchases": [
{
"vout": 1,
"amountPaid": "0.0001",
"referenceAddress": "1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n",
"propertyId": 2,
"amountBought": "1",
"valid": true
}
]
},
...
{
"txid": "feb9d6eb4da941111d8d2a6e591b8138948e12d04f5e6effe7ffdb30a5bd9bd1",
"sendingAddress": "1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n",
"type": "DEx Purchase",
"blockHash": "000000000000000018848541f8cfb931fa03ce45f19ef012e28f274a87ea0312",
"blocktime": 1404869857,
"block": 309854,
"confirmations": 340088,
"purchases": [
{
"vout": 2,
"amountPaid": "0.00895401",
"referenceAddress": "1PVWtK1ATnvbRaRceLRH5xj8XV1LxUBu7n",
"propertyId": 2,
"amountBought": "0.00000001",
"valid": true
}
]
}
]
}
Info
The Address Transactions Endpoint returns all information available about a particular address, including an array of complete transactions.
HTTP Request
GET /v1/bc/btc/omni/${NETWORK}/address/${ADDRESS}/transactions
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:
mtFYoSowT3i649wnBDYjCjewenh8AuofQb
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.
Transactions
Prepare a Transaction
Info
This endpoint allows users to create transactions type Simple Send
within the Omni Layer.
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/create \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"from":"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"to":"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.00013,
"fee": 0.00024,
"propertyID": 2
}'
POST /v1/bc/btc/omni/testnet/txs/create HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"from":"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"to":"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.00013,
"fee": 0.00024,
"propertyID": 2
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/create",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/testnet/txs/create",
"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({ from: 'mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz',
to: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1',
value: 0.00013,
fee: 0.00024,
propertyID: 2 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/create');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"from":"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"to":"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.00013,
"fee": 0.00024,
"propertyID": 2
}');
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/btc/omni/testnet/txs/create")
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\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btc/omni/testnet/txs/create, 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\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/create")
.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/btc/omni/testnet/txs/create"
payload := strings.NewReader("{\n\t\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2\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": "02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000"
}
To use Crypto APIs two-endpoint transaction creation tool, first you need to provide the from address, to address, the fee wihich will be paid to miners, the propertyId of the token and value to transfer. All these above-mentioned fields are required. There are two optional fields: data(if you want to send an additional message within the bitcoin transaction) and locktime (if you want to lock your transaction for a certain period of time).
HTTP Request
POST /v1/bc/btc/omni/${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:
{
"from": "...",
"to": "...",
"value": ...,
"fee": ...,
"propertyID": ...
}
Optional fields include:
{
"locktime": ...,
"data": "...",
}
You need to include data
(string) field only if you want to send messages/metadata with the transaction.
Locktime
(integer) has a default value of zero. Use locktime
if a transaction should be delayed to a specific time.
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/btc/omni/testnet/txs/sign \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"hex":"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"wif": "cPo4XXgsnkVd.....WmA"
}'
POST /v1/bc/btc/omni/testnet/txs/sign HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex":"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"wif": "cPo4XXgsnkVd.....WmA"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/sign",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n \"hex\":\"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wif\": \n \"cPo4XXgsnkVd.....WmA\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/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: '02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000',
wif: 'cPo4XXgsnkVd.....WmA' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/sign');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex":"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"wif": "cPo4XXgsnkVd.....WmA"
}');
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/btc/omni/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\":\"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wif\": \"cPo4XXgsnkVd.....WmA\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n \"hex\":\"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wif\": \"cPo4XXgsnkVd.....WmA\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btc/omni/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\":\"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wif\": \"cPo4XXgsnkVd.....WmA\"\n");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btc/omni/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/btc/omni/testnet/txs/sign"
payload := strings.NewReader("{\n \"hex\":\"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb0200000000ffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa60000000000ffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\",\n \"wif\": \"cPo4XXgsnkVd.....WmA\"\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": "02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000",
"complete": true
}
}
Info
The Sign a Transaction Endpoint allows users to sign a raw transaction.
HTTP Request
POST /v1/bc/btc/omni/${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/btc/omni/testnet/txs/send/ \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"hex" : "02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000"
}'
POST /v1/bc/btc/omni/testnet/txs/send HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"hex" : "02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/send",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"hex\" : \"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/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: '02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/send');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"hex" : "02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000"
}');
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/btc/omni/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\" : \"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"hex\" : \"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btc/omni/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\" : \"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\"\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btc/omni/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/btc/omni/testnet/txs/send"
payload := strings.NewReader("{\n\t\"hex\" : \"02000000023eda1a3a2297aa3b909c4baa212ddbeb6b2ff8ed3954585b465b6432d4709fdb020000006a47304402205e29a6f6b16b535652f536b9b498b06296b298d82a553a259feaf234542d53f0022027658af4628325f3949a45fb557c8bffb8af848472b86582ff9edf89cd8bb6d8012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff99832999e7188a02cb421790554d35c14776b8c779733225e4a49e5af67dcfa6000000006b483045022100a41e860f289dcc6e5d38d0c5a08a8fb4b35447ddd200ab20dc63c5bcba5d1e1502204c27366ccec47adc4aff9e9d2ab29ed049bd6e576d0d6e167c0b70b9e77c2f5d012102f2da8ea7631c851074640c5e44203cbe4ff11386fc267a89e89c80bbc2dee5eaffffffff0324a00000000000001976a91445bfa6143f69be3475e17724397f1146a60a81f388ac0000000000000000166a146f6d6e69000000000000000200000000000032c822020000000000001976a914481e003d23566c1789dc9362085c3a0876570c7c88ac00000000\"\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": "831d0bc45660d933d6a2e6fae625b80ed15806d2087e80538f0eddabfc3c265c"
}
}
Transaction Send Endpoint allows users to broadcast the signed transaction to the Bitcoin blockchain.
HTTP Request
POST /v1/bc/btc/omni/${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/btc/omni/testnet/txs/new \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"from":"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"to":"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.00013,
"fee": 0.00024,
"propertyID": 2,
"wif":"cSEjySAR...g68ZMjoud",
"data": "this is so cool!"
}'
POST /v1/bc/btc/omni/testnet/txs/new HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"from":"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"to":"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.00013,
"fee": 0.00024,
"propertyID": 2,
"wif":"cSEjySAR...g68ZMjoud",
"data": "this is so cool!"
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/new",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2,\n\t\"wif\":\"cSEjySAR...g68ZMjoud\",\n\t\"data\": \"this is so cool!\"\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/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({ from: 'mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz',
to: 'mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1',
value: 0.00013,
fee: 0.00024,
propertyID: 2,
wif: 'cSEjySAR...g68ZMjoud',
data: 'this is so cool!' }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/new');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"from":"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz",
"to":"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1",
"value": 0.00013,
"fee": 0.00024,
"propertyID": 2,
"wif":"cSEjySAR...g68ZMjoud",
"data": "this is so cool!"
}');
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/btc/omni/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\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2,\n\t\"wif\":\"cSEjySAR...g68ZMjoud\",\n\t\"data\": \"this is so cool!\"\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2,\n\t\"wif\":\"cSEjySAR...g68ZMjoud\",\n\t\"data\": \"this is so cool!\"\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btc/omni/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\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2,\n\t\"wif\":\"cSEjySAR...g68ZMjoud\",\n\t\"data\": \"this is so cool!\"\n}
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btc/omni/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/btc/omni/testnet/txs/new"
payload := strings.NewReader("{\n\t\"from\":\"mmskWH7hG9CJNzb16JaVFJyWdgAwcVEAkz\", \n\t\"to\":\"mn6GtNFRPwXtW7xJqH8Afck7FbVoRi6NF1\", \n\t\"value\": 0.00013,\n\t\"fee\": 0.00024,\n\t\"propertyID\": 2,\n\t\"wif\":\"cSEjySAR...g68ZMjoud\",\n\t\"data\": \"this is so cool!\"\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":"f93c04878779b1913b5a93ee01beb5f64796635bb216076c3630896e3179ae5c"
}
}
The Prepare, Sign and Broadcast a Transaction Endpoint combines the other three endpoints: Create, Sign and Send Endpoints. In other words, this endpoint directly broadcasts the newly created transaction to the Bitcoin blockchain. For more information, see the examples.
Users can set two optional fields: data
and locktime
.
{
"from":"...",
"to":"...",
"value": ...,
"fee": ...,
"propertyID": ...,
"wif":"...",
"data": "...",
"locktime": ...
}
You need to include data
(string) field only if you want to send messages/metadata with the transaction.
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/btc/omni/${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/btc/omni/mainnet/txs/hdwallet \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"walletName": "testWallet",
"password" : ".....",
"from": "1hKokTrSazxviF6TupZEa4EkhDsps87Q8",
"to": "1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H",
"value": 200,
"fee": 0.0005,
"propertyID": 31
}'
POST /v1/bc/btc/omni/mainnet/txs/hdwallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"walletName": "testWallet",
"password" : ".....",
"from": "1hKokTrSazxviF6TupZEa4EkhDsps87Q8",
"to": "1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H",
"value": 200,
"fee": 0.0005,
"propertyID": 31
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/txs/hdwallet",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"walletName\": \"testWallet\",\n \"password\" : \".....\",\n\t\"from\": \"1hKokTrSazxviF6TupZEa4EkhDsps87Q8\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/mainnet/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: 'testWallet',
password: '.....',
from: '1hKokTrSazxviF6TupZEa4EkhDsps87Q8',
to: '1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H',
value: 200,
fee: 0.0005,
propertyID: 31 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/txs/hdwallet');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"walletName": "testWallet",
"password" : ".....",
"from": "1hKokTrSazxviF6TupZEa4EkhDsps87Q8",
"to": "1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H",
"value": 200,
"fee": 0.0005,
"propertyID": 31
}');
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/btc/omni/mainnet/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\": \"testWallet\",\n \"password\" : \".....\",\n\t\"from\": \"1hKokTrSazxviF6TupZEa4EkhDsps87Q8\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"walletName\": \"testWallet\",\n \"password\" : \".....\",\n\t\"from\": \"1hKokTrSazxviF6TupZEa4EkhDsps87Q8\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btc/mainnet/omni/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\": \"testWallet\",\n \"password\" : \".....\",\n\t\"from\": \"1hKokTrSazxviF6TupZEa4EkhDsps87Q8\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btc/omni/mainnet/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/btc/omni/mainnet/txs/hdwallet"
payload := strings.NewReader("{\n\t\"walletName\": \"testWallet\",\n \"password\" : \".....\",\n\t\"from\": \"1hKokTrSazxviF6TupZEa4EkhDsps87Q8\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\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": "bc2da5a19b6e6ccf9b153dd0f84a967721aae83a18c85a24564cae868b3c052d"
}
}
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, from, to, value, fee and propertyID. There are a two optional fields, such as: data and locktime.
Two optional fields are available:
{
"locktime": ...,
"data": "..."
}
You need to include data
(string) field only if you want to send messages/metadata with the transaction.
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/btc/omni/${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 inlcuded) is shown.
The complete JSON object request
{
"walletName": "...",
"password" : ".....",
"from": "...",
"to": "...",
"value": ...,
"fee": ...,
"propertyID": ...
}
Prepare, Sign and Broadcast a Transaction Using non-custodial-wallet
Sample Data
curl -X POST \
https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/non-custodial-wallet \
-H 'Content-Type: application/json' \
-H 'X-API-Key: my-api-key' \
-d '{
"walletId": "5f11903365220500012096ba",
"password" : ".....",
"from": "2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b",
"to": "1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H",
"value": 200,
"fee": 0.0005,
"propertyID": 31
}'
POST /v1/bc/btc/omni/testnet/txs/non-custodial-wallet HTTP/1.1
Host: api.cryptoapis.io
Content-Type: application/json
X-API-Key: my-api-key
{
"walletId": "5f11903365220500012096ba",
"password" : ".....",
"from": "2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b",
"to": "1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H",
"value": 200,
"fee": 0.0005,
"propertyID": 31
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/non-custodial-wallet",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-API-Key": "my-api-key"
},
"processData": false,
"data": "{\n\t\"walletId\": \"5f11903365220500012096ba\",\n \"password\" : \".....\",\n\t\"from\": \"2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var http = require("http");
var options = {
"method": "POST",
"hostname": "api.cryptoapis.io",
"path": "/v1/bc/btc/omni/testnet/txs/non-custodial-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.write(JSON.stringify({ walletId: '5f11903365220500012096ba',
password: '.....',
from: '2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b',
to: '1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H',
value: 200,
fee: 0.0005,
propertyID: 31 }));
req.end();
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/non-custodial-wallet');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-Key' => 'my-api-key'
));
$request->setBody('{
"walletId": "5f11903365220500012096ba",
"password" : ".....",
"from": "2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b",
"to": "1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H",
"value": 200,
"fee": 0.0005,
"propertyID": 31
}');
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/btc/omni/testnet/txs/non-custodial-wallet")
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\"walletId\": \"5f11903365220500012096ba\",\n \"password\" : \".....\",\n\t\"from\": \"2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPConnection("https://api.cryptoapis.io")
payload = "{\n\t\"walletId\": \"5f11903365220500012096ba\",\n \"password\" : \".....\",\n\t\"from\": \"2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}"
headers = {
'Content-Type': "application/json",
'X-API-Key': "my-api-key"
}
conn.request("POST", "/v1/bc/btc/testnet/omni/txs/non-custodial-wallet", 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\"walletId\": \"5f11903365220500012096ba\",\n \"password\" : \".....\",\n\t\"from\": \"2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\n}");
Request request = new Request.Builder()
.url("https://api.cryptoapis.io/v1/bc/btc/omni/testnet/txs/non-custodial-wallet")
.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/btc/omni/testnet/txs/non-custodial-wallet"
payload := strings.NewReader("{\n\t\"walletId\": \"5f11903365220500012096ba\",\n \"password\" : \".....\",\n\t\"from\": \"2NG2TJS2AFMtW7izZnQ1r7XDKTnY6AMAN3b\", \n\t\"to\": \"1FWnWwv6Tmsucqeqcjz56j4v3E1wCSzZ6H\", \n\t\"value\": 200,\n\t\"fee\": 0.0005,\n\t\"propertyID\": 31\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": "d8d6a4d470deccea510c4b4b704de060d8f235d120e4bd7524a0805e14cbb9ed",
"view_in_explorer": "https://blockexplorer.one/btc/omni/testnet/tx/d8d6a4d470deccea510c4b4b704de060d8f235d120e4bd7524a0805e14cbb9ed?utm_source=cryptoapis.io"
}
}
Prepare, Sign and Broadcast a Transaction Using non-custodial-wallet Endpoint provides the possibility to create, sign and send new transactions using your Non-Custodial Wallet
. The mandatory fields are: walletId, password, from, to, value, fee and propertyID.
HTTP Request
POST /v1/bc/btc/omni/${NETWORK}/txs/non-custodial-wallet
Query Parameters
Parameter | Default | Description |
---|---|---|
NETWORK | ------- | Network name (e.g. testnet or mainnet) |
See the example where the complete JSON object request is shown.
The complete JSON object request
{
"walletId": (string),
"password" : (string),
"from": (string),
"to": (string),
"value": (double),
"fee": (double),
"propertyID": (integer)
}