esplora (Block Explorer APIs)
SANDSHREW hosts a fully-qualified block explorer API within its JSON-RPC which expresses the full suite of functionality surfaced by esplora
, the backend developed and used by blockchain.info for their block explorer API. For a developer, the APIs provided by esplora
are often desirable, but running a fully-hosted esplora
instance is resource-intensive and therefore costly. SANDSHREW provides esplora
as part of the fully-hosted cluster to enable serious Bitcoin-powered application deployments without prohibitive dependencies.
Similar to the scheme used for the ord
namespace in the SANDSHREW JSON-RPC, the esplora
namespace maps a JSON-RPC payload to a REST call to the backend esplora
service and proxies its API directly. This translation from JSON-RPC to REST occurs as follows:
For a JSON-RPC payload such as:
{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_address::txs",
"params": [
"bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n"
]
}
The component of the JSON-RPC method following the esplora_
namespace prefix is a colon-delimited list of components to the full REST path which is forwarded to the ord
HTTP server. For any instance that splitting the JSON-RPC method by the colon character produces an empty string (i.e. there are repeated colons with no characters in between), these are taken to be placeholders for parameters to sequentially occupy, as the full REST path is constructed. Excess parameters within the JSON-RPC payload, for which there is no positional placeholder within the RPC method, are appended to the REST path as additional components.
Thus, the JSON-RPC method esplora_address::txs
with parameters set to ["bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n"]
maps to GET /address/bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n/txs
on the esplora
service.
The complete schema for the esplora
HTTP server is available on the esplora
repository, named for the project from which it is forked (electrs). The exact line of code where this section begins is linked below:
Transactions
Tx
esplora_tx
returns detailed information about a specific Bitcoin transaction based on its transaction ID (txid
). It provides comprehensive data about the transaction, including inputs, outputs, block information, and any associated inscriptions.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx",
"params": [
"ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txid": "ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "0000000000000000000000000000000000000000000000000000000000000000",
"vout": 4294967295,
"prevout": null,
"scriptsig": "03367b0c1b4d696e656420627920416e74506f6f6c39373102000101ca9a6d79fabe6d6df565fc9c90c3d1f40e471384b84d69e5720588aea827622e22ec662d5188380e10000000000000000000e3eac000000000000000",
"scriptsig_asm": "OP_PUSHBYTES_3 367b0c OP_PUSHBYTES_27 4d696e656420627920416e74506f6f6c39373102000101ca9a6d79 OP_RETURN_250 OP_RETURN_190 OP_2DROP OP_2DROP OP_RETURN_245 OP_VERIF OP_RETURN_252 OP_NUMEQUAL OP_ABS OP_RETURN_195 OP_RETURN_209 OP_RETURN_244 OP_PUSHBYTES_14 471384b84d69e5720588aea82762 OP_PUSHBYTES_46 <push past end>",
"witness": [
"0000000000000000000000000000000000000000000000000000000000000000"
],
"is_coinbase": true,
"sequence": 4294967295
}
],
"vout": [
{
"scriptpubkey": "a9144b09d828dfc8baaba5d04ee77397e04b1050cc7387",
"scriptpubkey_asm": "OP_HASH160 OP_PUSHBYTES_20 4b09d828dfc8baaba5d04ee77397e04b1050cc73 OP_EQUAL",
"scriptpubkey_type": "p2sh",
"scriptpubkey_address": "38XnPvu9PmonFU9WouPXUjYbW91wa5MerL",
"value": 726160425
},
{
"scriptpubkey": "6a24aa21a9ed0fdf8d12166cec30ab3d4f99a9889229aed843a20cd7d8459b08e2010d3d2656",
"scriptpubkey_asm": "OP_RETURN OP_PUSHBYTES_36 aa21a9ed0fdf8d12166cec30ab3d4f99a9889229aed843a20cd7d8459b08e2010d3d2656",
"scriptpubkey_type": "op_return",
"value": 0
},
{
"scriptpubkey": "6a2d434f5245012953559db5cc88ab20b1960faa9793803d0703375997be5a09d05bb9bac27ec60419d0b373f32b20",
"scriptpubkey_asm": "OP_RETURN OP_PUSHBYTES_45 434f5245012953559db5cc88ab20b1960faa9793803d0703375997be5a09d05bb9bac27ec60419d0b373f32b20",
"scriptpubkey_type": "op_return",
"value": 0
},
{
"scriptpubkey": "6a2952534b424c4f434b3ab29c71f95f884e91c2b30efa14e824f3f15bfabd76a58ea791b833270059089a",
"scriptpubkey_asm": "OP_RETURN OP_PUSHBYTES_41 52534b424c4f434b3ab29c71f95f884e91c2b30efa14e824f3f15bfabd76a58ea791b833270059089a",
"scriptpubkey_type": "op_return",
"value": 0
}
],
"size": 362,
"weight": 1340,
"fee": 0,
"status": {
"confirmed": true,
"block_height": 817974,
"block_hash": "000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5",
"block_time": 1700669241
}
}
}
Tx Status
Returns the transaction confirmation status.
Available fields: confirmed
(boolean), block_height
(optional) and block_hash
(optional).
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::status",
"params": [
"ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"confirmed": true,
"block_height": 817974,
"block_hash": "000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5",
"block_time": 1700669241
}
}
Tx Hex
Returns the hex encoded transaction.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::hex",
"params": [
"ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff5803367b0c1b4d696e656420627920416e74506f6f6c39373102000101ca9a6d79fabe6d6df565fc9c90c3d1f40e471384b84d69e5720588aea827622e22ec662d5188380e10000000000000000000e3eac000000000000000ffffffff042954482b0000000017a9144b09d828dfc8baaba5d04ee77397e04b1050cc73870000000000000000266a24aa21a9ed0fdf8d12166cec30ab3d4f99a9889229aed843a20cd7d8459b08e2010d3d265600000000000000002f6a2d434f5245012953559db5cc88ab20b1960faa9793803d0703375997be5a09d05bb9bac27ec60419d0b373f32b2000000000000000002b6a2952534b424c4f434b3ab29c71f95f884e91c2b30efa14e824f3f15bfabd76a58ea791b833270059089a0120000000000000000000000000000000000000000000000000000000000000000000000000"
}
Tx Raw
Returns the raw transaction as binary data.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::raw",
"params": [
"ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c"
]
}'
Params
txid
: string (required) - Transaction ID
verbose
: string (optional, defaults to "false") - If "false" return a raw string, otherwise return a json object
Tx Merkleblock Proof
Returns a merkle inclusion proof for the transaction using merkleblock format.
Note: This endpoint is not currently available for Liquid/Elements-based chains.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::merkleblock-proof",
"params": [
"ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0000b72dfdb7b7c44d9d79ca56a805182c72045d89897a50058e01000000000000000000f9cc47e793a7519e612d5203e2d40c3da9c6ded9c5f921ca90fbb82625b2dca139275e65125a0417a0e5b09f4b1000000e2c4ac8db2401f4ce3358c1c6c8a9cf8e6dd990ff5f0763a902a1d95f633285ee868e00921348e0af4810c3984a60aaaeb3bce95b6bc21bcedbd033de7c5616949ff54b59178253cb278a509a1f66a21348b57887f4168ce5e913c503c5a1209ecc35776cbe94550f5199efcba1b8e8af1f0c48ab5fce8c24a3740aa75065664b95f9cec95ccffa211f319132bc63ff89f00559245128aa4feb35356bf9bd1bf685597880fbef24bf5ebbfe7b95e562956f5e77b1fe17029ecaee92c43ec355b6b90fd87d1909a065eb9783e5e76b96704c2a4e16607a907d6e55ecc2bb40996b0dd873dda2d17a8a7438e627689a563898ce105f5f85d19c86cea44d2e21ed9312e05a12e74eae1c2faebae5a59dfe783a173382ec4b23dfcdf5df26b4bfb1a3d5781440e661cb0c2b7c48f71387056d24a24556e7193d04e1096afb6c64a2fd05a64d00956dcdb4e06be05169e99b8ec4fc6f569ddc20861b3b351fa997b7e9dce729de9641c89fb493e4a88c1ec713f5a54586c53bdd07e8247a71119b93ea7a694a2858cbb53889ac4ff4ac104f61e3450a1b793d04d664de0f3f7b22f5791d3ca263b3db3e678cc4f02ffd5bcb0052cc2f39276cadf0c16607d626b0e6d304ff3f0000"
}
Tx Merkle-proof
Returns a merkle inclusion proof for the transaction with the following keys:
block_height
The height of the block the transaction was confirmed in.
merkle
A list of transaction hashes the current hash is paired with, recursively, in order to trace up to obtain merkle root of the block, deepest pairing first.
pos
The 0-based index of the position of the transaction in the ordered list of transactions in the block.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::merkle-proof",
"params": [
"ee8532635fd9a102a963075fff90d96d8ecfa9c8c6c15833cef40124dbc84a2c"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"block_height": 817974,
"merkle": [
"9416567cde33d0dbce1bc26b5be9bcb3aeaa604a98c31048afe0481392008e86",
"9e20a1c503c513e9e58c16f48778b54813a2661f9a508a27cb538217594bf59f",
"4b666550a70a74a3248cce5fab480c1fafe8b8a1cbef99510f5594be6c7735cc",
"f61bbdf96b3535eb4faa2851245905f089ff63bc3291311f21facf5cc9cef995",
"b655c33ec492eeca9e0217feb1775e6f9562e5957bfebb5ebf24effb80785985",
"6b9940bbc2ec556e7d907a60164e2a4c70966be7e58397eb65a009197dd80fb9",
"93ed212e4da4ce869cd1855f5f10ce9838569a6827e638748a7ad1a2dd73d80d",
"a3b1bfb426dff5cddf234bec8233173a78fe9da5e5baae2f1cae4ee7125ae012",
"fda2646cfb6a09e1043d19e75645a2246d058713f7487c2b0ccb61e6401478d5",
"e9b797a91f353b1b8620dc9d566ffcc48e9be96951e06be0b4cd6d95004da605",
"ea939b11717a24e807dd3bc58645a5f513c71e8ca8e493b49fc84196de29e7dc",
"79f5227b3f0fde64d6043d791b0a45e3614f10acf44fac8938b5cb58284a697a",
"d3e6b026d60766c1f0ad6c27392fcc5200cb5bfd2ff0c48c673edbb363a23c1d"
],
"pos": 0
}
}
Tx Outspends
Returns the spending status of all transaction outputs.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::outspends",
"params": [
"b0ba58a69a7b11dfac81351af9c011bd52168346e8cc3311e1282e335a4728fb"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"spent": false
},
{
"spent": false
},
{
"spent": true,
"txid": "9416567cde33d0dbce1bc26b5be9bcb3aeaa604a98c31048afe0481392008e86",
"vin": 0,
"status": {
"confirmed": true,
"block_height": 817974,
"block_hash": "000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5",
"block_time": 1700669241
}
},
{
"spent": false
},
{
"spent": false
},
{
"spent": true,
"txid": "6ef9ea136a0dfddb31b75b2363b640425e71ef47b4a21e5b95a054c47e3b4449",
"vin": 4,
"status": {
"confirmed": true,
"block_height": 817817,
"block_hash": "000000000000000000038e07b5e8eaa8bd723fba908fe73019f730d4f503a049",
"block_time": 1700582788
}
}
]
}
Tx Outspend
Returns the spending status of a specific transaction output.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_tx::outspend",
"params": [
"b0ba58a69a7b11dfac81351af9c011bd52168346e8cc3311e1282e335a4728fb",
"2"
]
}'
Params
txid
: string (required) - Transaction ID
vout
: string (required) - The number of the transaction output
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"spent": true,
"txid": "9416567cde33d0dbce1bc26b5be9bcb3aeaa604a98c31048afe0481392008e86",
"vin": 0,
"status": {
"confirmed": true,
"block_height": 817974,
"block_hash": "000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5",
"block_time": 1700669241
}
}
}
Addresses
Address Info
Returns details about an address.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_address",
"params": [
"bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"address": "bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7",
"chain_stats": {
"funded_txo_count": 5,
"funded_txo_sum": 9141224,
"spent_txo_count": 2,
"spent_txo_sum": 5975682,
"tx_count": 5
},
"mempool_stats": {
"funded_txo_count": 0,
"funded_txo_sum": 0,
"spent_txo_count": 0,
"spent_txo_sum": 0,
"tx_count": 0
}
}
}
Address Tx History
Get transaction history for the specified address. Returns up to 50 mempool transactions plus the first 25 confirmed transactions. You can request more confirmed transactions using last_seen_txid
.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_address::txs",
"params": [
"bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "f719010042cda872a6add2f98a51c3e0f9997a6d9cd92c321c8dab9ef69350be",
"version": 2,
"locktime": 0,
"vin": [
{
"txid": "23ac1179890cfed9d3b9cdb290ad4c98f890ec0781a3de1f7600ee5d48e06853",
"vout": 0,
"prevout": {
"scriptpubkey": "5120070f28b7e974ac25e978369ca6b125955c6b7153f6e612e7aeca3a4e6ada314d",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 070f28b7e974ac25e978369ca6b125955c6b7153f6e612e7aeca3a4e6ada314d",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n",
"value": 16000
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"e0e706d5cfbf1d8cea1d8ffecb1b00f99897f293002660b23ded35fb35144aade62227a49ad634e916cdff6ca57620a1c207ae53738f35292e341e7e865264cb",
"20fc19540a13a609121f98a939348df194fbf59c6ffa8f5aec099207dc14a395aeac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d3800357b2270223a226272632d3230222c226f70223a226d696e74222c227469636b223a22746f696c222c22616d74223a2231303030227d68",
"c151cae3bc8e151ca21c4a093362d6aab05a25bb5693cdf5a6861cf5eb59402272"
],
"is_coinbase": false,
"sequence": 4294967293
}
],
"vout": [
{
"scriptpubkey": "51201ef4bb672ee1bc1014c72f7ead247e5e495a1c35ed61376ce1b68f1e1f99d400",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 1ef4bb672ee1bc1014c72f7ead247e5e495a1c35ed61376ce1b68f1e1f99d400",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1prm6tkeewux7pq9x89al26fr7tey458p4a4snwm8pk683u8ue6sqqekcchr",
"value": 546
},
{
"scriptpubkey": "001488e946652af2729f12abc03120387d152e9c22fa",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 88e946652af2729f12abc03120387d152e9c22fa",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "bc1q3r55vef27fef7y4tcqcjqwraz5hfcgh6yl645u",
"value": 2532
}
],
"size": 351,
"weight": 726,
"fee": 12922,
"status": {
"confirmed": true,
"block_height": 817831,
"block_hash": "000000000000000000013873daaff66f8ec5b48075babbfcccac831a00c8c767",
"block_time": 1700589870
}
},
{
"txid": "23ac1179890cfed9d3b9cdb290ad4c98f890ec0781a3de1f7600ee5d48e06853",
"version": 2,
"locktime": 0,
"vin": [
{
"txid": "9d92bea825ec5736f7cb0bb8b952b6bb0b7dc6f13f300245b2aece25acb31ef8",
"vout": 1,
"prevout": {
"scriptpubkey": "00142bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 2bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7",
"value": 2975682
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"3045022100c4be8d0a8ef2d0179fe7ccb2c36f37ffbe75dd9632da1f2d6bd2ac2326dc8ebc022021066387ff665c7e2072bca8c3c1324795edd8a5885208d3ef002af4b7179f1a01",
"026de43f1d41eeba32b31ad449edb28ef0390b97828d7c76f61cbcc8cc4de64123"
],
"is_coinbase": false,
"sequence": 4294967295
}
],
"vout": [
{
"scriptpubkey": "5120070f28b7e974ac25e978369ca6b125955c6b7153f6e612e7aeca3a4e6ada314d",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 070f28b7e974ac25e978369ca6b125955c6b7153f6e612e7aeca3a4e6ada314d",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n",
"value": 16000
},
{
"scriptpubkey": "00142bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 2bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7",
"value": 2948765
}
],
"size": 235,
"weight": 610,
"fee": 10917,
"status": {
"confirmed": true,
"block_height": 817831,
"block_hash": "000000000000000000013873daaff66f8ec5b48075babbfcccac831a00c8c767",
"block_time": 1700589870
}
}
]
}
Address Confirmed Tx
Get confirmed transaction history for the specified address, sorted with newest first. Returns 25 transactions per page. More can be requested by specifying the last_seen_txid
seen by the previous query.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_address::txs:chain",
"params": [
"bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7"
]
}'
Params
address
: string (required) - Bitcoin address
last_seen_txid
: string (optional) - Transaction ID from previous query
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "23ac1179890cfed9d3b9cdb290ad4c98f890ec0781a3de1f7600ee5d48e06853",
"version": 2,
"locktime": 0,
"vin": [
{
"txid": "9d92bea825ec5736f7cb0bb8b952b6bb0b7dc6f13f300245b2aece25acb31ef8",
"vout": 1,
"prevout": {
"scriptpubkey": "00142bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 2bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7",
"value": 2975682
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"3045022100c4be8d0a8ef2d0179fe7ccb2c36f37ffbe75dd9632da1f2d6bd2ac2326dc8ebc022021066387ff665c7e2072bca8c3c1324795edd8a5885208d3ef002af4b7179f1a01",
"026de43f1d41eeba32b31ad449edb28ef0390b97828d7c76f61cbcc8cc4de64123"
],
"is_coinbase": false,
"sequence": 4294967295
}
],
"vout": [
{
"scriptpubkey": "5120070f28b7e974ac25e978369ca6b125955c6b7153f6e612e7aeca3a4e6ada314d",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 070f28b7e974ac25e978369ca6b125955c6b7153f6e612e7aeca3a4e6ada314d",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n",
"value": 16000
},
{
"scriptpubkey": "00142bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 2bfe42a69e37751a96776c8151391c055ca1b460",
"scriptpubkey_type": "v0_p2wpkh",
"scriptpubkey_address": "bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7",
"value": 2948765
}
],
"size": 235,
"weight": 610,
"fee": 10917,
"status": {
"confirmed": true,
"block_height": 817831,
"block_hash": "000000000000000000013873daaff66f8ec5b48075babbfcccac831a00c8c767",
"block_time": 1700589870
}
}
]
}
Addr Mempool Tx
Get unconfirmed transaction history for the specified address. Returns up to 50 transactions (no paging).
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_address::txs:mempool",
"params": [
"bc1pqu8j3dlfwjkzt6tcx6w2dvf9j4wxku2n7mnp9eawegayu6k6x9xsgsff7n"
]
}'
Addr UTXOs
Get the list of unspent transaction outputs associated with the address.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_address::utxo",
"params": [
"bc1q90ly9f57xa6349nhdjq4zwguq4w2rdrqgfgtd7"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "32c99ef2048481d70040c7338e50bc9682de389506a55448b051ef8d893aee6e",
"vout": 0,
"status": {
"confirmed": true,
"block_height": 817824,
"block_hash": "000000000000000000036133fc5e75e5bb3656f2aaedb6f7a06e1997e1627bd7",
"block_time": 1700585869
},
"value": 546
},
{
"txid": "23ac1179890cfed9d3b9cdb290ad4c98f890ec0781a3de1f7600ee5d48e06853",
"vout": 1,
"status": {
"confirmed": true,
"block_height": 817831,
"block_hash": "000000000000000000013873daaff66f8ec5b48075babbfcccac831a00c8c767",
"block_time": 1700589870
},
"value": 2948765
},
{
"txid": "37a5e179b008f956bd00a3e07444f9cc747d6b9deaaa05b8eacd073b3108f4e2",
"vout": 10,
"status": {
"confirmed": true,
"block_height": 816621,
"block_hash": "0000000000000000000355718a4955b850b1c5b17db6ae6a01962245b5ab7149",
"block_time": 1699894589
},
"value": 216231
}
]
}
Scripthash
A script hash is the hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string. The hash function to use is currently sha256()
.
For example, the legacy Bitcoin address from the genesis block:
const address = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'
has P2PKH scriptpubkey:
const script = bitcoin.address.toOutputScript(address)
console.log('script.toString('hex'))
// 76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac
with SHA256 hash, the scripthash
:
const hash = bitcoin.crypto.sha256(script)
console.log('Scripthash: ', hash.toString('hex'))
// Scripthash: 6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b
which is sent to the server reversed as:
const reversedHash = hash.reverse()
console.log(reversedHash.toString('hex'))
// 8b01df4e368ea28f8dc0423bcf7a4923e3a12d307c875e47a0cfbf90b5c39161
By subscribing to this hash you can find P2PK payments to the genesis block public key.
Scripthash Info
Get chain and mempool stats for a scripthash (script pub key).
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_scripthash",
"params": [
"6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"chain_stats": {
"funded_txo_count": 6675,
"funded_txo_sum": 4967680559,
"spent_txo_count": 0,
"spent_txo_sum": 0,
"tx_count": 6620
},
"mempool_stats": {
"funded_txo_count": 1,
"funded_txo_sum": 2450,
"spent_txo_count": 0,
"spent_txo_sum": 0,
"tx_count": 1
},
"scripthash": "6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b"
}
}
Scripthash Tx History
Get transaction history for the specified address/scripthash, sorted with newest first.
Returns up to 50 mempool transactions plus the first 25 confirmed transactions. You can request more confirmed transactions using last_seen_txid.
beg
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_scripthash::txs",
"params": [
"6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "255016ede76fad37d082f811ec4355a0b1dae7e9f5ac6c3b707f411ef2c4c046",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "45e8094a5e906dbd1861771f91c2e0c3020ae565781248139eb6a41d3dc6c5ab",
"vout": 1,
"prevout": {
"scriptpubkey": "5120b59e955d58211345464b668cf9adb82dfa1cbb57ff2e692d18a119ee5d24dcbe",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 b59e955d58211345464b668cf9adb82dfa1cbb57ff2e692d18a119ee5d24dcbe",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1pkk0f2h2cyyf523jtv6x0ntdc9hapew6hluhxjtgc5yv7uhfymjlq9ff3hq",
"value": 10563760
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"a78f1f170eaa758f00c380a138f39cbf30d4e6a367632a606a6066bea55805c90181f9b2be5a837b694f27dbde8bbba8d1ad4b4edbda494c31603a7c2dc05e47"
],
"is_coinbase": false,
"sequence": 4294967295
}
],
"vout": [
{
"scriptpubkey": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac",
"scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG",
"scriptpubkey_type": "p2pkh",
"scriptpubkey_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
"value": 2450
},
{
"scriptpubkey": "51201e5973cd6884d0159e119f2d809a7f0753449b37c82c348f275cc00ff5ee67f9",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 1e5973cd6884d0159e119f2d809a7f0753449b37c82c348f275cc00ff5ee67f9",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1prevh8ntgsngpt8s3nukcpxnlqaf5fxeheqkrfre8tnqqla0wvlusm97nr0",
"value": 10557660
}
],
"size": 196,
"weight": 580,
"fee": 3650,
"status": {
"confirmed": false
}
},
etc...
]
}
Scripthash Confirmed Tx
Get confirmed transaction history for the specified address/scripthash, sorted with newest first.
Returns 25 transactions per page. More can be requested by specifying the last txid seen by the previous query.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_scripthash::txs:chain",
"params": [
"6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b"
]
}'
Params
script_hash
: string (required) - Script hash
last_seen_txid
: string (optional) - Transaction ID from previous query
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "bbcf0c04477488800f0495dacc2998733431cc8e15136a58af3c5f8a92731be2",
"version": 2,
"locktime": 824790,
"vin": [
{
"txid": "6db9bf86ce7a290ddf3faa66af7cf5db02bd1b7ad898985b25e50ffccc118fc4",
"vout": 1,
"prevout": {
"scriptpubkey": "5120c6407c0e84d5dfeeb6b235f3fa64e866228628bb16412aa1ec15c4232c5a2be1",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 c6407c0e84d5dfeeb6b235f3fa64e866228628bb16412aa1ec15c4232c5a2be1",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1pceq8cr5y6h07ad4jxhel5e8gvc3gv29mzeqj4g0vzhzzxtz690ss3vpnjp",
"value": 32910
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"6125622a652f8d09f2ba347c8ab838f37d48fce14156a12fd23be59962ae580aa754e6db7d27dda75d4bac48fd1688c3c8c5bc91ebc7d5328ec6f2d5551019d7"
],
"is_coinbase": false,
"sequence": 4294967293
}
],
"vout": [
{
"scriptpubkey": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac",
"scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG",
"scriptpubkey_type": "p2pkh",
"scriptpubkey_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
"value": 16193
}
],
"size": 153,
"weight": 408,
"fee": 16717,
"status": {
"confirmed": true,
"block_height": 824791,
"block_hash": "0000000000000000000285841a02f0a9de3adb288708cad7df957b88642c8c75",
"block_time": 1704667936
}
},
etc,,,
]
}
Scripthash Mempool Tx
Get unconfirmed transaction history for the specified address/scripthash.
Returns up to 50 transactions (no paging).
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_scripthash::txs:mempool",
"params": [
"6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "255016ede76fad37d082f811ec4355a0b1dae7e9f5ac6c3b707f411ef2c4c046",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "45e8094a5e906dbd1861771f91c2e0c3020ae565781248139eb6a41d3dc6c5ab",
"vout": 1,
"prevout": {
"scriptpubkey": "5120b59e955d58211345464b668cf9adb82dfa1cbb57ff2e692d18a119ee5d24dcbe",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 b59e955d58211345464b668cf9adb82dfa1cbb57ff2e692d18a119ee5d24dcbe",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1pkk0f2h2cyyf523jtv6x0ntdc9hapew6hluhxjtgc5yv7uhfymjlq9ff3hq",
"value": 10563760
},
"scriptsig": "",
"scriptsig_asm": "",
"witness": [
"a78f1f170eaa758f00c380a138f39cbf30d4e6a367632a606a6066bea55805c90181f9b2be5a837b694f27dbde8bbba8d1ad4b4edbda494c31603a7c2dc05e47"
],
"is_coinbase": false,
"sequence": 4294967295
}
],
"vout": [
{
"scriptpubkey": "76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac",
"scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 OP_EQUALVERIFY OP_CHECKSIG",
"scriptpubkey_type": "p2pkh",
"scriptpubkey_address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
"value": 2450
},
{
"scriptpubkey": "51201e5973cd6884d0159e119f2d809a7f0753449b37c82c348f275cc00ff5ee67f9",
"scriptpubkey_asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 1e5973cd6884d0159e119f2d809a7f0753449b37c82c348f275cc00ff5ee67f9",
"scriptpubkey_type": "v1_p2tr",
"scriptpubkey_address": "bc1prevh8ntgsngpt8s3nukcpxnlqaf5fxeheqkrfre8tnqqla0wvlusm97nr0",
"value": 10557660
}
],
"size": 196,
"weight": 580,
"fee": 3650,
"status": {
"confirmed": false
}
}
]
}
Scripthash UTXOs
Get the list of unspent transaction outputs associated with the scripthash.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_scripthash::utxo",
"params": [
"124ce9c09e50af4913187bd0563bdb319d0d7ccdc48e5d1ca8e7061e14dc6d65"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txid": "37a5e179b008f956bd00a3e07444f9cc747d6b9deaaa05b8eacd073b3108f4e2",
"vout": 10,
"status": {
"confirmed": true,
"block_height": 816621,
"block_hash": "0000000000000000000355718a4955b850b1c5b17db6ae6a01962245b5ab7149",
"block_time": 1699894589
},
"value": 216231
},
{
"txid": "32c99ef2048481d70040c7338e50bc9682de389506a55448b051ef8d893aee6e",
"vout": 0,
"status": {
"confirmed": true,
"block_height": 817824,
"block_hash": "000000000000000000036133fc5e75e5bb3656f2aaedb6f7a06e1997e1627bd7",
"block_time": 1700585869
},
"value": 546
},
{
"txid": "f66e5657d73c6a34e04bb9873cf2b32cbaa626163542178cfad2c29d0bb1acdc",
"vout": 1,
"status": {
"confirmed": true,
"block_height": 818015,
"block_hash": "00000000000000000002e6710101233b85e9977b8864239edce6ef0a3728993f",
"block_time": 1700692462
},
"value": 2921695
}
]
}
Blocks
Block Info
Returns information about a block.
The response from this endpoint can be cached indefinitely.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_block",
"params": [
"000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5"
]
}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5",
"height": 817974,
"version": 766967808,
"timestamp": 1700669241,
"tx_count": 4171,
"size": 1671331,
"weight": 3993538,
"merkle_root": "a1dcb22526b8fb90ca21f9c5d9dec6a93d0cd4e203522d619e51a793e747ccf9",
"previousblockhash": "000000000000000000018e05507a89895d04722c1805a856ca799d4dc4b7b7fd",
"mediantime": 1700666768,
"nonce": 2679170464,
"bits": 386161170,
"difficulty": 64678587803496
}
}
Block Header
Returns the hex-encoded block header.
The response from this endpoint can be cached indefinitely.
curl https://mainnet.sandshrew.io/v1/<developer key> \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "esplora_block::header",
"params": [
"000000000000000000006fc88a9a6f7ef0e4b64143482076f3755faef3bfcbd5"
]
}'