MatterCloud API Introduction
MatterCloud:A Bitcoin Service Provider.
Bitcoin (BSV) Blockchain Infrastructure.
Built for developers and companies — easily utilize the Bitcoin SV blockchain for payments, data storage, smart contracts, media distribution and more.
Authentication
Optional for higher limits and premium plans.
Get your API credentials at https://www.mattercloud.io with 'Get API Key' to generate a new key.
The param api_key
must be passed in as URL query params or HTTP headers.
Example:
GET https://api.mattercloud.io/api/v3/main/address/12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX/utxo?api_key=your-api-key
HTTP headers:
api_key: YOUR_API_KEY
GET https://api.mattercloud.io/api/v3/main/address/12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX/balance?api_key=your-api-key
Rate Limits
See Plans page for rate limits.
BitcoinFiles
BitcoinFiles is a complete platform for storing, searching, and querying the Bitcoin blockchain and mempool in real-time.
Learn More:
Create File
Create andn publish a file transaction directly on BSV blockchain.
Note: This is used to broadcast directly (files smaller than 99KB).
For files large than 99KB see the method queueFile
var createRequest = {
file: {
content: 'Hello world!',
contentType: 'text/plain',
},
pay: {
key: privateKey
}
};
var result = await bitcoinfiles.createFile(createRequest);
var createRequest = {
file: {
content: 'Hello world!',
contentType: 'text/plain',
},
pay: {
key: privateKey
}
};
var result = await bitcoinfiles.createFile(createRequest);
This endpoint broadcasts a file transaction to the blockchain directly.
Queue File Upload
You can queue large files to be uploaded after paying the payment_sats_needed
to the payment_address
.
For files smaller than 99KB see the method createFile
var queueRequest = {
file: {
content: '<h1>Hello</h1>',
contentType: 'text/html',
encoding: 'utf8', // 'hex', 'utf8', 'base64'
name: 'mytestfile.html',
}
//, session_tag: 'a-random-uuid-you-can-use-as-a-folder'
};
var result = await bitcoinfiles.queueFile(queueRequest);
/*
{
"success":true,
"result":[
{
"id":2613,
"session_tag":"5d57b244-91a4-4cb6-ae98-c6e0e4b29e91",
"payment_address":"1A11zmKhqP29y8GjrzcssFNRoqiBWcWSNa",
"filename":"mytesth.falsee38ee790-8f3a-11ea-bb89-2bd752d34d1a.false",
"first_broadcast_time":null,
"last_broadcast_time":null,
"payment_sats_needed":2008,
"txid":null,
"fileurl":"https://bitcoinfilesmatter.s3.amazonaws.com/mytesth.falsee38ee790-8f3a-11ea-bb89-2bd752d34d1a.false",
"filesize":14,
"blockhash":null,
"created_time":1588729369
}
]
}
*/
var queueRequest = {
file: {
content: '<h1>Hello</h1>',
contentType: 'text/html',
encoding: 'utf8', // 'hex', 'utf8', 'base64'
name: 'mytestfile.html',
}
//, session_tag: 'a-random-uuid-you-can-use-as-a-folder'
};
var result = await bitcoinfiles.queueFile(queueRequest);
/*
{
"success":true,
"result":[
{
"id":2613,
"session_tag":"5d57b244-91a4-4cb6-ae98-c6e0e4b29e91",
"payment_address":"1A11zmKhqP29y8GjrzcssFNRoqiBWcWSNa",
"filename":"mytesth.falsee38ee790-8f3a-11ea-bb89-2bd752d34d1a.false",
"first_broadcast_time":null,
"last_broadcast_time":null,
"payment_sats_needed":2008,
"txid":null,
"fileurl":"https://bitcoinfilesmatter.s3.amazonaws.com/mytesth.falsee38ee790-8f3a-11ea-bb89-2bd752d34d1a.false",
"filesize":14,
"blockhash":null,
"created_time":1588729369
}
]
}
*/
This endpoint queues a file to be uploaded after the payment_address
is paid with payment_sats_needed
Get File
Get File by txid
curl https://media.bitcoinfiles.org/408d3b99a06afd01e1717d78a7a9d2ee1c08f59003022429ae9b0a66075dfd40
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getFile('408d3b99a06afd01e1717d78a7a9d2ee1c08f59003022429ae9b0a66075dfd40');
The above command returns the raw bytes of the file
This endpoint retrieves bitcoin file at txid
HTTP Request
GET https://media.bitcoinfiles.org/408d3b99a06afd01e1717d78a7a9d2ee1c08f59003022429ae9b0a66075dfd40
URL Parameters
Parameter | Description |
---|---|
txid | Txid of the file |
Filepay
Filepay is a simple library to post data and upload files to the Bitcoin SV blockchain.
Example file:
Get Transaction (Optional Block and Merkle path)
Get file transaction by txid.
Options:
inputInfo=1
to retrieve the satoshis, address, and lockingScript for each vin.includeBlock=1
to retrieve block and merkle info if tx is mined.raw=1
to return the raw tx hex and raw block hex instead of JSON
curl https://media.bitcoinfiles.org/tx/408d3b99a06afd01e1717d78a7a9d2ee1c08f59003022429ae9b0a66075dfd40?inputInfo=true&includeBlock=1&raw=0
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getTx('633fc9e55db4039d5b48df8aab31cd2366d98d64285fdc2aa53c17aa895b476e', null, {
includeBlock: true,
raw: false,
inputInfo: true });
The above command returns the transaction
{
"hash":"9aaf2ae7015fffee2f31c2ce071bd4cce76e668b65d3db0f30665a814dfda84e",
"version":1,
"inputs":[
{
"prevTxId":"7a5ea5b0893d44084c8741c919f9555112f6f34f3966eed1c3cd937620a1aa66",
"outputIndex":1,
"sequenceNumber":4294967294,
"script":"47304402207be7bf327a2c1412b0773ca878da5822564d798cb893549a68b020b23b9412380220069283eafe72e2e66d155dbe50a54925355dca10dff772377d7c7272907ed1f4412103aaed350d46c047f2dfc8c1e3b69e88552d35d79c3c589fbf32fe4216a8b59057",
"scriptString":"71 0x304402207be7bf327a2c1412b0773ca878da5822564d798cb893549a68b020b23b9412380220069283eafe72e2e66d155dbe50a54925355dca10dff772377d7c7272907ed1f441 33 0x03aaed350d46c047f2dfc8c1e3b69e88552d35d79c3c589fbf32fe4216a8b59057",
"satoshis":9670,
"address":"15MypiVWwY1dEpkEEviLSqRi7ySW5cfJMV",
"lockingScript":"76a9142fd8416c04c42df9808bd6525d0cdab1d27ce28088ac"
}
],
"outputs":[
{
"satoshis":208300000,
"script":"76a914239880104dbe3f5d34364f57b5e9c794135468ea88ac"
},
{
"satoshis":657898800,
"script":"76a91458e87ba0ea87ed590031a4e7f3ee1b85713aa87688ac"
}
],
"nLockTime":630519
}
// With block information: https://media.bitcoinfiles.org/tx/9bebc37a1bd107c3ade78793a062312041e91d377b62548e9124d4e1b8df2a1b?includeBlock=1&raw=0&inputInfo=1
{
"tx":{
"hash":"9bebc37a1bd107c3ade78793a062312041e91d377b62548e9124d4e1b8df2a1b",
"version":1,
"inputs":[
{
"prevTxId":"1f6486d1e9f60878d682bd17ae3be44b62b6d8577ac6f4deff7f654748c5327f",
"outputIndex":1,
"sequenceNumber":4294967295,
"script":"483045022100a13deebd441a79d8dfc32010b42a9094aad26cb61966d200730c53acc3d6a54802206ab4b652c723017b0bf405cbbabf1055c4970b5fbb3027e39d7d7039d4aefd92412103023f7579161115a5b2eba387c12dd88b636ab15ffaa6e7c93bcbd1e36b2a367a",
"scriptString":"72 0x3045022100a13deebd441a79d8dfc32010b42a9094aad26cb61966d200730c53acc3d6a54802206ab4b652c723017b0bf405cbbabf1055c4970b5fbb3027e39d7d7039d4aefd9241 33 0x03023f7579161115a5b2eba387c12dd88b636ab15ffaa6e7c93bcbd1e36b2a367a",
"satoshis":13600000,
"address":"13nM162gxnaZx89Wm9kdRGAQS89FVFkF6a",
"lockingScript":"76a9141e83aa8fb461dd16319ad0548a5b443f56ee881b88ac"
}
],
"outputs":[
{
"satoshis":7840000,
"script":"76a914463300d931e7d7dffff49cb2b0be3836386d441b88ac",
"outputIndex":0,
"address":"17QBQCdZCfn1wMAT1NpfJeLTRYwdyxGV1X"
},
{
"satoshis":5759547,
"script":"76a9146a972de3b20b99cde820a323735ab0ef8f7b889d88ac",
"outputIndex":1,
"address":"1AibjTGQBdWMtxPEDtv75eLsNGzuzoEFTs"
}
],
"nLockTime":0
},
"block":{
"header":{
"hash":"000000000000000003a95a5dcc1779b6e08fd24e6c88dc2843bbcb2f7257cc18",
"version":671080448,
"prevHash":"0000000000000000036801b2a04c2013b0a1b096eff7449963e8e5e7c544b259",
"merkleRoot":"299c76dfd47b382319394a167127aaf41ae68c82565499782dd88d162a0f808c",
"time":1590342076,
"bits":402913836,
"nonce":2183222916
},
"numTransactions":7288,
"hashes":[
"37e8816ba1ad8a5cbf615055d10103f75b594d35830e6a012c61b3725ee00e75",
"1b2adfb8e1d424918e54627b371de941203162a09387e7adc307d11b7ac3eb9b",
"bd6d5190117406a668edf88ba720da654de502cafca6c39746445a88f6da33f4",
"6988d1c48a896efc0c8f98263f7a6b9dcc402769fa979b43fb7150c01d19c770",
"8b71a1fb94efefed891eed4316d0644d82280e6ad3fbcc06ca93793cff3bf2c9",
"cbb77fc4a2f8e2d884b9e0682fbafe13dc07eca2f9b84c05ea4104b586f364b5",
"08a1cb5a5c4cbaeca8b7d4ea6464bd7bad73a82fce1a58c65c3da9db12c6c42a",
"af1574d69fb46f15ad4147b77d301ef074eb8f17baf2a5614f1b4cc5c6de4418",
"992146b6d5cb21c3bb6bb93b7cd1ffa5bd9388125aee91c6c472f0c17051ca4e",
"db94c52778da8a45a01e079a0fe8e47d475bbf2c3270527ccfb67f7b175f0d20",
"505e01d30a4b7aa66e32916ea69982a813bb59596759167a86b1ec5d7eb211a8",
"9a06d2005db28fb7339980c902f51e53293af967d910d56eed95883f2c308943",
"e2acbeab45f83b7b010e90653ff642db5c57e7ea040d56436822c0a89f41821e",
"197ce9b68a71b63ca728f8df1865ff567a07a57ac16510e4d0038b0e6269df5a"
],
"flags":[
255,
119,
0,
0
]
}
}
{
"hash":"9aaf2ae7015fffee2f31c2ce071bd4cce76e668b65d3db0f30665a814dfda84e",
"version":1,
"inputs":[
{
"prevTxId":"7a5ea5b0893d44084c8741c919f9555112f6f34f3966eed1c3cd937620a1aa66",
"outputIndex":1,
"sequenceNumber":4294967294,
"script":"47304402207be7bf327a2c1412b0773ca878da5822564d798cb893549a68b020b23b9412380220069283eafe72e2e66d155dbe50a54925355dca10dff772377d7c7272907ed1f4412103aaed350d46c047f2dfc8c1e3b69e88552d35d79c3c589fbf32fe4216a8b59057",
"scriptString":"71 0x304402207be7bf327a2c1412b0773ca878da5822564d798cb893549a68b020b23b9412380220069283eafe72e2e66d155dbe50a54925355dca10dff772377d7c7272907ed1f441 33 0x03aaed350d46c047f2dfc8c1e3b69e88552d35d79c3c589fbf32fe4216a8b59057",
"satoshis":9670,
"address":"15MypiVWwY1dEpkEEviLSqRi7ySW5cfJMV",
"lockingScript":"76a9142fd8416c04c42df9808bd6525d0cdab1d27ce28088ac"
}
],
"outputs":[
{
"satoshis":208300000,
"script":"76a914239880104dbe3f5d34364f57b5e9c794135468ea88ac"
},
{
"satoshis":657898800,
"script":"76a91458e87ba0ea87ed590031a4e7f3ee1b85713aa87688ac"
}
],
"nLockTime":630519
}
// With block information: https://media.bitcoinfiles.org/tx/9bebc37a1bd107c3ade78793a062312041e91d377b62548e9124d4e1b8df2a1b?includeBlock=1&raw=0&inputInfo=1
{
"tx":{
"hash":"9bebc37a1bd107c3ade78793a062312041e91d377b62548e9124d4e1b8df2a1b",
"version":1,
"inputs":[
{
"prevTxId":"1f6486d1e9f60878d682bd17ae3be44b62b6d8577ac6f4deff7f654748c5327f",
"outputIndex":1,
"sequenceNumber":4294967295,
"script":"483045022100a13deebd441a79d8dfc32010b42a9094aad26cb61966d200730c53acc3d6a54802206ab4b652c723017b0bf405cbbabf1055c4970b5fbb3027e39d7d7039d4aefd92412103023f7579161115a5b2eba387c12dd88b636ab15ffaa6e7c93bcbd1e36b2a367a",
"scriptString":"72 0x3045022100a13deebd441a79d8dfc32010b42a9094aad26cb61966d200730c53acc3d6a54802206ab4b652c723017b0bf405cbbabf1055c4970b5fbb3027e39d7d7039d4aefd9241 33 0x03023f7579161115a5b2eba387c12dd88b636ab15ffaa6e7c93bcbd1e36b2a367a",
"satoshis":13600000,
"address":"13nM162gxnaZx89Wm9kdRGAQS89FVFkF6a",
"lockingScript":"76a9141e83aa8fb461dd16319ad0548a5b443f56ee881b88ac"
}
],
"outputs":[
{
"satoshis":7840000,
"script":"76a914463300d931e7d7dffff49cb2b0be3836386d441b88ac",
"outputIndex":0,
"address":"17QBQCdZCfn1wMAT1NpfJeLTRYwdyxGV1X"
},
{
"satoshis":5759547,
"script":"76a9146a972de3b20b99cde820a323735ab0ef8f7b889d88ac",
"outputIndex":1,
"address":"1AibjTGQBdWMtxPEDtv75eLsNGzuzoEFTs"
}
],
"nLockTime":0
},
"block":{
"header":{
"hash":"000000000000000003a95a5dcc1779b6e08fd24e6c88dc2843bbcb2f7257cc18",
"version":671080448,
"prevHash":"0000000000000000036801b2a04c2013b0a1b096eff7449963e8e5e7c544b259",
"merkleRoot":"299c76dfd47b382319394a167127aaf41ae68c82565499782dd88d162a0f808c",
"time":1590342076,
"bits":402913836,
"nonce":2183222916
},
"numTransactions":7288,
"hashes":[
"37e8816ba1ad8a5cbf615055d10103f75b594d35830e6a012c61b3725ee00e75",
"1b2adfb8e1d424918e54627b371de941203162a09387e7adc307d11b7ac3eb9b",
"bd6d5190117406a668edf88ba720da654de502cafca6c39746445a88f6da33f4",
"6988d1c48a896efc0c8f98263f7a6b9dcc402769fa979b43fb7150c01d19c770",
"8b71a1fb94efefed891eed4316d0644d82280e6ad3fbcc06ca93793cff3bf2c9",
"cbb77fc4a2f8e2d884b9e0682fbafe13dc07eca2f9b84c05ea4104b586f364b5",
"08a1cb5a5c4cbaeca8b7d4ea6464bd7bad73a82fce1a58c65c3da9db12c6c42a",
"af1574d69fb46f15ad4147b77d301ef074eb8f17baf2a5614f1b4cc5c6de4418",
"992146b6d5cb21c3bb6bb93b7cd1ffa5bd9388125aee91c6c472f0c17051ca4e",
"db94c52778da8a45a01e079a0fe8e47d475bbf2c3270527ccfb67f7b175f0d20",
"505e01d30a4b7aa66e32916ea69982a813bb59596759167a86b1ec5d7eb211a8",
"9a06d2005db28fb7339980c902f51e53293af967d910d56eed95883f2c308943",
"e2acbeab45f83b7b010e90653ff642db5c57e7ea040d56436822c0a89f41821e",
"197ce9b68a71b63ca728f8df1865ff567a07a57ac16510e4d0038b0e6269df5a"
],
"flags":[
255,
119,
0,
0
]
}
}
This endpoint retrieves transaction at txid
HTTP Request
GET https://media.bitcoinfiles.org/9aaf2ae7015fffee2f31c2ce071bd4cce76e668b65d3db0f30665a814dfda84e
URL Parameters
Parameter | Description |
---|---|
txid | Txid of the transaction |
Get Raw Transaction
Get file transaction by txid
curl https://media.bitcoinfiles.org/rawtx/408d3b99a06afd01e1717d78a7a9d2ee1c08f59003022429ae9b0a66075dfd40
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getTxRaw('9aaf2ae7015fffee2f31c2ce071bd4cce76e668b65d3db0f30665a814dfda84e');
The above command returns the raw transaction
010000000166aaa1207693cdc3d1ee66394ff3f6125155f919c941874c08443d89b0a55e7a010000006a47304402207be7bf327a2c1412b0773ca878da5822564d798cb893549a68b020b23b9412380220069283eafe72e2e66d155dbe50a54925355dca10dff772377d7c7272907ed1f4412103aaed350d46c047f2dfc8c1e3b69e88552d35d79c3c589fbf32fe4216a8b59057feffffff02e0676a0c000000001976a914239880104dbe3f5d34364f57b5e9c794135468ea88ac30bd3627000000001976a91458e87ba0ea87ed590031a4e7f3ee1b85713aa87688acf79e0900
010000000166aaa1207693cdc3d1ee66394ff3f6125155f919c941874c08443d89b0a55e7a010000006a47304402207be7bf327a2c1412b0773ca878da5822564d798cb893549a68b020b23b9412380220069283eafe72e2e66d155dbe50a54925355dca10dff772377d7c7272907ed1f4412103aaed350d46c047f2dfc8c1e3b69e88552d35d79c3c589fbf32fe4216a8b59057feffffff02e0676a0c000000001976a914239880104dbe3f5d34364f57b5e9c794135468ea88ac30bd3627000000001976a91458e87ba0ea87ed590031a4e7f3ee1b85713aa87688acf79e0900
This endpoint retrieves transaction at txid
HTTP Request
GET https://media.bitcoinfiles.org/tx/9aaf2ae7015fffee2f31c2ce071bd4cce76e668b65d3db0f30665a814dfda84e/raw
URL Parameters
Parameter | Description |
---|---|
txid | Txid of the transaction |
Get Transaction Merkle Proof
Get Transaction Merkle Proof
curl https://media.bitcoinfiles.org/txproof/77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getTxOutProof('77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4');
The above command returns the merkle proof of transaction (MerkleBlock)
{
"header":{
"hash":"000000000000000000049eb3ff753e223b0a1bce976137f8e9454c82c31f523f",
"version":536870912,
"prevHash":"000000000000000003eb1a34752e2aafe0cf9c93926caa54aedd30fe62c14c6e",
"merkleRoot":"44ff80a9bdc2a15555bfdfcd637accf48aafdb27ebd4cd9d4c7c29aa9a0a019e",
"time":1587248088,
"bits":402960587,
"nonce":2605488380
},
"numTransactions":9744,
"hashes":[
"d0c4eb3cdc2e35b387c2a2c9fee0dfa504482e033579c66d470dbee0e7894f25",
"b46f0794f08bc66b9d2bd80ec3ab8e2ed6359308d33b4495b7db806ec19d6177",
"34a2cd3bc26b815d29049aa333593ae92ad1ea02f75f9863fea69e9547707cc8",
"366d88cfa8affdee442bad72626ccc7fd5285ea077e8b5b6e5bc9205d0a4ce12",
"3a65ac66248cd643751d67ae022262d6c811ee45e13cc15757f79e5d119e3cec",
"4cbf1068d82630cfe1a9612b864a6403d44eda3577550de845bf3f7805173fd5",
"9560aa9eabdff4db8bd86d5c267d89a96d3953834a23697946855861aba8dce7",
"b4cf3be1af1134fabe42d48eb89ffd85b7592d7c898a711eb74b53f5dafc4941",
"094784d94ad265346b18850cf35b758d69a33541d68ddb10dfd846751df47560",
"7c251822e97714f238ee4544ee5bb2e2923126b30be66b09b927dc8625d03df3",
"88eb5e7460e9faa4961f077a39aea18a0983afaf99e9cea28ee724a45de0a3e8",
"58662251d7c9f12dd59dd5f7165221c0531104396bbe717ca56a70edf9878dc9",
"8599f2358f7fa6855ba41d125745aa646bbc6b81c00af26eeaca6c0c0e0dfbfc",
"c710a24c4a7fc5b4aeda613ef08da68892816c1d6ff8d783c92290c8ba3bba81",
"ccd11f375aa4047cc63f4de034fc7490f3f5448e5163df258688f2cef6bd13fb"
],
"flags":[
255,
191,
0,
0
]
}
{
"header":{
"hash":"000000000000000000049eb3ff753e223b0a1bce976137f8e9454c82c31f523f",
"version":536870912,
"prevHash":"000000000000000003eb1a34752e2aafe0cf9c93926caa54aedd30fe62c14c6e",
"merkleRoot":"44ff80a9bdc2a15555bfdfcd637accf48aafdb27ebd4cd9d4c7c29aa9a0a019e",
"time":1587248088,
"bits":402960587,
"nonce":2605488380
},
"numTransactions":9744,
"hashes":[
"d0c4eb3cdc2e35b387c2a2c9fee0dfa504482e033579c66d470dbee0e7894f25",
"b46f0794f08bc66b9d2bd80ec3ab8e2ed6359308d33b4495b7db806ec19d6177",
"34a2cd3bc26b815d29049aa333593ae92ad1ea02f75f9863fea69e9547707cc8",
"366d88cfa8affdee442bad72626ccc7fd5285ea077e8b5b6e5bc9205d0a4ce12",
"3a65ac66248cd643751d67ae022262d6c811ee45e13cc15757f79e5d119e3cec",
"4cbf1068d82630cfe1a9612b864a6403d44eda3577550de845bf3f7805173fd5",
"9560aa9eabdff4db8bd86d5c267d89a96d3953834a23697946855861aba8dce7",
"b4cf3be1af1134fabe42d48eb89ffd85b7592d7c898a711eb74b53f5dafc4941",
"094784d94ad265346b18850cf35b758d69a33541d68ddb10dfd846751df47560",
"7c251822e97714f238ee4544ee5bb2e2923126b30be66b09b927dc8625d03df3",
"88eb5e7460e9faa4961f077a39aea18a0983afaf99e9cea28ee724a45de0a3e8",
"58662251d7c9f12dd59dd5f7165221c0531104396bbe717ca56a70edf9878dc9",
"8599f2358f7fa6855ba41d125745aa646bbc6b81c00af26eeaca6c0c0e0dfbfc",
"c710a24c4a7fc5b4aeda613ef08da68892816c1d6ff8d783c92290c8ba3bba81",
"ccd11f375aa4047cc63f4de034fc7490f3f5448e5163df258688f2cef6bd13fb"
],
"flags":[
255,
191,
0,
0
]
}
This endpoint retrieves tx merkle proof at txid
HTTP Request
GET https://media.bitcoinfiles.org/txproof/77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4
URL Parameters
Parameter | Description |
---|---|
txid | Txid of the transaction |
Get Raw Transaction Merkle Proof
Get Raw Transaction Merkle Proof
curl https://media.bitcoinfiles.org/txproof/77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4/raw
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getTxOutProofString('77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4');
The above command returns the merkle proof of transaction (MerkleBlock)
000000206e4cc162fe30ddae54aa6c92939ccfe0af2a2e75341aeb0300000000000000009e010a9aaa297c4c9dcdd4eb27dbaf8af4cc7a63cddfbf5555a1c2bda980ff44d87b9b5ecbb00418fc984c9b102600000fd0c4eb3cdc2e35b387c2a2c9fee0dfa504482e033579c66d470dbee0e7894f25b46f0794f08bc66b9d2bd80ec3ab8e2ed6359308d33b4495b7db806ec19d617734a2cd3bc26b815d29049aa333593ae92ad1ea02f75f9863fea69e9547707cc8366d88cfa8affdee442bad72626ccc7fd5285ea077e8b5b6e5bc9205d0a4ce123a65ac66248cd643751d67ae022262d6c811ee45e13cc15757f79e5d119e3cec4cbf1068d82630cfe1a9612b864a6403d44eda3577550de845bf3f7805173fd59560aa9eabdff4db8bd86d5c267d89a96d3953834a23697946855861aba8dce7b4cf3be1af1134fabe42d48eb89ffd85b7592d7c898a711eb74b53f5dafc4941094784d94ad265346b18850cf35b758d69a33541d68ddb10dfd846751df475607c251822e97714f238ee4544ee5bb2e2923126b30be66b09b927dc8625d03df388eb5e7460e9faa4961f077a39aea18a0983afaf99e9cea28ee724a45de0a3e858662251d7c9f12dd59dd5f7165221c0531104396bbe717ca56a70edf9878dc98599f2358f7fa6855ba41d125745aa646bbc6b81c00af26eeaca6c0c0e0dfbfcc710a24c4a7fc5b4aeda613ef08da68892816c1d6ff8d783c92290c8ba3bba81ccd11f375aa4047cc63f4de034fc7490f3f5448e5163df258688f2cef6bd13fb04ffbf0000
000000206e4cc162fe30ddae54aa6c92939ccfe0af2a2e75341aeb0300000000000000009e010a9aaa297c4c9dcdd4eb27dbaf8af4cc7a63cddfbf5555a1c2bda980ff44d87b9b5ecbb00418fc984c9b102600000fd0c4eb3cdc2e35b387c2a2c9fee0dfa504482e033579c66d470dbee0e7894f25b46f0794f08bc66b9d2bd80ec3ab8e2ed6359308d33b4495b7db806ec19d617734a2cd3bc26b815d29049aa333593ae92ad1ea02f75f9863fea69e9547707cc8366d88cfa8affdee442bad72626ccc7fd5285ea077e8b5b6e5bc9205d0a4ce123a65ac66248cd643751d67ae022262d6c811ee45e13cc15757f79e5d119e3cec4cbf1068d82630cfe1a9612b864a6403d44eda3577550de845bf3f7805173fd59560aa9eabdff4db8bd86d5c267d89a96d3953834a23697946855861aba8dce7b4cf3be1af1134fabe42d48eb89ffd85b7592d7c898a711eb74b53f5dafc4941094784d94ad265346b18850cf35b758d69a33541d68ddb10dfd846751df475607c251822e97714f238ee4544ee5bb2e2923126b30be66b09b927dc8625d03df388eb5e7460e9faa4961f077a39aea18a0983afaf99e9cea28ee724a45de0a3e858662251d7c9f12dd59dd5f7165221c0531104396bbe717ca56a70edf9878dc98599f2358f7fa6855ba41d125745aa646bbc6b81c00af26eeaca6c0c0e0dfbfcc710a24c4a7fc5b4aeda613ef08da68892816c1d6ff8d783c92290c8ba3bba81ccd11f375aa4047cc63f4de034fc7490f3f5448e5163df258688f2cef6bd13fb04ffbf0000
This endpoint retrieves raw tx merkle proof at txid
HTTP Request
GET https://media.bitcoinfiles.org/txproof/77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4/raw
URL Parameters
Parameter | Description |
---|---|
txid | Txid of the transaction |
Verify Transaction Merkle Proof
Verify Raw Transaction Merkle Proof (Merkle Block)
curl https://media.bitcoinfiles.org/txproof/verify/000000206e4cc162fe30ddae54aa6c92939ccfe0af2a2e75341aeb0300000000000000009e010a9aaa297c4c9dcdd4eb27dbaf8af4cc7a63cddfbf5555a1c2bda980ff44d87b9b5ecbb00418fc984c9b102600000fd0c4eb3cdc2e35b387c2a2c9fee0dfa504482e033579c66d470dbee0e7894f25b46f0794f08bc66b9d2bd80ec3ab8e2ed6359308d33b4495b7db806ec19d617734a2cd3bc26b815d29049aa333593ae92ad1ea02f75f9863fea69e9547707cc8366d88cfa8affdee442bad72626ccc7fd5285ea077e8b5b6e5bc9205d0a4ce123a65ac66248cd643751d67ae022262d6c811ee45e13cc15757f79e5d119e3cec4cbf1068d82630cfe1a9612b864a6403d44eda3577550de845bf3f7805173fd59560aa9eabdff4db8bd86d5c267d89a96d3953834a23697946855861aba8dce7b4cf3be1af1134fabe42d48eb89ffd85b7592d7c898a711eb74b53f5dafc4941094784d94ad265346b18850cf35b758d69a33541d68ddb10dfd846751df475607c251822e97714f238ee4544ee5bb2e2923126b30be66b09b927dc8625d03df388eb5e7460e9faa4961f077a39aea18a0983afaf99e9cea28ee724a45de0a3e858662251d7c9f12dd59dd5f7165221c0531104396bbe717ca56a70edf9878dc98599f2358f7fa6855ba41d125745aa646bbc6b81c00af26eeaca6c0c0e0dfbfcc710a24c4a7fc5b4aeda613ef08da68892816c1d6ff8d783c92290c8ba3bba81ccd11f375aa4047cc63f4de034fc7490f3f5448e5163df258688f2cef6bd13fb04ffbf0000
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.verifyTxOutProofString('77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4');
This endpoint verifies the merkle block and returns which txids it commits to (MerkleBlock)
["77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4"]
["77619dc16e80dbb795443bd3089335d62e8eabc30ed82b9d6bc68bf094076fb4"]
This endpoint verifies the merkle block and returns which txids it commits to
HTTP Request
GET https://media.bitcoinfiles.org/txproof/verify/000000206e4cc162fe30ddae54aa6c92939ccfe0af2a2e75341aeb0300000000000000009e010a9aaa297c4c9dcdd4eb27dbaf8af4cc7a63cddfbf5555a1c2bda980ff44d87b9b5ecbb00418fc984c9b102600000fd0c4eb3cdc2e35b387c2a2c9fee0dfa504482e033579c66d470dbee0e7894f25b46f0794f08bc66b9d2bd80ec3ab8e2ed6359308d33b4495b7db806ec19d617734a2cd3bc26b815d29049aa333593ae92ad1ea02f75f9863fea69e9547707cc8366d88cfa8affdee442bad72626ccc7fd5285ea077e8b5b6e5bc9205d0a4ce123a65ac66248cd643751d67ae022262d6c811ee45e13cc15757f79e5d119e3cec4cbf1068d82630cfe1a9612b864a6403d44eda3577550de845bf3f7805173fd59560aa9eabdff4db8bd86d5c267d89a96d3953834a23697946855861aba8dce7b4cf3be1af1134fabe42d48eb89ffd85b7592d7c898a711eb74b53f5dafc4941094784d94ad265346b18850cf35b758d69a33541d68ddb10dfd846751df475607c251822e97714f238ee4544ee5bb2e2923126b30be66b09b927dc8625d03df388eb5e7460e9faa4961f077a39aea18a0983afaf99e9cea28ee724a45de0a3e858662251d7c9f12dd59dd5f7165221c0531104396bbe717ca56a70edf9878dc98599f2358f7fa6855ba41d125745aa646bbc6b81c00af26eeaca6c0c0e0dfbfcc710a24c4a7fc5b4aeda613ef08da68892816c1d6ff8d783c92290c8ba3bba81ccd11f375aa4047cc63f4de034fc7490f3f5448e5163df258688f2cef6bd13fb04ffbf0000
URL Parameters
Parameter | Description |
---|---|
txid | Txid of the transaction |
Get Blockchain Info
Get blockchain information
curl https://media.bitcoinfiles.org/blockchain/status
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getBlockchainInfo();
The above command returns the blockchain info
{
"chain":"main",
"blocks":630756,
"bestblockhash":"0000000000000000038445394e87e5103343f34f91da9f4c9fd1a754e5e16b31",
"difficulty":197513539700.0701,
"mediantime":1586980990,
"verificationprogress":0.9999899941505928,
"chainwork":"000000000000000000000000000000000000000001060b7473a70fece894e1fa"
}
{
"chain":"main",
"blocks":630756,
"bestblockhash":"0000000000000000038445394e87e5103343f34f91da9f4c9fd1a754e5e16b31",
"difficulty":197513539700.0701,
"mediantime":1586980990,
"verificationprogress":0.9999899941505928,
"chainwork":"000000000000000000000000000000000000000001060b7473a70fece894e1fa"
}
This endpoint retrieves blockchain info status
HTTP Request
GET https://media.bitcoinfiles.org/blockchain/status
Get Block
Get raw block by blockhash
curl https://media.bitcoinfiles.org/block/00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getBlock('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550');
The above command returns the block
01000000f528fac1bcb685d0cd6c792320af0300a5ce15d687c7149548904e31000000004e8985a786d864f21e9cbb7cbdf4bc9265fe681b7a0893ac55a8e919ce035c2f85de6849ffff001d385ccb7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0116ffffffff0100f2052a0100000043410492ade9a7a1fde25016c02d223e2f1c501d2af11b492e0a3f0cd617a01798c5f5eabd9d5957a7b2d66d1b42f688a6fd5d2bc60ad0d7a00f6006fc4838fb4c248aac00000000
01000000f528fac1bcb685d0cd6c792320af0300a5ce15d687c7149548904e31000000004e8985a786d864f21e9cbb7cbdf4bc9265fe681b7a0893ac55a8e919ce035c2f85de6849ffff001d385ccb7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0116ffffffff0100f2052a0100000043410492ade9a7a1fde25016c02d223e2f1c501d2af11b492e0a3f0cd617a01798c5f5eabd9d5957a7b2d66d1b42f688a6fd5d2bc60ad0d7a00f6006fc4838fb4c248aac00000000
This endpoint retrieves raw block at blockhash
HTTP Request
GET https://media.bitcoinfiles.org/block/00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550
URL Parameters
Parameter | Description |
---|---|
blockhash | Blockhash of the block |
Get Filtered Block
Get raw transactions filtered within a block.
Specify an arbitrary hex string to match anywhere in a transaction.
You can do logical OR by piping multiple hex sequences togther.
Example 1:
'01234|66666' will match all transactions in a block that have 01234
or 66666
appearing somewhere in the raw transaction.
747765746368
is the word 'twetch' and you can find all transactions that have that string anywhere.
Example 2:
'0123.+88|447755' matches all transactions that have 0123
pattern with anything in between followed by an 88
OR 447755
is found anywhere in the transaction.
curl https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter/747765746368
curl https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter/747765746368|0123
curl https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter?outputFilter=1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf,1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf
curl https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter?outputFilterId=6fce8b16ae898ca5d403e3624813f41aee1f0a1bbf1a3c387c49a4af34699ad1
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getBlockFiltered('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550', {
base: '0123456|747765746368',
outputFilter: null,
outputFilterId: null
});
const result2 = await bitcoinfiles.getBlockFiltered('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550', {
base: '0123.+88|447755',
outputFilter: null,
outputFilterId: null
});
const result3 = await bitcoinfiles.getBlockFiltered('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550', {
base: null,
outputFilter: ['1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf', 'deca84cc774cdb30152c46c6122daa9ebafafcc7f612b7bc9e5e44a01d03d2c5', 'deca84cc774cdb30152c46c6122daa9ebafafcc7f612b7bc9e5e44a01d03d2c5-0']
outputFilterId: null
});
// Load up a filter created earlier with `saveOutputFilter`
const result4 = await bitcoinfiles.getBlockFiltered('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550', {
outputFilterId: '6fce8b16ae898ca5d403e3624813f41aee1f0a1bbf1a3c387c49a4af34699ad1'
});
The above command returns the filtered
{
header: {
"bits": 402963644,
"hash": "0000000000000000010fa8e8773dbdb932e4a1c6ca4a3e67a2ed6313c435da6a",
"merkleRoot": "2c8286bd5cea7340a4e5c5dce2b801d244af689841907a44482c35aad10c4084",
"nonce": 3620922370,
"prevHash": "00000000000000000075705dc13f5b1c5a10312585f28e07fa530ceacac201a6",
"time": 1587614794,
"version": 536870912,
},
tx: [
{
"h":"07eb6b63d4fc4d2e1bc4dcc0f50a365ec865dce7001099cc283a32917e2395b9","raw":"0100000001d95b67b533205196cde0bd42f4cc139fa4eff968347fe57c28b06e8495cc8157040000006b483045022100f8181bfa7c18da1460be22a81e3866740fc60261e0bb3ce1f78736371358f96d0220554e6eb8a3ff68e2c51aee2d096045f5a8fe99e3f69c9cca0673edbe798a1a8b4121030a548df8f30d0bfb0499c4be4a287a2bd5a42599cea14e75ff1a3e822766867effffffff050000000000000000fd0101006a22314c6f6f6b79327976626a576958453631456862395333337745327744534c566a44067477657463682432383134623563392d356439392d343930302d616538612d656163653039623062366462017c22313550636948473232534e4c514a584d6f53556157566937575371633768436676610d424954434f494e5f454344534122314e58544835356d336e566f504c757a47526b6b616b65736d58433341726d5544534c58494d3249346d74356d4e5174652b30594864454c42363662754c39427a776562656457792b486b637345306e59473336366c59426b4b6278464b632f476e58592b6e624c6355354f444c516e584554745265446e334d6b3d79cc0000000000001976a9143816920e94f43f603cae571b545203aec4516a3788ac79cc0000000000001976a914c23979eba63d6b5941145316618acabe83735cfb88acc8630600000000001976a91405186ff0710ed004229e644c0653b2985c648a2388ac4baff239000000001976a914264fb2bb20ec9a627c6dbeb3ba51534847ec4c3e88ac00000000"},
...
}
]
}
{
header: {
"bits": 402963644,
"hash": "0000000000000000010fa8e8773dbdb932e4a1c6ca4a3e67a2ed6313c435da6a",
"merkleRoot": "2c8286bd5cea7340a4e5c5dce2b801d244af689841907a44482c35aad10c4084",
"nonce": 3620922370,
"prevHash": "00000000000000000075705dc13f5b1c5a10312585f28e07fa530ceacac201a6",
"time": 1587614794,
"version": 536870912,
},
tx: [
{
"h":"07eb6b63d4fc4d2e1bc4dcc0f50a365ec865dce7001099cc283a32917e2395b9","raw":"0100000001d95b67b533205196cde0bd42f4cc139fa4eff968347fe57c28b06e8495cc8157040000006b483045022100f8181bfa7c18da1460be22a81e3866740fc60261e0bb3ce1f78736371358f96d0220554e6eb8a3ff68e2c51aee2d096045f5a8fe99e3f69c9cca0673edbe798a1a8b4121030a548df8f30d0bfb0499c4be4a287a2bd5a42599cea14e75ff1a3e822766867effffffff050000000000000000fd0101006a22314c6f6f6b79327976626a576958453631456862395333337745327744534c566a44067477657463682432383134623563392d356439392d343930302d616538612d656163653039623062366462017c22313550636948473232534e4c514a584d6f53556157566937575371633768436676610d424954434f494e5f454344534122314e58544835356d336e566f504c757a47526b6b616b65736d58433341726d5544534c58494d3249346d74356d4e5174652b30594864454c42363662754c39427a776562656457792b486b637345306e59473336366c59426b4b6278464b632f476e58592b6e624c6355354f444c516e584554745265446e334d6b3d79cc0000000000001976a9143816920e94f43f603cae571b545203aec4516a3788ac79cc0000000000001976a914c23979eba63d6b5941145316618acabe83735cfb88acc8630600000000001976a91405186ff0710ed004229e644c0653b2985c648a2388ac4baff239000000001976a914264fb2bb20ec9a627c6dbeb3ba51534847ec4c3e88ac00000000"},
...
}
]
}
This endpoint retrieves filtered block at blockhash
HTTP Request
GET https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter/747765746368|0123
GET https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter?outputFilter=1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf,1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf
GET https://media.bitcoinfiles.org/block/00000000000000000013fd298b5567aa19f71de983f04f6d3eea1660c2d2b177/tx/filter?outputFilterId=6fce8b16ae898ca5d403e3624813f41aee1f0a1bbf1a3c387c49a4af34699ad1
URL Parameters
Parameter | Description |
---|---|
blockhash | Blockhash of the block |
filterStr | Filter string to match in hex in the block. You can use a pipe |
outputFilter | Address, scripthash, txid or txout (${txid}-${number} ) format to filter blocck |
outputFilterId | outputFilterId returned by the outputFilter create API call |
Get Transactions with Filter
This endpoint returns the unmined large transactions available for processing.
For use by miners (transaction processors) to populate their mempools. A transaction processor can selectively choose what size and feerate they will accept for processing. This enables them to experiment witht mining larger (> 100KB) OP_RETURN payloads and transactions.
Note: By default transactions are sorted by fee
.
A transaction processor can query this endpoint to retrive the *most profitable large transactions for block inclusion. The rawtx is located at the given url. Transaction processor is responsible for verifying the transaction fee rate from the rawtx bytes.
Example 1: Get transactions sized between 100KB and 1MB, sort ascending on filesize, and limit to 10 results.
curl https://media.bitcoinfiles.org/treasure-chest?maxfilesize=1000000&minfilesize=0&desc=1&order=fee&offset=0&limit=10&mined=0
[
{
"txid":"a721b9f1fca2deb55dff487ed52a2f7246f9f4f6e97b6bdaa5d2cc55a5d16400",
"size":76178,
"fee":38275,
"url":"https://media.bitcoinfiles.org/tx/a721b9f1fca2deb55dff487ed52a2f7246f9f4f6e97b6bdaa5d2cc55a5d16400/raw",
"blockhash":null
},
{
"txid":"04b17f77eb33d110fe00a197f01b42b98524437bf4853d446da1e0a159bc7a14",
"size":76178,
"fee":38275,
"url":"https://media.bitcoinfiles.org/tx/04b17f77eb33d110fe00a197f01b42b98524437bf4853d446da1e0a159bc7a14/raw",
"blockhash":null
}
]
/*
curl https://media.bitcoinfiles.org/treasure-chest?maxfilesize=1000000&minfilesize=0&desc=1&order=fee&offset=0&limit=10&mined=0
[
{
"txid":"a721b9f1fca2deb55dff487ed52a2f7246f9f4f6e97b6bdaa5d2cc55a5d16400",
"size":76178,
"fee":38275,
"url":"https://media.bitcoinfiles.org/tx/a721b9f1fca2deb55dff487ed52a2f7246f9f4f6e97b6bdaa5d2cc55a5d16400/raw",
"blockhash":null
},
{
"txid":"04b17f77eb33d110fe00a197f01b42b98524437bf4853d446da1e0a159bc7a14",
"size":76178,
"fee":38275,
"url":"https://media.bitcoinfiles.org/tx/04b17f77eb33d110fe00a197f01b42b98524437bf4853d446da1e0a159bc7a14/raw",
"blockhash":null
}
]
*/
This endpoint returns the unmined large transactions available for processing. For use by miners (transaction processors) to populate their mempools. A transaction processor can selectively choose what size and feerate they will accept for processing. This enables them to experiment witht mining larger (> 100KB) OP_RETURN payloads and transactions.
Save Output Filter
Output Filters are a way to restrict your block and stream filters to select only those transactions that match the criteria.
You may specify addresses, p2pkh hex, scripthash, txid, and txoutpoints (txid-outputIndex).
curl -X POST https://api.bitcoinfiles.org/outputfilter -H 'Content-Type: application/json' \
-d '{ "add": ["12UhHtxuMMftNodp5nwoDYfBd4QaLm6Sz9"]}'
{
"result": {
// outputFilterId created
"id": "8d2267f19a9e8524e3d253631e19bf163bcefb5de74e1ad86c36365afe2a3f87"
},
"success": true,
}
const bitcoinfiles = require('bitcoinfiles-sdk');
// Monitor a few addresses, and txid and scripthash.
const saveResult = await bitcoinfiles.saveOutputFilter(
[
'12UhHtxuMMftNodp5nwoDYfBd4QaLm6Sz9',
'12UhHtxuMMftNodp5nwoDYfBd4QaLm6Sz9', // automatically removes deduplicates
'0c629d7b8069f917b7f31942db3ec94bf4c4662e17c05b1d5c059e448d1470af-2',
'1ALSfdsAHraUzu8HhAE9Cep9ca1ju3fjt2',
'65503f4f336d4528fec7e645f81f1bfd655e837e8460c33b677f6995955e0b95',
]
);
console.log(saveResult);
/*
{
"result": {
// outputFilterId created
"id": "8d2267f19a9e8524e3d253631e19bf163bcefb5de74e1ad86c36365afe2a3f87"
},
"success": true,
}
*/
This endpoint creates an output filter that can be referenced in the block and stream filtering by outputFilterId
HTTP Request
curl -X POST https://api.bitcoinfiles.org/outputfilter -H 'Content-Type: application/json' \
-d '{ "add": ["12UhHtxuMMftNodp5nwoDYfBd4QaLm6Sz9"]}'
Body Parameters
Parameter | Description |
---|---|
add | Array of scripthash, address, txid, or txoutpoint for filtering |
Get Output Filter
Retrieve an output filter that was created earlier. An output filter can be used in the outputFilterId parameter to block and stream filtering.
curl https://api.bitcoinfiles.org/outputfilter/8d2267f19a9e8524e3d253631e19bf163bcefb5de74e1ad86c36365afe2a3f87
[ '76a9141034fd8093641ae0741a0565fb7787bca1ac35fc88ac',
'0c629d7b8069f917b7f31942db3ec94bf4c4662e17c05b1d5c059e448d1470af-2',
'76a914666675d887a7ae09835af934096d9fcbbb70eed288ac',
'65503f4f336d4528fec7e645f81f1bfd655e837e8460c33b677f6995955e0b95' ]
const bitcoinfiles = require('bitcoinfiles-sdk');
// Monitor a few addresses, and txid and scripthash.
const result = await bitcoinfiles.getOutputFilter('8d2267f19a9e8524e3d253631e19bf163bcefb5de74e1ad86c36365afe2a3f87');
console.log(result);
/*
[ '76a9141034fd8093641ae0741a0565fb7787bca1ac35fc88ac',
'0c629d7b8069f917b7f31942db3ec94bf4c4662e17c05b1d5c059e448d1470af-2',
'76a914666675d887a7ae09835af934096d9fcbbb70eed288ac',
'65503f4f336d4528fec7e645f81f1bfd655e837e8460c33b677f6995955e0b95' ]
*/
This endpoint gets an output filter that can be referenced in the block and stream filtering by outputFilterId
HTTP Request
curl https://api.bitcoinfiles.org/outputfilter/8d2267f19a9e8524e3d253631e19bf163bcefb5de74e1ad86c36365afe2a3f87
URL Parameters
Parameter | Description |
---|---|
outputFilterId | output filter identifier used during creation |
Get Blockheader
Get blockheader by blockhash
curl https://media.bitcoinfiles.org/blockheader/00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getBlockHeader('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550');
The above command returns the blockheader
{
"hash":"00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550",
"height":43,
"version":1,
"versionHex":"00000001",
"merkleroot":"2f5c03ce19e9a855ac93087a1b68fe6592bcf4bd7cbb9c1ef264d886a785894e",
"time":1231609477,
"mediantime":1231607488,
"nonce":2093702200,
"bits":"1d00ffff",
"difficulty":1,
"chainwork":"0000000000000000000000000000000000000000000000000000002c002c002c",
"previousblockhash":"00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5",
"nextblockhash":"000000002978eecde8d020f7f057083bc990002fff495121d7dc1c26d00c00f8"
}
{
"hash":"00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550",
"height":43,
"version":1,
"versionHex":"00000001",
"merkleroot":"2f5c03ce19e9a855ac93087a1b68fe6592bcf4bd7cbb9c1ef264d886a785894e",
"time":1231609477,
"mediantime":1231607488,
"nonce":2093702200,
"bits":"1d00ffff",
"difficulty":1,
"chainwork":"0000000000000000000000000000000000000000000000000000002c002c002c",
"previousblockhash":"00000000314e90489514c787d615cea50003af2023796ccdd085b6bcc1fa28f5",
"nextblockhash":"000000002978eecde8d020f7f057083bc990002fff495121d7dc1c26d00c00f8"
}
This endpoint retrieves blockheader at blockhash
HTTP Request
GET https://media.bitcoinfiles.org/blockheader/00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550
URL Parameters
Parameter | Description |
---|---|
blockhash | Blockhash of the blockheader |
Get Raw Blockheader
Get raw blockheader by blockhash
curl https://media.bitcoinfiles.org/rawblockheader/00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getBlockheaderRaw('00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550');
The above command returns the blockheader
01000000f528fac1bcb685d0cd6c792320af0300a5ce15d687c7149548904e31000000004e8985a786d864f21e9cbb7cbdf4bc9265fe681b7a0893ac55a8e919ce035c2f85de6849ffff001d385ccb7c
01000000f528fac1bcb685d0cd6c792320af0300a5ce15d687c7149548904e31000000004e8985a786d864f21e9cbb7cbdf4bc9265fe681b7a0893ac55a8e919ce035c2f85de6849ffff001d385ccb7c
This endpoint retrieves raw blockheader at blockhash
HTTP Request
GET https://media.bitcoinfiles.org/rawblockheader/00000000ac21f2862aaab177fd3c5c8b395de842f84d88c9cf3420b2d393e550
URL Parameters
Parameter | Description |
---|---|
blockhash | Blockhash of the blockheader |
Get Blockhash by Height
Get blockhash by height
curl https://media.bitcoinfiles.org/height/43322
const bitcoinfiles = require('bitcoinfiles-sdk');
const result = await bitcoinfiles.getBlockHash(43322);
The above command returns the blockhash
{ "blockhash": "000000002fef20817c904075a8821c2c5e5e3d602347c8a9d02b708fa9e90109" }
{ "blockhash": "000000002fef20817c904075a8821c2c5e5e3d602347c8a9d02b708fa9e90109" }
This endpoint retrieves blockhash at height
HTTP Request
GET https://media.bitcoinfiles.org/height/43322
URL Parameters
Parameter | Description |
---|---|
height | Height of the blockhash to get |
Socket Streaming (SSE)
BitcoinFiles supports real-time notifications with Server Side Events (SSE)
Endpoint: https://stream.bitcoinfiles.org/mempool?filter=747765746368|012.*777
Note: You must specify a filter
parameter to filter the incoming transactions. The example above matches any transaction
that contains 747765746368
('twetch' in hex) OR the pattern 012.*777
is found anywhere in the transaction.
The exact same filter syntax is supported as in the Block Delivery Service
Subscribe to the endpoint using any SSE library to start getting transaction and block notifications in real-time.
Links: - Server Side Events - Node: express-sse
Socket Streaming sessions are limited to 30 minutes. Ensure that you reconnect every 30 minutes to maintain your session.
Transaction Events
Subscribe to receive notifications when new transactions in the mempool match your filter.
For example, to subscribe to all transactions that contains the word 'twetch', use this filter:
https://stream.bitcoinfiles.org/mempool?filter=747765746368
You can event combine filters and use simple regular expressions:
https://stream.bitcoinfiles.org/mempool?filter=747765746368|012.*777
Note: This endpoint for transactions also returns the block notifications. Make sure to check the message type to be 'tx'. See BlockHeader Event for the format of the block header event
var es = new EventSource('https://stream.bitcoinfiles.org/mempool?filter=747765746368');
es.onmessage = function (event) {
console.log('event', event);
};
// The event type is 'tx' and contains the txid and urls to access the transaction
// Note that if the transaction is less than 1,000 bytes, then it is also returned in the 'raw' field
// Otherwise the 'raw' is omitted and you can obtain the full transaction at one of the links provided.
// Additionally, if the file is a valid B:// file, then the 'file_url' is provided to the content
/*
{
type: 'message',
data:
'{
"type":"tx",
"txid":"e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e",
"rawtx_url":"https://media.bitcoinfiles.org/tx/e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e/raw",
"tx_url":"https://media.bitcoinfiles.org/tx/e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e",
"file_url":"https://media.bitcoinfiles.org/e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e",
"raw": "....set to the raw tx bytes as long as the tx is less than 1,000 bytes total"
}',
lastEventId: '2',
origin: 'https://stream.bitcoinfiles.org'
}
*/
var es = new EventSource('https://stream.bitcoinfiles.org/mempool?filter=747765746368');
es.onmessage = function (event) {
console.log('event', event);
};
// The event type is 'tx' and contains the txid and urls to access the transaction
// Note that if the transaction is less than 1,000 bytes, then it is also returned in the 'raw' field
// Otherwise the 'raw' is omitted and you can obtain the full transaction at one of the links provided.
// Additionally, if the file is a valid B:// file, then the 'file_url' is provided to the content
/*
{
type: 'message',
data:
'{
"type":"tx",
"txid":"e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e",
"rawtx_url":"https://media.bitcoinfiles.org/tx/e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e/raw",
"tx_url":"https://media.bitcoinfiles.org/tx/e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e",
"file_url":"https://media.bitcoinfiles.org/e6e5db1205775f9627208217e8d49dec3337fb1bfecb71918d66d8918ad7a99e",
"raw": "....set to the raw tx bytes as long as the tx is less than 1,000 bytes total"
}',
lastEventId: '2',
origin: 'https://stream.bitcoinfiles.org'
}
*/
BlockHeader Events
Subscribe to listen for all new found blockheaders. You may obtain the full block using the Block Delivery Service if needed.
var es = new EventSource('https://stream.bitcoinfiles.org/blockheaders');
es.onmessage = function (event) {
console.log('event', event);
};
// The event type is 'blockheader' and contains the blockheader that just arrived.
/*
{
type: 'message',
data:
'{
"type":"blockheader",
"blockheader":{
"hash":"000000000000000003b61bb7f1d9ada5e2b832ac55440914e7e86066345ca07c",
"version":549453824,
"prevHash":"0000000000000000034afd5abb1694ccb5574cd163381a60cc3c22e062710ed4","merkleRoot":"e4a18640ae54bc241aa404c86ee4aa74756242af2bdabf97ec9acee43c25751f",
"time":1587189274,
"bits":403014440,
"nonce":1883442530,
"height":631116
}
}',
lastEventId: '1',
origin: 'https://stream.bitcoinfiles.org' }
*/
var es = new EventSource('https://stream.bitcoinfiles.org/blockheaders');
es.onmessage = function (event) {
console.log('event', event);
};
// The event type is 'blockheader' and contains the blockheader that just arrived.
/*
{
type: 'message',
data:
'{
"type":"blockheader",
"blockheader":{
"hash":"000000000000000003b61bb7f1d9ada5e2b832ac55440914e7e86066345ca07c",
"version":549453824,
"prevHash":"0000000000000000034afd5abb1694ccb5574cd163381a60cc3c22e062710ed4","merkleRoot":"e4a18640ae54bc241aa404c86ee4aa74756242af2bdabf97ec9acee43c25751f",
"time":1587189274,
"bits":403014440,
"nonce":1883442530,
"height":631116
}
}',
lastEventId: '1',
origin: 'https://stream.bitcoinfiles.org' }
*/
Blockchain Scanner
Synchronize the blockchain data to your application easily.
Monitor the Bitcoin SV blockchain in real-time and crawl blocks matching your filters.
Scan the blockchain blocks and mempool for transactions matching base filter (hex regex), outputFilter array of addresses scripthashes, txids, and txouts.
Note: If you need to monitor more than 20 items in the outputFilter, then use the saveOutputFilter
and specify the outputFilterId
.
The scanner uses the stream and media endpoints, it should be easy to build this same scanner in any other language.
Examples:
All outputs matching '123' in mempool
All outputs matching saved output filter in mempool
Note: the output filter stores an address like 12UhHtxuMMftNodp5nwoDYfBd4QaLm6Sz9
in output script format for efficiency reasons. Example 112UhHtxuMMftNodp5nwoDYfBd4QaLm6Sz9
= 76a9141034fd8093641ae0741a0565fb7787bca1ac35fc88ac
Find all B:// files Note: the bitcom prefix of 19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut
was converted to hex utf8: 31394878696756345179427633744870515663554551797131707a5a56646f417574
bitcoinfiles .scanner({ initHeight: 566492, saveUpdatedHeight: true }) .filter({ baseFilter: '31394878696756345179427633744870515663554551797131707a5a56646f417574', outputFilter: null, outputFilterId: null }) .block(async (block, self) => { for (const e of block.tx) { const tx = new bitcoin.Transaction(e.raw); console.log(tx.hash); fs.appendFileSync('b-files.txt', tx.hash); } }) .error((err, self) => { console.log('error', err, self); }) .start();
bitcoinfiles.scanner({
initHeight: 632051, // Start crawling at this height
saveUpdatedHeight: true, // Save last height to file on disk
onlyblocks: false, // include mempool or not
})
.filter({
baseFilter: null,
outputFilter: ['1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf'],
outputFilterId: null,
})
.mempool(function(e, self){
const tx = new bsv.Transaction(e.raw);
// Do something with the transaction...
})
.block((block, self) => {
for (const e of block.tx) {
const tx = new bsv.Transaction(e.raw);
// Do something with the transaction...
}
})
.error((err, self) => {
console.log(err);
})
.start();
bitcoinfiles.scanner({
initHeight: 632051, // Start crawling at this height
saveUpdatedHeight: true, // Save last height to file on disk
onlyblocks: false, // include mempool or not
})
.filter({
baseFilter: null,
outputFilter: ['1Twetcht1cTUxpdDoX5HQRpoXeuupAdyf'],
outputFilterId: null,
})
.mempool(function(e, self){
const tx = new bsv.Transaction(e.raw);
// Do something with the transaction...
})
.block((block, self) => {
for (const e of block.tx) {
const tx = new bsv.Transaction(e.raw);
// Do something with the transaction...
}
})
.error((err, self) => {
console.log(err);
})
.start();
TXDB: Bitcoin Database
Query real-time global transactions and outputs by scripthash, address or output.
Output Spend Status
GET /api/v1/txout/spends/dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0?pretty=1
Use single outpoints like dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0
or multiple: dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0,dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0
Example:
Params:
- outputs: transaction outputs. Ex: dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0
- pretty: whether to pretty print
{
"status": 200,
"errors": [],
"result": {
"13db37d0ab6f750dbf7a687f631591f0310c5ad08bd14639deac5e5aa592db82_o0": null,
"ac1391f07e68a61f92e24d69f4d0b10084ed4e1ab1c47ec682b255a8368c8510_o1": {
"spend_txid": "0f106da2458ec5fcbec1b1563f0f577cd1d8782ab66be0e691f1c13e61035b0d",
"spend_index": 0,
"spend_height": 554322
},
"063d3117f911b9ac4434d39de2be19cc1cfd69b7ef83b2302617bb26e1c2eea0_o0": {
"spend_txid": "ac1391f07e68a61f92e24d69f4d0b10084ed4e1ab1c47ec682b255a8368c8510",
"spend_index": 0,
"spend_height": 554010
}
}
}
Output Status
GET /api/v1/txout/dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0?pretty=1
Use single outpoints like dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0
or multiple: dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0,dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0
Example:
Params:
- outputs: transaction outputs. Ex: dc7bed6c302c08b7bafd94bfb1086883a134861fe9f212fc8052fcaadcde2293_o0
- pretty: whether to pretty print
Retrieve spent status of an output (txid + index). Fields spend_txid
, spend_index
, spend_height
will be non-null if spent. spend_height=0
indicates it is in the mempool (no confirmations).
{
"status": 200,
"errors": [],
"result": {
"063d3117f911b9ac4434d39de2be19cc1cfd69b7ef83b2302617bb26e1c2eea0_o0": {
"txid": "063d3117f911b9ac4434d39de2be19cc1cfd69b7ef83b2302617bb26e1c2eea0",
"index": 0,
"satoshis": 683861373,
"script": "76a914dce9a6dda0e955d8343cf288f814d94a5ab548fe88ac",
"scripthash": "bdb00e63d74bc8151b78f22fd4f680012c7046184988a712ebcdb63ab5042748",
"height": 554008,
"spend_txid": "ac1391f07e68a61f92e24d69f4d0b10084ed4e1ab1c47ec682b255a8368c8510",
"spend_height": 554010,
"spend_index": 0,
"address": "1M95ZciELeuVCjMto3nbkvNZ6MRFj84zHZ",
"vout": 0,
"outputIndex": 0,
"value": 683861373
},
"ac1391f07e68a61f92e24d69f4d0b10084ed4e1ab1c47ec682b255a8368c8510_o1": {
"txid": "ac1391f07e68a61f92e24d69f4d0b10084ed4e1ab1c47ec682b255a8368c8510",
"index": 1,
"satoshis": 140000000,
"script": "76a914cbc9f1dfcc9434372954c17652b9513b2257624c88ac",
"scripthash": "3e0288a5222ae1e2b0ecfae9a7be2b7f19d27fadb7b7e7f979aeaac7a7f4c19b",
"height": 554010,
"spend_txid": "0f106da2458ec5fcbec1b1563f0f577cd1d8782ab66be0e691f1c13e61035b0d",
"spend_height": 554322,
"spend_index": 0,
"address": "1KaY6KCQYkTW1rtzfMEKre34aWr7kJzkE4",
"vout": 1,
"outputIndex": 1,
"value": 140000000
},
"13db37d0ab6f750dbf7a687f631591f0310c5ad08bd14639deac5e5aa592db82_o0": {
"txid": "13db37d0ab6f750dbf7a687f631591f0310c5ad08bd14639deac5e5aa592db82",
"index": 0,
"satoshis": 107847,
"script": "76a91476dc1c4e3cfb00147d47c8fe79bd48fb96eb407e88ac",
"scripthash": "e388443c38b04cecae1f6f046bd7f52589fb31069d0b2b578c144a7d102c897e",
"height": 650545,
"address": "1BqURBp8mt7krS6czvosTUubWPJvc3Mxay",
"spend_txid": null,
"spend_index": null,
"spend_height": null,
"vout": 0,
"outputIndex": 0,
"value": 107847
}
}
}
Get Address/ScriptHash UTXOs
Single address or scripthash:
/txout/address/utxo/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX
/txout/scripthash/utxo/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX
Multiple addresses or scripthashes:
/txout/address/utxo/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX,1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu
Params: - limit: How many to fetch max - offset: Slice into result set - order: 'asc' or 'desc'. Default: 'desc' - pretty: whether to pretty print
{
"status": 200,
"errors": [],
"result": [
{
"txid": "2e66c2c439281b10fee896b17ddd3cea86d811ac83bb3a929360babf7c1fc7cb",
"index": 1,
"satoshis": 7692,
"script": "76a9144f950ca34751b3d45a021475759a719654b0e6f788ac",
"scripthash": "a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c",
"height": 607404,
"address": "18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX",
"vout": 1,
"outputIndex": 1,
"value": 7692
},
{
"txid": "79d46b3905ce274d86dccede2546d49e4777c99ae791544593f9ef4ee48d92bc",
"index": 1,
"satoshis": 7495,
"script": "76a9144f950ca34751b3d45a021475759a719654b0e6f788ac",
"scripthash": "a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c",
"height": 607081,
"address": "18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX",
"vout": 1,
"outputIndex": 1,
"value": 7495
}
}
{
"status": 200,
"errors": [],
"result": [
{
"txid": "2e66c2c439281b10fee896b17ddd3cea86d811ac83bb3a929360babf7c1fc7cb",
"index": 1,
"satoshis": 7692,
"script": "76a9144f950ca34751b3d45a021475759a719654b0e6f788ac",
"scripthash": "a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c",
"height": 607404,
"address": "18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX",
"vout": 1,
"outputIndex": 1,
"value": 7692
},
{
"txid": "79d46b3905ce274d86dccede2546d49e4777c99ae791544593f9ef4ee48d92bc",
"index": 1,
"satoshis": 7495,
"script": "76a9144f950ca34751b3d45a021475759a719654b0e6f788ac",
"scripthash": "a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c",
"height": 607081,
"address": "18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX",
"vout": 1,
"outputIndex": 1,
"value": 7495
}
}
Get Address/ScriptHash Balance
Single address or scripthash:
/txout/address/balance/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX
/txout/scripthash/balance/a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c
Multiple addresses or scripthashes:
/txout/address/balance/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX,1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu
/txout/scripthash/balance/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX,1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu
Params: - pretty: whether to pretty print
{
"status": 200,
"errors": [],
"result": [
{
"satoshis": 601469090,
"scripthash": "a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c",
"address": "18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX"
}
]
}
{
"status": 200,
"errors": [],
"result": [
{
"satoshis": 601469090,
"scripthash": "a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c",
"address": "18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX"
}
]
}
Get Txouts by Address or ScriptHash
Single address or scripthash:
/txout/address/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX
/txout/scripthash/a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c
Multiple addresses or scripthashes:
/txout/scripthash/1NwztgZXNhbzDtzsCiEqV4TeAc81XVvKpR?pretty=1&withSpends=1c
Params: - pretty: whether to pretty print - limit: How many to fetch max - offset: Slice into result set - order: 'asc' or 'desc'. Default: 'desc'
{
"status": 200,
"errors": [],
"result": [
{
"txid": "fef96636f4d52582ff25cabe759219640407328677ba50b5b2f8d8277aad70c8",
"index": 0,
"satoshis": 100000000000,
"script": "76a914a81104e381cb40a4823479c06f95f520f5f825a288ac",
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 662117,
"address": "1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu",
"vout": 0,
"outputIndex": 0,
"value": 100000000000
},
{
"txid": "0d67819ca39a7d7b8c76e845e921bba6c94df6157353a6a3c1ad0407fe9f3d8f",
"index": 0,
"satoshis": 199999998950,
"script": "76a914a81104e381cb40a4823479c06f95f520f5f825a288ac",
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 613730,
"address": "1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu",
"vout": 0,
"outputIndex": 0,
"value": 199999998950
},
]
}
{
"status": 200,
"errors": [],
"result": [
{
"txid": "fef96636f4d52582ff25cabe759219640407328677ba50b5b2f8d8277aad70c8",
"index": 0,
"satoshis": 100000000000,
"script": "76a914a81104e381cb40a4823479c06f95f520f5f825a288ac",
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 662117,
"address": "1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu",
"vout": 0,
"outputIndex": 0,
"value": 100000000000
},
{
"txid": "0d67819ca39a7d7b8c76e845e921bba6c94df6157353a6a3c1ad0407fe9f3d8f",
"index": 0,
"satoshis": 199999998950,
"script": "76a914a81104e381cb40a4823479c06f95f520f5f825a288ac",
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 613730,
"address": "1GKeujdkxdmLCQDb8WSMYnQroFXtHNcwhu",
"vout": 0,
"outputIndex": 0,
"value": 199999998950
},
]
}
Get Tx History by Address or ScriptHash
Single address or scripthash:
/txout/address/history/18FnwHbZz5wwCxJ4h2sQsAMYd7qyHryJUX
/txout/scripthash/history/a453904e69366bbd3410b6704cc8716eca30ed93586eeb70b6d3616bb184535c
Multiple addresses or scripthashes:
/txout/scripthash/history/1NwztgZXNhbzDtzsCiEqV4TeAc81XVvKpR?pretty=1=1
Params: - pretty: whether to pretty print - limit: How many to fetch max - offset: Slice into result set - order: 'asc' or 'desc'. Default: 'desc' - fromblockheight: Height to start ordering from. Example: use 'order=desc' and 'fromblockheight=50000' to get older blocks and sorted desc.
{
"status": 200,
"errors": [],
"result": [
{
"id": 1591439703,
"txid": "fef96636f4d52582ff25cabe759219640407328677ba50b5b2f8d8277aad70c8",
"blockhash": "00000000000000000504fe4e02e78ae4505b1696ba22c4fa6037ebfbc52c1823",
"index": 0,
"satoshis": 100000000000,
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 662117
},
{
"id": 1160220590,
"txid": "0d67819ca39a7d7b8c76e845e921bba6c94df6157353a6a3c1ad0407fe9f3d8f",
"blockhash": "0000000000000000018953e724851d1c315f74e009e103fa6e6afa80c5882367",
"index": 0,
"satoshis": 199999998950,
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 613730
},
]
}
{
"status": 200,
"errors": [],
"result": [
{
"id": 1591439703,
"txid": "fef96636f4d52582ff25cabe759219640407328677ba50b5b2f8d8277aad70c8",
"blockhash": "00000000000000000504fe4e02e78ae4505b1696ba22c4fa6037ebfbc52c1823",
"index": 0,
"satoshis": 100000000000,
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 662117
},
{
"id": 1160220590,
"txid": "0d67819ca39a7d7b8c76e845e921bba6c94df6157353a6a3c1ad0407fe9f3d8f",
"blockhash": "0000000000000000018953e724851d1c315f74e009e103fa6e6afa80c5882367",
"index": 0,
"satoshis": 199999998950,
"scripthash": "a0e509fe8e7d18f0ae3ecac48d3f70f2ceced0067c451ce8413a5038dfbdb432",
"height": 613730
},
]
}
Get Block Headers
Get the latest blockchain tip or a range of block headers. This is required for client side Simplified Payment Verification (SPV).
GET https://txdb.mattercloud.io/api/v1/blockheader/650000?limit=100&order=desc|asc&pretty
Example:
Get 100 block headers descending from height 650000
Get most recent 100 blockheaders
Get 5 block headers at 0000000000000000047cb2a20adeebbf9dde18f4928e486a1b175dbac644039b
Params: - limit: limit number of block headers (default: 1, max: 10000) - order: 'asc' or 'desc' - pretty: whether to pretty print
{
"status": 200,
"errors": [],
"result": [
{
"height": 10000,
"hash": "0000000099c744455f58e6c6e98b671e1bf7f37346bfd4cf5d0274ad8ee660cb",
"size": 216,
"version": 1,
"merkleroot": "9c397f783042029888ec02f0a461cfa2cc8e3c7897f476e338720a2a86731c60",
"time": 1238988213,
"nonce": 2145410362,
"bits": "1d00ffff",
"difficulty": "1",
"previousblockhash": "00000000fbc97cc6c599ce9c24dd4a2243e2bfd518eda56e1d5e47d29e29c3a7",
"nextblockhash": "00000000fbc97cc6c599ce9c24dd4a2243e2bfd518eda56e1d5e47d29e29c3a7",
"coinbaseinfo": "04ffff001d026f03",
"coinbasetxid": "9c397f783042029888ec02f0a461cfa2cc8e3c7897f476e338720a2a86731c60",
"chainwork": "0000000000000000000000000000000000000000000000000000271127112711"
},
{
"height": 10001,
"hash": "00000000f01df1dbc52bce6d8d31167a8fef76f1a8eb67897469cf92205e806b",
"size": 216,
"version": 1,
"merkleroot": "ff2fecc4c36854112c9481cadbfda5524320012b41725200f2dd3ef8e72bf4c7",
"time": 1238989442,
"nonce": 1163845665,
"bits": "1d00ffff",
"difficulty": "1",
"previousblockhash": "0000000099c744455f58e6c6e98b671e1bf7f37346bfd4cf5d0274ad8ee660cb",
"nextblockhash": "0000000099c744455f58e6c6e98b671e1bf7f37346bfd4cf5d0274ad8ee660cb",
"coinbaseinfo": "04ffff001d027303",
"coinbasetxid": "ff2fecc4c36854112c9481cadbfda5524320012b41725200f2dd3ef8e72bf4c7",
"chainwork": "0000000000000000000000000000000000000000000000000000271227122712"
},
]
}
{
"status": 200,
"errors": [],
"result": [
{
"height": 10000,
"hash": "0000000099c744455f58e6c6e98b671e1bf7f37346bfd4cf5d0274ad8ee660cb",
"size": 216,
"version": 1,
"merkleroot": "9c397f783042029888ec02f0a461cfa2cc8e3c7897f476e338720a2a86731c60",
"time": 1238988213,
"nonce": 2145410362,
"bits": "1d00ffff",
"difficulty": "1",
"previousblockhash": "00000000fbc97cc6c599ce9c24dd4a2243e2bfd518eda56e1d5e47d29e29c3a7",
"nextblockhash": "00000000fbc97cc6c599ce9c24dd4a2243e2bfd518eda56e1d5e47d29e29c3a7",
"coinbaseinfo": "04ffff001d026f03",
"coinbasetxid": "9c397f783042029888ec02f0a461cfa2cc8e3c7897f476e338720a2a86731c60",
"chainwork": "0000000000000000000000000000000000000000000000000000271127112711"
},
{
"height": 10001,
"hash": "00000000f01df1dbc52bce6d8d31167a8fef76f1a8eb67897469cf92205e806b",
"size": 216,
"version": 1,
"merkleroot": "ff2fecc4c36854112c9481cadbfda5524320012b41725200f2dd3ef8e72bf4c7",
"time": 1238989442,
"nonce": 1163845665,
"bits": "1d00ffff",
"difficulty": "1",
"previousblockhash": "0000000099c744455f58e6c6e98b671e1bf7f37346bfd4cf5d0274ad8ee660cb",
"nextblockhash": "0000000099c744455f58e6c6e98b671e1bf7f37346bfd4cf5d0274ad8ee660cb",
"coinbaseinfo": "04ffff001d027303",
"coinbasetxid": "ff2fecc4c36854112c9481cadbfda5524320012b41725200f2dd3ef8e72bf4c7",
"chainwork": "0000000000000000000000000000000000000000000000000000271227122712"
},
]
}
Get Transaction Block Information
Get the information about which block a transaction is located in
GET https://txdb.mattercloud.io/api/v1/txblock/fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f,0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10?pretty
Example:
Get multiple txid's block infos
Params: - pretty: whether to pretty print
{
"status": 200,
"errors": [],
"result": [
{
"txid": "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 2
},
{
"txid": "0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 4
}
]
}
{
"status": 200,
"errors": [],
"result": [
{
"txid": "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 2
},
{
"txid": "0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 4
}
]
}
Get Transaction Block Information (Larger Batch)
Get the information about which block a transaction is located in using POST (get more txids at once)
POST https://txdb.mattercloud.io/api/v1/txblock?pretty
Params: - pretty: whether to pretty print
Request POST:
{
"txids": "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f,0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10"
}
Response:
{
"status": 200,
"errors": [],
"result": [
{
"txid": "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 2
},
{
"txid": "0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 4
}
]
}
Request POST:
{
"txids": "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f,0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10"
}
Response:
{
"status": 200,
"errors": [],
"result": [
{
"txid": "fd39debc631cf1a97702052fa60303d53062d6f2c1b624ab1f5fc0d20233736f",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 2
},
{
"txid": "0f9d562702259822778193ff46f0c6d5e4aa744a433982770d3134e2bf454d10",
"blockhash": "000000000000000004a288072ebb35e37233f419918f9783d499979cb6ac33eb",
"height": 575045,
"time": 1553416668,
"txindex": 4
}
]
}
SPV: Payment Verification
Get SPV Proofs
Get the SPV proofs for a set of txids. You may use the GET
and POST
HTTP methods.
Examples:
POST https://txdb.mattercloud.io/api/v1/spv?pretty&format=hex'
With body for POST use 'txids' JSON body param for the txids to retrieve SPV proof.
{
"txids": "f108b2d26ea71fed86cc680e1a8ac3fa1e2cf40a5df61ec08fe760b24489d7e9,da98d6070e87c6d045176bca4ceed74884a5f040a7af3fa36af890a1ae0c4f47,6137c9745772c24d6ce77861ac2599084d62289e0a6e97c1d73e18bab39ecd81,6137c9745772c24d6ce77861ac2599084d62289e0a6e97c1d73e18bab39ecd81"
}
Params: - format: json or hex - pretty: whether to pretty print
// Json:
{
"status": 200,
"errors": [],
"result": [
{
"spv": {
"blockHash": "0000000000000000034bf48950d0807aa3b983907168d16d713b6411e5e8cee3",
"txId": "da98d6070e87c6d045176bca4ceed74884a5f040a7af3fa36af890a1ae0c4f47",
"txIndex": "0",
"depth": 11,
"hashes": [
"474f0caea190f86aa33fafa740f0a58448d7ee4cca6b1745d0c6870e07d698da",
"f0c4a0395a53a2626a7271c4cc4375b992eaab49914b86166d37f4581fe73cb5",
"098ae7e15042502cfe514bf95614b1507977b21daff97d7bb11a1ccdc43aa00d",
"7e7db6621bfec6f69eedf5a128a9fae5286171497b57c12b37d0f6993386fc84",
"c851063af04877e7944ef25b535544370667b4088d0ab87f5e7b0875b5191ecf",
"16ad18288eb23eb83e70c9345095ffaa36c4eb77b8ecd5cce395cd9ce3c54c10",
"692a692bfb2e45b5e90104e538bedb0e29b0d71bd14354640de6f52f93a07d06",
"d34128b0e1f4bec3aa6837d68f89e3e2d3198ba5217dd5b54b470e0b3cc2e5d2",
"833a5556dfb2b06f7b5e452ff5b4299ca51162ecd9fa275744473d73be3a17d8",
"91231add4fd9f11cde36fcda7af1c2fc0d1b11ceb8226f106f915ea0455483c0",
"aecbc663a842d214c7c085539e1edeee3dcd5250f3cd249ab04645c118e3be3c"
],
"merkleRoot": "02b5366bc106cdfe5a7a7dd0e7610471f47b882df930ae995ccc46009ddbdd02"
}
}
]
}
// Hex:
{
"status": 200,
"errors": [],
"result": [
{
"rawspv": "0000000000000000034bf48950d0807aa3b983907168d16d713b6411e5e8cee3000b474f0caea190f86aa33fafa740f0a58448d7ee4cca6b1745d0c6870e07d698daf0c4a0395a53a2626a7271c4cc4375b992eaab49914b86166d37f4581fe73cb5098ae7e15042502cfe514bf95614b1507977b21daff97d7bb11a1ccdc43aa00d7e7db6621bfec6f69eedf5a128a9fae5286171497b57c12b37d0f6993386fc84c851063af04877e7944ef25b535544370667b4088d0ab87f5e7b0875b5191ecf16ad18288eb23eb83e70c9345095ffaa36c4eb77b8ecd5cce395cd9ce3c54c10692a692bfb2e45b5e90104e538bedb0e29b0d71bd14354640de6f52f93a07d06d34128b0e1f4bec3aa6837d68f89e3e2d3198ba5217dd5b54b470e0b3cc2e5d2833a5556dfb2b06f7b5e452ff5b4299ca51162ecd9fa275744473d73be3a17d891231add4fd9f11cde36fcda7af1c2fc0d1b11ceb8226f106f915ea0455483c0aecbc663a842d214c7c085539e1edeee3dcd5250f3cd249ab04645c118e3be3c"
}
]
}
// Json:
{
"status": 200,
"errors": [],
"result": [
{
"spv": {
"blockHash": "0000000000000000034bf48950d0807aa3b983907168d16d713b6411e5e8cee3",
"txId": "da98d6070e87c6d045176bca4ceed74884a5f040a7af3fa36af890a1ae0c4f47",
"txIndex": "0",
"depth": 11,
"hashes": [
"474f0caea190f86aa33fafa740f0a58448d7ee4cca6b1745d0c6870e07d698da",
"f0c4a0395a53a2626a7271c4cc4375b992eaab49914b86166d37f4581fe73cb5",
"098ae7e15042502cfe514bf95614b1507977b21daff97d7bb11a1ccdc43aa00d",
"7e7db6621bfec6f69eedf5a128a9fae5286171497b57c12b37d0f6993386fc84",
"c851063af04877e7944ef25b535544370667b4088d0ab87f5e7b0875b5191ecf",
"16ad18288eb23eb83e70c9345095ffaa36c4eb77b8ecd5cce395cd9ce3c54c10",
"692a692bfb2e45b5e90104e538bedb0e29b0d71bd14354640de6f52f93a07d06",
"d34128b0e1f4bec3aa6837d68f89e3e2d3198ba5217dd5b54b470e0b3cc2e5d2",
"833a5556dfb2b06f7b5e452ff5b4299ca51162ecd9fa275744473d73be3a17d8",
"91231add4fd9f11cde36fcda7af1c2fc0d1b11ceb8226f106f915ea0455483c0",
"aecbc663a842d214c7c085539e1edeee3dcd5250f3cd249ab04645c118e3be3c"
],
"merkleRoot": "02b5366bc106cdfe5a7a7dd0e7610471f47b882df930ae995ccc46009ddbdd02"
}
}
]
}
// Hex:
{
"status": 200,
"errors": [],
"result": [
{
"rawspv": "0000000000000000034bf48950d0807aa3b983907168d16d713b6411e5e8cee3000b474f0caea190f86aa33fafa740f0a58448d7ee4cca6b1745d0c6870e07d698daf0c4a0395a53a2626a7271c4cc4375b992eaab49914b86166d37f4581fe73cb5098ae7e15042502cfe514bf95614b1507977b21daff97d7bb11a1ccdc43aa00d7e7db6621bfec6f69eedf5a128a9fae5286171497b57c12b37d0f6993386fc84c851063af04877e7944ef25b535544370667b4088d0ab87f5e7b0875b5191ecf16ad18288eb23eb83e70c9345095ffaa36c4eb77b8ecd5cce395cd9ce3c54c10692a692bfb2e45b5e90104e538bedb0e29b0d71bd14354640de6f52f93a07d06d34128b0e1f4bec3aa6837d68f89e3e2d3198ba5217dd5b54b470e0b3cc2e5d2833a5556dfb2b06f7b5e452ff5b4299ca51162ecd9fa275744473d73be3a17d891231add4fd9f11cde36fcda7af1c2fc0d1b11ceb8226f106f915ea0455483c0aecbc663a842d214c7c085539e1edeee3dcd5250f3cd249ab04645c118e3be3c"
}
]
}
Verify SPV Proofs
Verify SPV Proof
Examples:
POST https://txdb.mattercloud.io/api/v1/spv/verify
With body for POST use 'txids' JSON body param for the txids to retrieve SPV proof.
{
"rawspv": "0000000000000000034bf48950d0807aa3b983907168d16d713b6411e5e8cee3000b474f0caea190f86aa33fafa740f0a58448d7ee4cca6b1745d0c6870e07d698daf0c4a0395a53a2626a7271c4cc4375b992eaab49914b86166d37f4581fe73cb5098ae7e15042502cfe514bf95614b1507977b21daff97d7bb11a1ccdc43aa00d7e7db6621bfec6f69eedf5a128a9fae5286171497b57c12b37d0f6993386fc84c851063af04877e7944ef25b535544370667b4088d0ab87f5e7b0875b5191ecf16ad18288eb23eb83e70c9345095ffaa36c4eb77b8ecd5cce395cd9ce3c54c10692a692bfb2e45b5e90104e538bedb0e29b0d71bd14354640de6f52f93a07d06d34128b0e1f4bec3aa6837d68f89e3e2d3198ba5217dd5b54b470e0b3cc2e5d2833a5556dfb2b06f7b5e452ff5b4299ca51162ecd9fa275744473d73be3a17d891231add4fd9f11cde36fcda7af1c2fc0d1b11ceb8226f106f915ea0455483c0aecbc663a842d214c7c085539e1edeee3dcd5250f3cd249ab04645c118e3be3c"
}
Params: - format: json or hex - pretty: whether to pretty print
{"status":200,"errors":[],"result":true}
{"status":200,"errors":[],"result":true}
TXQ: Transaction Queue
Bitcoin BSV transaction storage and UTXO indexer for developers.
Get Started at: https://github.com/attilaaf/TXQ
Merchant API (MAPI)
Note: You can use 3rd party API clients such as Minercraft to interact with the Merchant API endpoint at https://merchantapi.mattercloud.io/mapi/feeQuote
For example:
brfc-merchantapi specification
This protocol uses the JSON envelopes BRFC as well as the Fee Spec BRFC.
Get fee quote
curl https://merchantapi.mattercloud.io/mapi/feeQuote -H 'Content-Type: application/json'
// Using matterclouudjs
const matter = require('mattercloudjs');
const result = await matter.mapi.feeQuote('0100000001270...');
// Using minercraft
const miner = new Minercraft({
"url": "https://merchantapi.mattercloud.io"
});
let rate = await miner.fee.rate()
The above command returns JSON structured like this:
{
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-01-28T11:15:03.722Z\",\"expiryTime\":\"2020-01-28T11:25:03.722Z\",\"minerId\":\"03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031\",\"currentHighestBlockHash\":\"000000000000000001cedc3dec00ecd29943a275498e812e72b2afdf5df8814a\",\"currentHighestBlockHeight\":619574,\"minerReputation\":\"N/A\",\"fees\":[{\"feeType\":\"standard\",\"miningFee\":{\"satoshis\":1,\"bytes\":1},\"relayFee\":{\"satoshis\":1,\"bytes\":1}},{\"feeType\":\"data\",\"miningFee\":{\"satoshis\":1,\"bytes\":1},\"relayFee\":{\"satoshis\":1,\"bytes\":1}}]}",
"signature": "304402202a7f70855739a6948c00c2a85dd733f087c4f1ae4beb256c225eadab767d5e1d02207870c57728166f61b0334bd89640d6d6c26f31ada4aac42b29971ebfa5c414e1",
"publicKey": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"encoding": "UTF-8",
"mimetype": "application/json"
}
{
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-01-28T11:15:03.722Z\",\"expiryTime\":\"2020-01-28T11:25:03.722Z\",\"minerId\":\"03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031\",\"currentHighestBlockHash\":\"000000000000000001cedc3dec00ecd29943a275498e812e72b2afdf5df8814a\",\"currentHighestBlockHeight\":619574,\"minerReputation\":\"N/A\",\"fees\":[{\"feeType\":\"standard\",\"miningFee\":{\"satoshis\":1,\"bytes\":1},\"relayFee\":{\"satoshis\":1,\"bytes\":1}},{\"feeType\":\"data\",\"miningFee\":{\"satoshis\":1,\"bytes\":1},\"relayFee\":{\"satoshis\":1,\"bytes\":1}}]}",
"signature": "304402202a7f70855739a6948c00c2a85dd733f087c4f1ae4beb256c225eadab767d5e1d02207870c57728166f61b0334bd89640d6d6c26f31ada4aac42b29971ebfa5c414e1",
"publicKey": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"encoding": "UTF-8",
"mimetype": "application/json"
}
Purpose:
This endpoint returns a JSONEnvelope with a payload that contains the fees charged by a specific BSV miner. The purpose of the envelope is to ensure strict consistency in the message content for the purpose of signing responses.
Returns:
{
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-01-28T11:15:03.722Z\",\"expiryTime\":\"2020-01-28T11:25:03.722Z\",\"minerId\":\"03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031\",\"currentHighestBlockHash\":\"000000000000000001cedc3dec00ecd29943a275498e812e72b2afdf5df8814a\",\"currentHighestBlockHeight\":619574,\"minerReputation\":\"N/A\",\"fees\":[{\"feeType\":\"standard\",\"miningFee\":{\"satoshis\":1,\"bytes\":1},\"relayFee\":{\"satoshis\":1,\"bytes\":1}},{\"feeType\":\"data\",\"miningFee\":{\"satoshis\":1,\"bytes\":1},\"relayFee\":{\"satoshis\":1,\"bytes\":1}}]}",
"signature": "304402202a7f70855739a6948c00c2a85dd733f087c4f1ae4beb256c225eadab767d5e1d02207870c57728166f61b0334bd89640d6d6c26f31ada4aac42b29971ebfa5c414e1",
"publicKey": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"encoding": "UTF-8",
"mimetype": "application/json"
}
field | function |
---|---|
payload |
main data payload encoded in a specific format type |
signature |
signature on payload string. This may be null. |
publicKey |
public key to verify signature. This may be null. |
encoding |
encoding type |
mimetype |
Multipurpose Internet Mail Extensions type |
Payload:
{
"apiVersion": "0.1.0",
"timestamp": "2020-01-28T11: 15: 03.722Z",
"expiryTime": "2020-01-28T11: 25: 03.722Z",
"minerId": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"currentHighestBlockHash": "000000000000000001cedc3dec00ecd29943a275498e812e72b2afdf5df8814a",
"currentHighestBlockHeight": 619574,
"minerReputation": null,
"fees": [
{
"feeType": "standard",
"miningFee": {
"satoshis": 1,
"bytes": 1
},
"relayFee": {
"satoshis": 1,
"bytes": 1
}
},
{
"feeType": "data",
"miningFee": {
"satoshis": 1,
"bytes": 1
},
"relayFee": {
"satoshis": 1,
"bytes": 1
}
}
]
}
field | function |
---|---|
apiVersion |
version of merchant api spec |
timestamp |
timestamp of payload document |
expiryTime |
expiry time of quote |
minerId |
minerID / public key of miner. This may be null. |
currentHighestBlockHash |
hash of current blockchain tip |
currentHighestBlockHeight |
hash of current blockchain tip |
minerReputation |
reputation of miner |
fees |
fees charged by miner (feeSpec BRFC) |
Submit transaction
curl -X POST https://merchantapi.mattercloud.io/mapi/tx -H 'Content-Type: application/json' \
-d '{ "rawtx": "0100000001270e55963a167a2fae66307efa3565032402c1387d62e5276464295d2a6834d8010000008a4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598affffffff020000000000000000456a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f7468657240390000000000001976a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac00000000"}'
// Using matterclouudjs
const matter = require('mattercloudjs');
const result = await matter.mapi.submitTx('0100000001270...');
// Using minercraft
const miner = new Minercraft({
"url": "https://merchantapi.mattercloud.io"
});
let result = await miner.tx.push('0100000001270....')
Purpose:
This endpoint is used to send a raw transaction to a miner for inclusion in the next block that the miner creates.
body when
Content-Type
isapplication/json
:
{
"rawtx": "0200000001f56216b33513cf621839d584f0e31566059537ef184070733a56c3b5c41d0d6d0000000049483045022100cddd5c304ff87f1733262d34b56a90061aa4b97fdc0b0e42fc3065c04e231ca402202f0c65cb6d04c2b8fc82bdcfcfd7295b6e0f717362ec395e02f6905c68ac7b7741ffffffff01805b6d29010000001976a9142a5acfb9a647a03a758afaa5c359284d4b95c0be88ac00000000"
}
When Content-Type is application/octet-stream, it is possible to upload the rawtx as a binary stream. For large transactions, this is half the size of the hexadecimal equivalent although this gain is largely minimized through the use of gzip encoding of hex data.
Returns:
{
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-01-15T11:40:29.826Z\",\"txid\":\"6bdbcfab0526d30e8d68279f79dff61fb4026ace8b7b32789af016336e54f2f0\",\"returnResult\":\"success\",\"resultDescription\":\"\",\"minerId\":\"03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031\",\"currentHighestBlockHash\":\"71a7374389afaec80fcabbbf08dcd82d392cf68c9a13fe29da1a0c853facef01\",\"currentHighestBlockHeight\":207,\"txSecondMempoolExpiry\":0}",
"signature": "3045022100f65ae83b20bc60e7a5f0e9c1bd9aceb2b26962ad0ee35472264e83e059f4b9be022010ca2334ff088d6e085eb3c2118306e61ec97781e8e1544e75224533dcc32379",
"publicKey": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"encoding": "UTF-8",
"mimetype": "application/json"
}
field | function |
---|---|
payload |
main data payload encoded in a specific format type |
signature |
signature on payload string. This may be null. |
publicKey |
public key to verify signature. This may be null. |
encoding |
encoding type |
mimetype |
Multipurpose Internet Mail Extensions type |
Payload:
{
"apiVersion": "0.1.0",
"timestamp": "2020-01-15T11:40:29.826Z",
"txid": "6bdbcfab0526d30e8d68279f79dff61fb4026ace8b7b32789af016336e54f2f0",
"returnResult": "success",
"resultDescription": "",
"minerId": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"currentHighestBlockHash": "71a7374389afaec80fcabbbf08dcd82d392cf68c9a13fe29da1a0c853facef01",
"currentHighestBlockHeight": 207,
"txSecondMempoolExpiry": 0
}
field | function |
---|---|
apiVersion |
version of merchant api spec |
timestamp |
timestamp of payload document |
txid |
transaction ID |
returnResult |
will contain either success or failure |
resultDescription |
will contain the error on failure or empty on success |
minerId |
minerId public key of miner |
currentHighestBlockHash |
hash of current blockchain tip |
currentHighestBlockHeight |
hash of current blockchain tip |
txSecondMempoolExpiry |
Duration (minutes) Tx will be kept in secondary mempool |
Query transaction status
curl https://merchantapi.mattercloud.io/mapi/tx/5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12 -H 'Content-Type: application/json'
// Using matterclouudjs
const matter = require('mattercloudjs');
const result = await matter.mapi.getTx('5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12');
// Using minercraft
const miner = new Minercraft({
"url": "https://merchantapi.mattercloud.io"
});
let result = await miner.tx.status('5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12')
Purpose:
This endpoint is used to check the current status of a previously submitted transaction.
Returns:
{
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-01-15T11:41:29.032Z\",\"returnResult\":\"failure\",\"resultDescription\":\"Transaction in mempool but not yet in block\",\"blockHash\":\"\",\"blockHeight\":0,\"minerId\":\"03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031\",\"confirmations\":0,\"txSecondMempoolExpiry\":0}",
"signature": "3045022100f78a6ac49ef38fbe68db609ff194d22932d865d93a98ee04d2ecef5016872ba50220387bf7e4df323bf4a977dd22a34ea3ad42de1a2ec4e5af59baa13258f64fe0e5",
"publicKey": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"encoding": "UTF-8",
"mimetype": "application/json"
}
field | function |
---|---|
payload |
main data payload encoded in a specific format type |
signature |
signature on payload string. This may be null. |
publicKey |
public key to verify signature. This may be null. |
encoding |
encoding type |
mimetype |
Multipurpose Internet Mail Extensions type |
Payload:
{
"apiVersion": "0.1.0",
"timestamp": "2020-01-15T11:41:29.032Z",
"returnResult": "failure",
"resultDescription": "Transaction in mempool but not yet in block",
"blockHash": "",
"blockHeight": 0,
"minerId": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"confirmations": 0,
"txSecondMempoolExpiry": 0
}
field | function |
---|---|
apiVersion |
version of merchant api spec |
timestamp |
timestamp of payload document |
returnResult |
will contain either success or failure |
resultDescription |
will contain the error on failure or empty on success |
blockHash |
hash of tx block |
blockHeight |
hash of tx block |
minerId |
minerId public key of miner |
confirmations |
number of block confirmations |
txSecondMempoolExpiry |
Duration (minutes) Tx will be kept in secondary mempool |
OR
{
"payload": "{\"apiVersion\":\"0.1.0\",\"timestamp\":\"2020-01-15T12:09:37.394Z\",\"returnResult\":\"success\",\"resultDescription\":\"\",\"blockHash\":\"745093bb0c80780092d4ce6926e0caa753fe3accdc09c761aee89bafa85f05f4\",\"blockHeight\":208,\"minerId\":\"03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031\",\"confirmations\":2,\"txSecondMempoolExpiry\":0}",
"signature": "3045022100c9a712a124ff3100e26f7bbcc87204848cc2ff1effacd8d8e8daac5d81bce74c02201dd661aad00d2cde443a076475cfb7d6523e0ef98a1112e938af002ca5222fbe",
"publicKey": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"encoding": "UTF-8",
"mimetype": "application/json"
}
field | function |
---|---|
payload |
main data payload encoded in a specific format type |
signature |
signature on payload string. This may be null. |
publicKey |
public key to verify signature. This may be null. |
encoding |
encoding type |
mimetype |
Multipurpose Internet Mail Extensions type |
Payload:
{
"apiVersion": "0.1.0",
"timestamp": "2020-01-15T12:09:37.394Z",
"returnResult": "success",
"resultDescription": "",
"blockHash": "745093bb0c80780092d4ce6926e0caa753fe3accdc09c761aee89bafa85f05f4",
"blockHeight": 208,
"minerId": "03fcfcfcd0841b0a6ed2057fa8ed404788de47ceb3390c53e79c4ecd1e05819031",
"confirmations": 2,
"txSecondMempoolExpiry": 0
}
MatterCloud-JS
NOTE: Use TXDB, BitcoinFiles, and TXQ to get the same information.
This API will be supported until 2021 and is currently deprecated because all information is available at other endpoints.
Query wallet addresses, transactions, and broadcast transactions with the REST API.
Features:
- Query utxos and balances for addresses and scripthashes
- Transaction history
- Send and broadcast transactions
Address Balance
curl "https://api.mattercloud.io/api/v3/main/address/12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX/balance" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getBalance('12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX');
The above command returns JSON structured like this:
{
"address": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"confirmed": 30055,
"unconfirmed": 0
}
This endpoint retrieves balance for a specific address.
HTTP Request
GET https://api.mattercloud.io/api/v3/main/address/<address>/balance
URL Parameters
Parameter | Description |
---|---|
address | The address to retrieve balance for |
Address Balance Batch
curl -X POST https://api.mattercloud.io/api/v3/main/address/balance -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key" \
-d '{ "addrs": "1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H,12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX"}'
curl -X 'POST' "https://api.mattercloud.io/api/v3/main/address/balance" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getBalanceBatch(['1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H', '12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX']);
The above command returns JSON structured like this:
[
{
"address": "1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H",
"confirmed": 0,
"unconfirmed": 0
},
{
"address": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"confirmed": 30055,
"unconfirmed": 0
}
]
This endpoint retrieves balances for multiple addresses at same time
HTTP Request
POST https://api.mattercloud.io/api/v3/main/address/balance
Request Body
Parameter | Description |
---|---|
addrs | The addresses to retrieve balance for. Comma-seperated values. |
Address Unspent (UTXO)
curl "https://api.mattercloud.io/api/v3/main/address/12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX/utxo" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getUtxos('12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX');
The above command returns JSON structured like this:
[
{
"address": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"txid": "5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12",
"vout": 0,
"amount": 0.00015399,
"satoshis": 15399,
"value": 15399,
"height": 576168,
"confirmations": 34992,
"scriptPubKey": "76a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac",
"script": "76a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac",
"outputIndex": 0
}
]
This endpoint retrieves utxos for a specific address.
HTTP Request
GET https://api.mattercloud.io/api/v3/main/address/<address>/utxo
URL Parameters
Parameter | Description |
---|---|
address | The address to retrieve utxos for |
Address Unspent (UTXO) Batch
curl -X POST https://api.mattercloud.io/api/v3/main/address/utxo -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key" \
-d '{ "addrs": "1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H,12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX"}'
const matter = require('mattercloudjs');
const result = await matter.getUtxosBatch(['1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H', '12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX']);
The above command returns JSON structured like this:
[
{
"address": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"txid": "5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12",
"vout": 0,
"amount": 0.00015399,
"satoshis": 15399,
"value": 15399,
"height": 576168,
"confirmations": 34993,
"scriptPubKey": "76a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac",
"script": "76a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac",
"outputIndex": 0
}
]
This endpoint retrieves utxos for multiple addresses
HTTP Request
POST https://api.mattercloud.io/api/v3/main/address/utxo
Request Body
Parameter | Description |
---|---|
addrs | The addresses to retrieve utxos for. Comma-seperated values. |
Address History
curl "https://api.mattercloud.io/api/v3/main/address/12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX/history" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getHistory('12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX');
The above command returns JSON structured like this:
{
"from": 0,
"to": 20,
"results": [
{
"txid": "5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12",
"height": 576168
},
{
"txid": "bdf6f49776faaa4790af3e41b8b474a7d0d47df540f8d71c3579dc0addd64c45",
"height": 576025
},
{
"txid": "d834682a5d29646427e5627d38c10224036535fa7e3066ae2f7a163a96550e27",
"height": 576025
},
{
"txid": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6",
"height": 576025
}
]
}
This endpoint retrieves history for a specific address.
HTTP Request
GET https://api.mattercloud.io/api/v3/main/address/<address>/history
URL Parameters
Parameter | Description |
---|---|
address | The address to retrieve history for |
Address History Batch
curl -X POST https://api.mattercloud.io/api/v3/main/address/history -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key" \
-d '{ "addrs": "1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H,12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX"}'
const matter = require('mattercloudjs');
const result = await matter.getHistoryBatch(['1GJ3x5bcEnKMnzNFPPELDfXUCwKEaLHM5H', '12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX']);
The above command returns JSON structured like this:
{
"from": 0,
"to": 20,
"results": [
{
"height": 576168,
"txid": "5e3014372338f079f005eedc85359e4d96b8440e7dbeb8c35c4182e0c19a1a12"
},
{
"height": 576025,
"txid": "bdf6f49776faaa4790af3e41b8b474a7d0d47df540f8d71c3579dc0addd64c45"
},
{
"height": 576025,
"txid": "d834682a5d29646427e5627d38c10224036535fa7e3066ae2f7a163a96550e27"
},
{
"height": 576025,
"txid": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6"
}
]
}
This endpoint retrieves history for multiple addresses
HTTP Request
POST https://api.mattercloud.io/api/v3/main/address/history
Request Body
Parameter | Description |
---|---|
addrs | The addresses to retrieve history for. Comma-seperated values. |
ScriptHash Unspent (UTXO)
curl "https://api.mattercloud.io/api/v3/main/scripthash/03b508a9da0879dd55619e06f5bd656696f77ba879aaa99e0eb22cedd7dd4846/utxo" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getScriptHashUtxos('03b508a9da0879dd55619e06f5bd656696f77ba879aaa99e0eb22cedd7dd4846');
The above command returns JSON structured like this:
[
{
"scripthash": "03b508a9da0879dd55619e06f5bd656696f77ba879aaa99e0eb22cedd7dd4846",
"txid": "dc36f3baa9b7e96827928760c07a160579b0a531814e3a3900c1c4112c4a92e7",
"vout": 0,
"amount": 0.00004363,
"satoshis": 4363,
"value": 4363,
"height": 625311,
"confirmations": 72,
"outputIndex": 0
}
]
This endpoint retrieves utxos for a specific scripthash.
HTTP Request
GET https://api.mattercloud.io/api/v3/main/scripthash/<scripthash>/utxo
URL Parameters
Parameter | Description |
---|---|
scripthash | Script hash: sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string. |
ScriptHash History
curl "https://api.mattercloud.io/api/v3/main/scripthash/03b508a9da0879dd55619e06f5bd656696f77ba879aaa99e0eb22cedd7dd4846/history" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getScriptHashHistory('03b508a9da0879dd55619e06f5bd656696f77ba879aaa99e0eb22cedd7dd4846');
The above command returns JSON structured like this:
{
"from": 0,
"to": 20,
"results": [
{
"height": 625311,
"txid": "dc36f3baa9b7e96827928760c07a160579b0a531814e3a3900c1c4112c4a92e7"
}
]
}
This endpoint retrieves history for a specific scripthash.
HTTP Request
GET https://api.mattercloud.io/api/v3/main/scripthash/<scriphash>/history
URL Parameters
Parameter | Description |
---|---|
scripthash | Script hash: sha256 hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string. |
Get Transaction
curl "https://api.mattercloud.io/api/v3/main/tx/96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getTx('96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6');
The above command returns JSON structured like this:
{
"txid": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6",
"hash": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6",
"size": 301,
"version": 1,
"locktime": 0,
"vin": [
{
"value": 0.00015058,
"valueSat": 15058,
"txid": "d834682a5d29646427e5627d38c10224036535fa7e3066ae2f7a163a96550e27",
"vout": 1,
"n": 0,
"scriptSig": {
"asm": "30440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb7[ALL|FORKID] 044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598a",
"hex": "4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598a"
},
"addr": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"address": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"sequence": 4294967295
}
],
"vout": [
{
"value": 0,
"valueSat": 0,
"n": 0,
"scriptPubKey": {
"asm": "OP_RETURN 31394878696756345179427633744870515663554551797131707a5a56646f417574 1717859169 746578742f6d61726b646f776e 5554462d38 616e6f74686572",
"hex": "6a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f74686572",
"type": "nulldata"
},
"spentTxId": null,
"spentIndex": null,
"spentHeight": null
},
{
"value": 0.00014656,
"valueSat": 14656,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 10bdcba3041b5e5517a58f2e405293c14a7c70c1 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX"
]
},
"spentTxId": null,
"spentIndex": null,
"spentHeight": null
}
],
"blockhash": "0000000000000000078f34d9cd3f48e4948aef4c79548ec777050e1c8953a85c",
"confirmations": 35137,
"time": 1554007897,
"blocktime": 1554007897,
"valueIn": 0.00015058,
"fees": 0.00000402,
"valueOut": 0.00014656,
"rawtx": "0100000001270e55963a167a2fae66307efa3565032402c1387d62e5276464295d2a6834d8010000008a4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598affffffff020000000000000000456a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f7468657240390000000000001976a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac00000000"
}
This endpoint retrieves specific transaction
HTTP Request
GET https://api.mattercloud.io/api/v3/main/tx/<txid>
URL Parameters
Parameter | Description |
---|---|
txid | The txid to retrieve transaction for |
Get Raw Transaction
curl "https://api.mattercloud.io/api/v3/main/tx/96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6" -H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.getTxRaw('96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6');
The above command returns JSON structured like this:
{
"rawtx": "0100000001270e55963a167a2fae66307efa3565032402c1387d62e5276464295d2a6834d8010000008a4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598affffffff020000000000000000456a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f7468657240390000000000001976a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac00000000"
}
This endpoint retrieves specific raw transaction
HTTP Request
GET https://api.mattercloud.io/api/v3/main/rawtx/<txid>
URL Parameters
Parameter | Description |
---|---|
txid | The txid to retrieve transaction for |
Get Transaction Batch
curl -X POST https://api.mattercloud.io/api/v3/main/tx -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key" \
-d '{ "txids": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6,bdf6f49776faaa4790af3e41b8b474a7d0d47df540f8d71c3579dc0addd64c45"}'
const matter = require('mattercloudjs');
const result = await matter.getTxBatch([
'96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6',
'bdf6f49776faaa4790af3e41b8b474a7d0d47df540f8d71c3579dc0addd64c45'
]);
The above command returns JSON structured like this:
[
{
"txid": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6",
"hash": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6",
"size": 301,
"version": 1,
"locktime": 0,
"vin": [
{
"value": 0.00015058,
"valueSat": 15058,
"txid": "d834682a5d29646427e5627d38c10224036535fa7e3066ae2f7a163a96550e27",
"vout": 1,
"n": 0,
"scriptSig": {
"asm": "30440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb7[ALL|FORKID] 044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598a",
"hex": "4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598a"
},
"addr": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"address": "12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX",
"sequence": 4294967295
}
],
"vout": [
{
"value": 0,
"valueSat": 0,
"n": 0,
"scriptPubKey": {
"asm": "OP_RETURN 31394878696756345179427633744870515663554551797131707a5a56646f417574 1717859169 746578742f6d61726b646f776e 5554462d38 616e6f74686572",
"hex": "6a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f74686572",
"type": "nulldata"
},
"spentTxId": null,
"spentIndex": null,
"spentHeight": null
},
{
"value": 0.00014656,
"valueSat": 14656,
"n": 1,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 10bdcba3041b5e5517a58f2e405293c14a7c70c1 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"12XXBHkRNrBEb7GCvAP4G8oUs5SoDREkVX"
]
},
"spentTxId": null,
"spentIndex": null,
"spentHeight": null
}
],
"blockhash": "0000000000000000078f34d9cd3f48e4948aef4c79548ec777050e1c8953a85c",
"confirmations": 35137,
"time": 1554007897,
"blocktime": 1554007897,
"valueIn": 0.00015058,
"fees": 0.00000402,
"valueOut": 0.00014656,
"rawtx": "0100000001270e55963a167a2fae66307efa3565032402c1387d62e5276464295d2a6834d8010000008a4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598affffffff020000000000000000456a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f7468657240390000000000001976a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac00000000"
}
]
This endpoint retrieves specific transaction
HTTP Request
POST https://api.mattercloud.io/api/v3/main/tx
Request Body
Parameter | Description |
---|---|
txids | The txids to retrieve transactions for |
Send Raw Transaction (deprecated)
Note: Use the newer Merchant Service for broadcast capabilities.
curl -X POST https://api.mattercloud.io/api/v3/main/tx/send -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key" \
-d '{ "rawtx": "0100000001270e55963a167a2fae66307efa3565032402c1387d62e5276464295d2a6834d8010000008a4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598affffffff020000000000000000456a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f7468657240390000000000001976a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac00000000"}'
const matter = require('mattercloudjs');
const result = await matter.sendRawTx('0100000001270...');
The above command returns JSON structured like this:
{
"txid": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6"
}
This endpoint retrieves balances for multiple addresses at same time
HTTP Request
POST https://api.mattercloud.io/api/v3/main/tx/send
Request Body
Parameter | Description |
---|---|
rawtx | Transaction raw hex to broadcast |
Broadcast Transaction
(Deprecated). Use the newer Merchant API instead.
curl -X POST https://api.mattercloud.io/api/v3/main/merchants/tx/broadcast -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key" \
-d '{ "rawtx": "0100000001270e55963a167a2fae66307efa3565032402c1387d62e5276464295d2a6834d8010000008a4730440220132f6d484de9d34d314aec945865af5da95f35cf4c7cc271d40bc99f8d7f12e3022051fcb2ce4461d1c6e8a778f5e4dcb27c8461d18e0652f68a7a09a98e95df5cb74141044e2c1e2c055e7aefc291679882382c35894a6aa6dd95644f598e506c239f9d83b1d9671c1d9673e3c2b74f07e8032343f3adc21367bd4cffae92fe31efcd598affffffff020000000000000000456a2231394878696756345179427633744870515663554551797131707a5a56646f41757404617364660d746578742f6d61726b646f776e055554462d3807616e6f7468657240390000000000001976a91410bdcba3041b5e5517a58f2e405293c14a7c70c188ac00000000"}'
const matter = require('mattercloudjs');
const result = await matter.merchantTxBroadcast('0100000001270...');
The above command returns JSON structured like this:
{
"success": true,
"result": {
"txid": "96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6",
}
}
}
Errors will be of the form:
{
"success": false,
"error": "TXN_MEMPOOL_CONFLICT",
}
Where error
can be:
- TXN_ALREADY_KNOWN (suppressed - returns as success: true)
- TXN_MEMPOOL_CONFLICT
- TXN_ALREADY_IN_MEMPOOL (suppressed - returns as success: true)
- NON_FINAL_POOL_FULL
- TOO_LONG_NON_FINAL_CHAIN
- BAD_TXNS_INPUTS_TOO_LARGE
- BAD_TXNS_INPUTS_SPENT
- NON_BIP68_FINAL
- TOO_LONG_VALIDATION_TIME
- BAD_TXNS_NONSTANDARD_INPUTS
- ABSURDLY_HIGH_FEE
- DUST
- TX_FEE_TOO_LOW
This endpoint broadcasts a transaction to the network
HTTP Request
POST https://api.mattercloud.io/api/v3/main/merchants/tx/broadcast
Request Body
Parameter | Description |
---|---|
rawtx | Transaction raw hex to broadcast |
Get Transaction Status
(Deprecated). Use the newer Merchant API instead.
curl https://api.mattercloud.io/api/v3/main/merchants/tx/status/96b3dc5941ce97046d4af6e7a69f4b38c48f05ef071c2a33f88807b89ab51da6 -H 'Content-Type: application/json' \
-H 'Content-Type: application/json' \
-H "api_key: your-api-key"
const matter = require('mattercloudjs');
const result = await matter.merchantTxStatus('0100000001270...');
The above command returns JSON structured like this:
{
"success": true,
"result": {
"txid": "349a217f3a9eac4611688e44f3d5508cf8c711e6b583bb08bcff54dcda124ee5",
"blockhash": "0000000000000000012c4624da90017fc6b636b926675be0c6f46e178ddc92b7", // Set only if in block
"blocktime": 1582991571, // Set only if in block
"time": 1582991571,
"fees": 0.00000615,
"size": 515,
"valueIn": 0.003,
"valueOut": 0.00299385,
"networkStatus": { // 'networkStatus' is only available if 'blockhash' is undefined (ie: it's not yet in a block)
"minersAcceptedMempoolCount": 34, // Future: Show number of known miners with the transaction in mempool
"minersAcceptedMempoolHashpowerPercent": 0.79, // Future: Show percentage of hash power of known miners with tx in the mempool
"doubleSpendDetected": false, // Future: Show whether a double spend of the inputs was detected
"doubleSpendTx": "" // Future: Provide double spend txid if a double spend is detected
}
}
}
Errors will be of the form:
{
"success": false,
"error": "TX_NOT_FOUND",
}
Where error
can be:
- TX_NOT_FOUND
This endpoint checks the status of a transaction
HTTP Request
GET https://api.mattercloud.io/api/v3/main/merchants/tx/status/:txid
Contact
Contact us for feedback and questions, we love to hear your feedback. @mxtterpool
Errors
The MatterPool API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The resource is forbidden. |
404 | Not Found -- The specified resource could not be found. |
405 | Method Not Allowed -- You tried to access a resource with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The resource requested has been removed from our servers. |
418 | I'm a teapot. |
429 | Too Many Requests -- You're requesting too many resources! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |