opreturn.net

API Documentation

opreturn.net provides a simple REST JSON API to programmatically retrieve blockchain data over HTTPS.
Supported blockchains include bitcoin (btc), litecoin (ltc), dogecoin (doge), and garlicoin (grlc).

Documentation to request data is below, along with code examples and the JSON response.
all, apikey, address, block, bestblockhash, blockchaininfo, blockheader, blocktimes, hash, mempool, network, peers, pubkey, transaction

Pubkey

GET Pubkey

Endpoints
GET /api/[$coin]/pubkey/[$pubkey]/
GET /api/[$coin]/pubkey/[$pubkey]/[$verbose]/
GET /api/[$coin]/pubkey/[$pubkey]/[$startblock]/[$endblock]/[$verbose]/

//Returns pubkey information & transaction history
//If verbose is 0, pubkey information includes array of receiving txids
//If verbose is 1, pubkey information includes an Object of receiving transaction details (txid, vout, value, spend_block, spend_txid)
//If verbose is utxo, pubkey information includes an Object of unspent outputs (txid, vout, value)
//If startblock and endblock are included, includes an Object of receiving transaction details received between startblock and endblock

[OPTIONS]
$coin (string): btc or ltc or doge or grlc
$pubkey (string)
$verbose (boolean) or (string):
  0 returns "tx":["txid","txid","txid",...]
  1 returns "tx":[{"txid":"txid","vout":int,"value":int,"receive_block":int,"spend_block":int,"spend_txid":"txid"},{...}]
  utxo returns "utxo":[{"txid":str,"vout":int,"value":int,"receive_block":int},{...}]
$startblock (int): include transactions >= startblock
$endblock (int): include transactions <= endblock


Code example - get pubkey (verbose)

curl "https://opreturn.net/api/btc/pubkey/024d57123256b2a84e6618bc12b08f81cd54ec79fcd7a55a129eee9402bac8d5f7/1/"

Response

{
    "coin": "btc",
    "cmd": "pubkey",
    "input": "024d57123256b2a84e6618bc12b08f81cd54ec79fcd7a55a129eee9402bac8d5f7",
    "verbose": 1,
    "success": true,
    "pubkey": {
        "pubkey": "024d57123256b2a84e6618bc12b08f81cd54ec79fcd7a55a129eee9402bac8d5f7",
        "compressed": 1,
        "pubkeyhash": "f4f5209eb5bce683a4a1dd325e22bdda6a31cf95",
        "isvalid": true,
        "scriptpubkey": "21024d57123256b2a84e6618bc12b08f81cd54ec79fcd7a55a129eee9402bac8d5f7ac",
        "address": "1PLDXZPhFEfGGxdXr54FxvWUvWcRCrjHEG",
        "isscript": 0,
        "note": "Any transaction history is for the raw pubkey only and not the derived P2PKH address",
        "receive_n": 1,
        "receive_sats": 5000000000,
        "spent_n": 1,
        "spent_sats": 5000000000,
        "unspent_n": 0,
        "unspent_sats": 0,
        "firstreceive_block": 163368,
        "firstreceive_time": 1327250584,
        "lastreceive_block": 163368,
        "lastreceive_time": 1327250584,
        "firstspend_block": 163519,
        "firstspend_time": 1327327338,
        "lastspend_block": 163519,
        "lastspend_time": 1327327338,
        "tx": [
            {
                "txid": "0e842d4d66bc1c30a88f17eefa1e3436c6524aca39e9ad358edf380daf7a49ab",
                "vout": 0,
                "value": 5000000000,
                "receive_block": 163368,
                "spend_block": 163519,
                "spend_txid": "40ec5c20d8eb34e96b72dda9773f030c254a4d687496c169082366e20e4059e7"
            }
        ]
    }
}