Coin Secrets API for Bitcoin Metadata

The Coin Secrets API enables OP_RETURN transactions to be retrieved from the bitcoin or testnet blockchains, as well as unconfirmed transactions from the memory pool. The API also parses the content of the OP_RETURNs for display in a similar way to the Coin Secrets website.

Usage

Use regular HTTP GET requests to one of the following URL forms:

  • http://api.coinsecrets.org/block/353197 where 353197 is a bitcoin block number.
  • http://api.coinsecrets.org/mempool for the bitcoin memory pool.
  • http://api-testnet.coinsecrets.org/block/350145 where 350145 is a bitcoin testnet block number.
  • http://api-testnet.coinsecrets.org/mempool for the bitcoin testnet memory pool.

Responses

Responses are in JSON format. Assuming no error occurred, the top-level object of the response will contain height and timestamp fields, which indicate the requested block height and the timestamp inside that block header. (These fields will be null for mempool requests.) There will also be a field named op_returns, containing an array of information about OP_RETURNs. Each item in this array contains the following fields:

  • txid – the transaction's hexadecimal bitcoin transaction ID (txid).
  • txoffset – the byte offset of the transaction within the block (null for mempool requests).
  • script – the full hexadecimal script of the OP_RETURN output.
  • hex – the hexadecimal data embedded within the output, i.e. with the OP_RETURN and data length opcodes removed.
  • ascii – the ASCII representation of the OP_RETURN data, with non-ASCII characters converted to ?
  • protocols – a list of detected protocols. For each protocol, the name, url and display content is provided where available.

Usage limits

Please be sensible and send no more than one request per second. We want to keep this open without authentication for as long as possible.

Thanks and enjoy!