For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Bitcoin


Bitcoin API is available on Web3 API platform.

Bitcoin API provides the means for communication with the Bitcoin’s public ledger.

In order for your Web3 application to interact with Bitcoin — either by reading blockchain data or sending transactions to the network — it must connect to a Bitcoin node. Developers interact with the blockchain using the methods provided by the API.

Bitcoin interaction interfaces supported:


Bitcoin native methods


Blockchain RPCs:

  • getbestblockhash — returns the hash of the best (tip) block in the most-work fully-validated chain.
  • getblock — retrieves info about a specific block given its block hash.
  • getblockchaininfo — returns an object containing various state info regarding blockchain processing.
  • getblockcount — returns the height of the most-work fully-validated chain.
  • getblockfilter — retrieves a BIP 157 content filter for a particular block.
  • getblockhash — returns hash of block in best-block-chain at height provided.
  • getblockheader — retrieves information about a specific block header.
  • getblockstats — computes per block statistics for a given window.
  • getchaintips — returns information about all known tips in the block tree.
  • getchaintxstats — computes statistics about the total number and rate of transactions in the chain.
  • getdifficulty — returns the proof-of-work difficulty as a multiple of the minimum difficulty.
  • getmempoolancestors — if txid is in the mempool, returns all in-mempool ancestors.
  • getmempooldescendants — if txid is in the mempool, returns all in-mempool descendants.
  • getmempoolentry — returns mempool data for given transaction.
  • getmempoolinfo — returns details on the active state of the TX memory pool.
  • getrawmempool — returns all transaction ids in memory pool as a json array of string transaction ids.
  • gettxout — returns details about an unspent transaction output.
  • gettxoutproof — returns a hex-encoded proof that “txid” was included in a block.
  • verifytxoutproof — verifies that a proof points to a transaction in a block.

Raw transactions RPCs:

  • analyzepsbt — analyzes and provides information about the current status of a PSBT and its inputs.
  • combinepsbt — combines multiple partially signed Bitcoin transactions into one transaction.
  • combinerawtransaction — combines multiple partially signed transactions into one transaction.
  • converttopsbt — converts a network serialized transaction to a PSBT.
  • createpsbt – creates a transaction in the Partially Signed Transaction format.
  • createrawtransaction — creates a transaction spending the given inputs and creating new outputs.
  • decodepsbt – returns a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.
  • decoderawtransaction — returns a JSON object representing the serialized, hex-encoded transaction.
  • decodescript — decodes a hex-encoded script.
  • finalizepsbt — finalizes the inputs of a PSBT.
  • getrawtransaction — returns the raw transaction data.
  • joinpsbts — joins multiple distinct PSBTs with different inputs and outputs into one PSBT.
  • sendrawtransaction — submits a raw transaction (serialized, hex-encoded) to local node and network.
  • testmempoolaccept — returns result of mempool acceptance tests.
  • utxoupdatepsbt — updates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set, or the mempool.

Util RPCs:

Wallet RPCs:

The wallet RPCs are only available if Bitcoin Core was built with wallet support, which is the default.

  • getaddressinfo — returns information about the given Bitcoin address.

Methods

Blockchain RPCs

Raw transactions RPCs, Util RPCs, Wallet RPCs

Blockbook API methods