bitcoin block raw data

I'm stealing from an answer I recently wrote on more theoretical stuff, but here is a list of actual things stored in the blockchain that you have if you have the full blockchain: Hidden surprises in the Bitcoin blockchain and how they are stored: Nelson Mandela, Wikileaks, photos, and Python software.EDIT: Just to make it easier, the list (besides that above), include the original bitcoin paper, a rickroll, illegal primes (Illegal prime), an email supposedly from Satoshi Nakamoto, and what could be other stuff that's been encrypted.Finally, to get my dad-joke of the day in, another thing stored in the blockchain are bitcoin transactions :)EDIT 2: OOH The real data the ends up as a result of the transaction?The transactions end up in blocks.One block can be viewed here: Bitcoin Block #341670That shows who mined the block and all the transactions included in the block.The actual transaction data might look something like 01000000000100000000000000001976a91424f046543cfce2354562bf60876cebb2b4596bc588ac00000000.

Different blocks or transactions can be viewed as raw data on Bitcoin Block Explorer and looked at in different ways on JavaScript Client-Side Bitcoin Address Generator.In the bitcoin architecture, there is an operation called OP_RETURN (google this), which allows you to store 40 bytes of data with a bitcoin transaction.So any transaction can include one OP_RETURN, and you can see a lot of so called "metadata" examples at OP_RETURN metadata in the Bitcoin Blockchain
ethereum tokens listFind technical details and API documentation.
bitcoin difficulty factor todayBlock Chain Block Versions Merkle Trees Target nBits Serialized Blocks Transactions OpCodes Address Conversion Raw Transaction Format CompactSize Unsigned Integers Wallets Deterministic Wallet Formats Type 1: Single Chain Wallets Type 2: Hierarchical Deterministic (HD) Wallets P2P Network Constants And Defaults Protocol Versions Data Messages Block GetBlocks GetData Inv MemPool MerkleBlock NotFound Tx Control Messages Addr Alert FeeFilter FilterAdd FilterClear FilterLoad GetAddr Ping Pong Reject VerAck Version Bitcoin Core APIs Hash Byte Order Quick Reference RPCs AbandonTransaction AddMultiSigAddress AddNode AddWitnessAddress BackupWallet BumpFee ClearBanned CreateMultiSig CreateRawTransaction DecodeRawTransaction DecodeScript DisconnectNode DumpPrivKey DumpWallet EncryptWallet EstimateFee EstimatePriority FundRawTransaction Generate GenerateToAddress GetAccountAddress GetAccount GetAddedNodeInfo GetAddressesByAccount GetBalance GetBestBlockHash GetBlock GetBlockChainInfo GetBlockCount GetBlockHash GetBlockTemplate GetChainTips GetConnectionCount GetDifficulty GetGenerate GetHashesPerSec GetInfo GetMemoryInfo GetMemPoolAncestors GetMemPoolDescendants GetMemPoolEntry GetMemPoolInfo GetMiningInfo GetNetTotals GetNetworkHashPS GetNetworkInfo GetNewAddress GetPeerInfo GetRawChangeAddress GetRawMemPool GetRawTransaction GetReceivedByAccount GetReceivedByAddress GetTransaction GetTxOut GetTxOutProof GetTxOutSetInfo GetUnconfirmedBalance GetWalletInfo GetWork Help ImportAddress ImportMulti ImportPrivKey ImportPrunedFunds ImportWallet KeyPoolRefill ListAccounts ListAddressGroupings ListBanned ListLockUnspent ListReceivedByAccount ListReceivedByAddress ListSinceBlock ListTransactions ListUnspent LockUnspent Move Ping PreciousBlock PrioritiseTransaction PruneBlockChain RemovePrunedFunds SendFrom SendMany SendRawTransaction SendToAddress SetAccount SetBan SetGenerate SetNetworkActive SetTxFee SignMessage SignMessageWithPrivKey SignRawTransaction Stop SubmitBlock ValidateAddress VerifyChain VerifyMessage VerifyTxOutProof WalletLock WalletPassphrase WalletPassphraseChange HTTP REST Quick Reference Requests GET Block GET Block/NoTxDetails GET ChainInfo GET GetUtxos GET MemPool/Contents GET MemPool/Info GET Tx Return To Overview Report An Issue BETA: This documentation has not been extensively reviewed by Bitcoin experts and so likely contains numerous errors.
tpp bitcoin

Please use the Issue and Edit links on the bottom left menu to help us improve.Click here to close this disclaimer.X The Developer Reference aims to provide technical details and API information to help you start building Bitcoin-based applications, but it is not a specification.
bitcoin wert zukunftTo make the best use of this documentation, you may want to install the current version of Bitcoin Core, either from source or from a pre-compiled executable.
litecoin rankingQuestions about Bitcoin development are best asked in one of the Bitcoin development communities.
litecoin efficient miningErrors or suggestions related to can be submitted as an issue or posted to the bitcoin-documentation mailing list.In the following documentation, some strings have been shortened or wrapped: “[…]” indicates extra data was removed, and lines ending in a single backslash “\” are continued below.

If you hover your mouse over a paragraph, cross-reference links will be shown in blue.If you hover over a cross-reference link, a brief definition of the term will be displayed in a tooltip. Developer Documentation describes how Bitcoin works to help educate new Bitcoin developers, but it is not a specification—and it never will be.Bitcoin security depends on consensus.Should your program diverge from consensus, its security is weakened or destroyed.The cause of the divergence doesn’t matter: it could be a bug in your program, it could be an error in this documentation which you implemented as described, or it could be you do everything right but other software on the network behaves unexpectedly.The specific cause will not matter to the users of your software whose wealth is lost.The only correct specification of consensus behavior is the actual behavior of programs on the network which maintain consensus.As that behavior is subject to arbitrary inputs in a large variety of unique environments, it cannot ever be fully documented here or anywhere else.

However, the Bitcoin Core developers are working on making their consensus code portable so other implementations can use it.Bitcoin Core 0.10.0 will provide libbitcoinconsensus, a first attempt at exporting some consensus code.Future versions of Bitcoin Core will likely provide consensus code that is more complete, more portable, and more consistent in diverse environments.In addition, we also warn you that this documentation has not been extensively reviewed by Bitcoin experts and so likely contains numerous errors.At the bottom of the menu on the left, you will find links that allow you to report an issue or to edit the documentation on GitHub.Please use those links if you find any errors or important missing information.The following subsections briefly document core block details.Block headers are serialized in the 80-byte format described below and then hashed as part of Bitcoin’s proof-of-work algorithm, making the serialized header format part of the consensus rules.

The hashes are in internal byte order; the other values are all in little-endian order.An example header in hex: The mechanism used for the version 2, 3, and 4 upgrades is commonly called IsSuperMajority() after the function added to Bitcoin Core to manage those soft forking changes.See BIP34 for a full description of this method.As of this writing, a newer method called version bits is being designed to manage future soft forking changes, although it’s not known whether version 4 will be the last soft fork to use the IsSuperMajority() function.Draft BIP9 describes the version bits design as of this writing, although it is still being actively edited and may substantially change while in the draft state.The merkle root is constructed using all the TXIDs of transactions in this block, but first the TXIDs are placed in order as required by the consensus rules: The coinbase transaction’s TXID is always placed first.Any input within this block can spend an output which also appears in this block (assuming the spend is otherwise valid).

However, the TXID corresponding to the output must be placed at some point before the TXID corresponding to the input.This ensures that any program parsing block chain transactions linearly will encounter each output before it is used as an input.If a block only has a coinbase transaction, the coinbase TXID is used as the merkle root hash.If a block only has a coinbase transaction and one other transaction, the TXIDs of those two transactions are placed in order, concatenated as 64 raw bytes, and then SHA256(SHA256()) hashed together to form the merkle root.If a block has three or more transactions, intermediate merkle tree rows are formed.The TXIDs are placed in order and paired, starting with the coinbase transaction’s TXID.Each pair is concatenated together as 64 raw bytes and SHA256(SHA256()) hashed to form a second row of hashes.If there are an odd (non-even) number of TXIDs, the last TXID is concatenated with a copy of itself and hashed.

If there are more than two hashes in the second row, the process is repeated to create a third row (and, if necessary, repeated further to create additional rows).Once a row is obtained with only two hashes, those hashes are concatenated and hashed to produce the merkle root.TXIDs and intermediate hashes are always in internal byte order when they’re concatenated, and the resulting merkle root is also in internal byte order when it’s placed in the block header.The target threshold is a 256-bit unsigned integer which a header hash must be equal to or below in order for that header to be a valid part of the block chain.However, the header field nBits provides only 32 bits of space, so the target number uses a less precise format called “compact” which works like a base-256 version of scientific notation: As a base-256 number, nBits can be quickly parsed as bytes the same way you might parse a decimal number in base-10 scientific notation: Although the target threshold should be an unsigned integer, the original nBits implementation inherits properties from a signed data class, allowing the target threshold to be negative if the high bit of the significand is set.

This is useless—the header hash is treated as an unsigned number, so it can never be equal to or lower than a negative target threshold.Bitcoin Core deals with this in two ways: When parsing nBits, Bitcoin Core converts a negative target threshold into a target of zero, which the header hash can equal (in theory, at least).When creating a value for nBits, Bitcoin Core checks to see if it will produce an nBits which will be interpreted as negative; if so, it divides the significand by 256 and increases the exponent by 1 to produce the same number with a different encoding.Some examples taken from the Bitcoin Core test cases: Difficulty 1, the minimum allowed difficulty, is represented on mainnet and the current testnet by the nBits value 0x1d00ffff.Regtest mode uses a different difficulty 1 value—0x207fffff, the highest possible value below uint32_max which can be encoded; this allows near-instant building of blocks in regtest mode.

Under current consensus rules, a block is not valid unless its serialized size is less than or equal to 1 MB.All fields described below are counted towards the serialized size.The first transaction in a block must be a coinbase transaction which should collect and spend any transaction fees paid by transactions included in this block.All blocks with a block height less than 6,930,000 are entitled to receive a block subsidy of newly created bitcoin value, which also should be spent in the coinbase transaction.(The block subsidy started at 50 bitcoins and is being halved every 210,000 blocks—approximately once every four years.As of November 2014, it’s 25 bitcoins.)Together, the transaction fees and block subsidy are called the block reward.A coinbase transaction is invalid if it tries to spend more value than is available from the block reward.The following subsections briefly document core transaction details.The opcodes used in the pubkey scripts of standard transactions are: A complete list of opcodes can be found on the Bitcoin Wiki Script Page, with an authoritative list in the opcodetype enum of the Bitcoin Core script header file Signature script modification warning: Signature scripts are not signed, so anyone can modify them.

This means signature scripts should only contain data and data-pushing opcodes which can’t be modified without causing the pubkey script to fail.Placing non-data-pushing opcodes in the signature script currently makes a transaction non-standard, and future consensus rules may forbid such transactions altogether.(Non-data-pushing opcodes are already forbidden in signature scripts when spending a P2SH pubkey script.)OP_CHECKMULTISIG warning: The multisig verification process described above requires that signatures in the signature script be provided in the same order as their corresponding public keys in the pubkey script or redeem script.For example, the following combined signature and pubkey script will produce the stack and comparisons shown: But reversing the order of the signatures with everything else the same will fail, as shown below: The hashes used in P2PKH and P2SH outputs are commonly encoded as Bitcoin addresses.

This is the procedure to encode those hashes and decode the addresses.First, get your hash.For P2PKH, you RIPEMD-160(SHA256()) hash a ECDSA public key derived from your 256-bit ECDSA private key (random data).For P2SH, you RIPEMD-160(SHA256()) hash a redeem script serialized in the format used in raw transactions (described in a following sub-section).Taking the resulting hash: Add an address version byte in front of the hash.The version bytes commonly used by Bitcoin are: 0x00 for P2PKH addresses on the main Bitcoin network (mainnet) 0x6f for P2PKH addresses on the Bitcoin testing network (testnet) 0x05 for P2SH addresses on mainnet 0xc4 for P2SH addresses on testnet Create a copy of the version and hash; then hash that twice with SHA256: SHA256(SHA256(version .hash)) Extract the first four bytes from the double-hashed copy.These are used as a checksum to ensure the base hash gets transmitted correctly.Append the checksum to the version and hash, and encode it as a base58 string: BASE58(version .

checksum) Bitcoin’s base58 encoding, called Base58Check may not match other implementations.Tier Nolan provided the following example encoding algorithm to the Bitcoin Wiki Base58Check encoding page under the Creative Commons Attribution 3.0 license: Bitcoin’s own code can be traced using the base58 header file.To convert addresses back into hashes, reverse the base58 encoding, extract the checksum, repeat the steps to create the checksum and compare it against the extracted checksum, and then remove the version byte.Bitcoin transactions are broadcast between peers in a serialized byte format, called raw format.It is this form of a transaction which is SHA256(SHA256()) hashed to create the TXID and, ultimately, the merkle root of a block containing the transaction—making the transaction format part of the consensus rules.Bitcoin Core and many other tools print and accept raw transactions encoded as hex.As of Bitcoin Core 0.9.3 (October 2014), all transactions use the version 1 format described below.

(Note: transactions in the block chain are allowed to list a higher version number to permit soft forks, but they are treated as version 1 transactions by current software.)A raw transaction has the following top-level format: A transaction may have multiple inputs and outputs, so the txIn and txOut structures may recur within a transaction.CompactSize unsigned integers are a form of variable-length integers; they are described in the CompactSize section.Each non-coinbase input spends an outpoint from a previous transaction.(Coinbase inputs are described separately after the example section below.)Because a single transaction can include multiple outputs, the outpoint structure includes both a TXID and an output index number to refer to specific output.Each output spends a certain number of satoshis, placing them under control of anyone who can satisfy the provided pubkey script.The sample raw transaction itemized below is the one created in the Simple Raw Transaction section of the Developer Examples.

It spends a previous pay-to-pubkey output by paying to a new pay-to-pubkey-hash (P2PKH) output.The first transaction in a block, called the coinbase transaction, must have exactly one input, called a coinbase.The coinbase input currently has the following format.Most (but not all) blocks prior to block height 227,836 used block version 1 which did not require the height parameter to be prefixed to the coinbase script.The block height parameter is now required.Although the coinbase script is arbitrary data, if it includes the bytes used by any signature-checking operations such as OP_CHECKSIG, those signature checks will be counted as signature operations (sigops) towards the block’s sigop limit.To avoid this, you can prefix all data with the appropriate push operation.The raw transaction format and several peer-to-peer network messages use a type of variable-length integer to indicate the number of bytes in a following piece of data.

Bitcoin Core code and this document refers to these variable length integers as compactSize.Many other documents refer to them as var_int or varInt, but this risks conflation with other variable-length integer encodings—such as the CVarInt class used in Bitcoin Core for serializing data to disk.Because it’s used in the transaction format, the format of compactSize unsigned integers is part of the consensus rules.For numbers from 0 to 252, compactSize unsigned integers look like regular unsigned integers.For other numbers up to 0xffffffffffffffff, a byte is prefixed to the number to indicate its length—but otherwise the numbers look like regular unsigned integers in little-endian order.For example, the number 515 is encoded as 0xfd0302.Type 1 deterministic wallets are the simpler of the two, which can create a single series of keys from a single seed.A primary weakness is that if the seed is leaked, all funds are compromised, and wallet sharing is extremely limited.

For an overview of HD wallets, please see the developer guide section.For details, please see BIP32.This section describes the Bitcoin P2P network protocol (but it is not a specification).It does not describe the discontinued direct IP-to-IP payment protocol, the BIP70 payment protocol, the GetBlockTemplate mining protocol, or any network protocol never implemented in an official version of Bitcoin Core.All peer-to-peer communication occurs entirely over TCP.Note: unless their description says otherwise, all multi-byte integers mentioned in this section are transmitted in little-endian order.The following constants and defaults are taken from Bitcoin Core’s chainparams.cpp source code file.Note: the testnet start string and nBits above are for testnet3; the original testnet used a different string and higher (less difficult) nBits.Command line parameters can change what port a node listens on (see -help).Start strings are hardcoded constants that appear at the start of all messages sent on the Bitcoin network; they may also appear in data files such as Bitcoin Core’s block database.

The nBits displayed above are in big-endian order; they’re sent over the network in little-endian order.Bitcoin Core’s chainparams.cpp also includes other constants useful to programs, such as the hash of the genesis blocks for the different networks.The table below lists some notable versions of the P2P network protocol, with the most recent versions listed first.(If you know of a protocol version that implemented a major change but which is not listed here, please open an issue.)As of Bitcoin Core 0.14.1, the most recent protocol version is 70015.All messages in the network protocol use the same container format, which provides a required multi-field message header and an optional payload.The message header format is: The following example is an annotated hex dump of a mainnet message header from a verack message which has no payload.The following network messages all request or provide data related to transactions and blocks.

Many of the data messages use inventories as unique identifiers for transactions and blocks.Inventories have a simple 36-byte structure: The currently-available type identifiers are: Type identifier zero and type identifiers greater than three are reserved for future implementations.Bitcoin Core ignores all inventories with one of these unknown types.The block message transmits a single serialized block in the format described in the serialized blocks section.See that section for an example hexdump.It can be sent for two different reasons: GetData Response: Nodes will always send it in response to a getdata message that requests the block with an inventory type of MSG_BLOCK (provided the node has that block available for relay).Unsolicited: Some miners will send unsolicited block messages broadcasting their newly-mined blocks to all of their peers.Many mining pools do the same thing, although some may be misconfigured to send the block from multiple nodes, possibly sending the same block to some peers more than once.

The getblocks message requests an inv message that provides block header hashes starting from a particular point in the block chain.It allows a peer which has been disconnected or started for the first time to get the data it needs to request the blocks it hasn’t seen.Peers which have been disconnected may have stale blocks in their locally-stored block chain, so the getblocks message allows the requesting peer to provide the receiving peer with multiple header hashes at various heights on their local chain.This allows the receiving peer to find, within that list, the last header hash they had in common and reply with all subsequent header hashes.Note: the receiving peer itself may respond with an inv message containing header hashes of stale blocks.It is up to the requesting peer to poll all of its peers to find the best block chain.If the receiving peer does not find a common header hash within the list, it will assume the last common block was the genesis block (block zero), so it will reply with in inv message containing header hashes starting with block one (the first block after the genesis block).

The following annotated hexdump shows a getblocks message.(The message header has been omitted.)The getdata message requests one or more data objects from another node.The objects are requested by an inventory, which the requesting node typically previously received by way of an inv message.The response to a getdata message can be a tx message, block message, merkleblock message, or notfound message.This message cannot be used to request arbitrary data, such as historic transactions no longer in the memory pool or relay set.Full nodes may not even be able to provide older blocks if they’ve pruned old transactions from their block database.For this reason, the getdata message should usually only be used to request data from a node which previously advertised it had that data by sending an inv message.The format and maximum size limitations of the getdata message are identical to the inv message; only the message header differs.Added in protocol version 31800.

The getheaders message requests a headers message that provides block headers starting from a particular point in the block chain.It allows a peer which has been disconnected or started for the first time to get the headers it hasn’t seen yet.The getheaders message is nearly identical to the getblocks message, with one minor difference: the inv reply to the getblocks message will include no more than 500 block header hashes; the headers reply to the getheaders message will include as many as 2,000 block headers.The headers message sends block headers to a node which previously requested certain headers with a getheaders message.A headers message can be empty.The following annotated hexdump shows a headers message.(The message header has been omitted.)The inv message (inventory message) transmits one or more inventories of objects known to the transmitting peer.It can be sent unsolicited to announce new transactions or blocks, or it can be sent in reply to a getblocks message or mempool message.

The receiving peer can compare the inventories from an inv message against the inventories it has already seen, and then use a follow-up message to request unseen objects.The following annotated hexdump shows an inv message with two inventory entries.(The message header has been omitted.)Added in protocol version 60002.The mempool message requests the TXIDs of transactions that the receiving node has verified as valid but which have not yet appeared in a block.That is, transactions which are in the receiving node’s memory pool.The response to the mempool message is one or more inv messages containing the TXIDs in the usual inventory format.Sending the mempool message is mostly useful when a program first connects to the network.Full nodes can use it to quickly gather most or all of the unconfirmed transactions available on the network; this is especially useful for miners trying to gather transactions for their transaction fees.SPV clients can set a filter before sending a mempool to only receive transactions that match that filter; this allows a recently-started client to get most or all unconfirmed transactions related to its wallet.

The inv response to the mempool message is, at best, one node’s view of the network—not a complete list of unconfirmed transactions on the network.Here are some additional reasons the list might not be complete: Before Bitcoin Core 0.9.0, the response to the mempool message was only one inv message.An inv message is limited to 50,000 inventories, so a node with a memory pool larger than 50,000 entries would not send everything.Later versions of Bitcoin Core send as many inv messages as needed to reference its complete memory pool.The mempool message is not currently fully compatible with the filterload message’s BLOOM_UPDATE_ALL and BLOOM_UPDATE_P2PUBKEY_ONLY flags.Mempool transactions are not sorted like in-block transactions, so a transaction (tx2) spending an output can appear before the transaction (tx1) containing that output, which means the automatic filter update mechanism won’t operate until the second-appearing transaction (tx1) is seen—missing the first-appearing transaction (tx2).

It has been proposed in Bitcoin Core issue #2381 that the transactions should be sorted before being processed by the filter.There is no payload in a mempool message.See the message header section for an example of a message without a payload.Added in protocol version 70001 as described by BIP37.The merkleblock message is a reply to a getdata message which requested a block using the inventory type MSG_MERKLEBLOCK.It is only part of the reply: if any matching transactions are found, they will be sent separately as tx messages.If a filter has been previously set with the filterload message, the merkleblock message will contain the TXIDs of any transactions in the requested block that matched the filter, as well as any parts of the block’s merkle tree necessary to connect those transactions to the block header’s merkle root.The message also contains a complete copy of the block header to allow the client to hash it and confirm its proof of work.

The annotated hexdump below shows a merkleblock message which corresponds to the examples below.(The message header has been omitted.)Note: when fully decoded, the above merkleblock message provided the TXID for a single transaction that matched the filter.In the network traffic dump this output was taken from, the full transaction belonging to that TXID was sent immediately after the merkleblock message as a tx message.As seen in the annotated hexdump above, the merkleblock message provides three special data types: a transaction count, a list of hashes, and a list of one-bit flags.You can use the transaction count to construct an empty merkle tree.We’ll call each entry in the tree a node; on the bottom are TXID nodes—the hashes for these nodes are TXIDs; the remaining nodes (including the merkle root) are non-TXID nodes—they may actually have the same hash as a TXID, but we treat them differently.Keep the hashes and flags in the order they appear in the merkleblock message.

When we say “next flag” or “next hash”, we mean the next flag or hash on the list, even if it’s the first one we’ve used so far.Start with the merkle root node and the first flag.The table below describes how to evaluate a flag based on whether the node being processed is a TXID node or a non-TXID node.Once you apply a flag to a node, never apply another flag to that same node or reuse that same flag again.Any time you begin processing a node for the first time, evaluate the next flag.Never use a flag at any other time.When processing a child node, you may need to process its children (the grandchildren of the original node) or further-descended nodes before returning to the parent node.This is expected—keep processing depth first until you reach a TXID node or a non-TXID node with a flag of 0.After you process a TXID node or a non-TXID node with a flag of 0, stop processing flags and begin to ascend the tree.As you ascend, compute the hash of any nodes for which you now have both child hashes or for which you now have the sole child hash.

See the merkle tree section for hashing instructions.If you reach a node where only the left hash is known, descend into its right child (if present) and further descendants as necessary.However, if you find a node whose left and right children both have the same hash, fail.This is related to CVE-2012-2459.Continue descending and ascending until you have enough information to obtain the hash of the merkle root node.If you run out of flags or hashes before that condition is reached, fail.Then perform the following checks (order doesn’t matter): Fail if there are unused hashes in the hashes list.Fail if there are unused flag bits—except for the minimum number of bits necessary to pad up to the next full byte.Fail if the hash of the merkle root node is not identical to the merkle root in the block header.Fail if the block header is invalid.Remember to ensure that the hash of the header is less than or equal to the target threshold encoded by the nBits header field.

Your program should also, of course, attempt to ensure the header belongs to the best block chain and that the user knows how many confirmations this block has.For a detailed example of parsing a merkleblock message, please see the corresponding merkle block examples section.It’s easier to understand how to create a merkleblock message after you understand how to parse an already-created message, so we recommend you read the parsing section above first.Create a complete merkle tree with TXIDs on the bottom row and all the other hashes calculated up to the merkle root on the top row.For each transaction that matches the filter, track its TXID node and all of its ancestor nodes.Start processing the tree with the merkle root node.The table below describes how to process both TXID nodes and non-TXID nodes based on whether the node is a match, a match ancestor, or neither a match nor a match ancestor.Any time you begin processing a node for the first time, a flag should be appended to the flag list.

Never put a flag on the list at any other time, except when processing is complete to pad out the flag list to a byte boundary.This is expected—keep processing depth first until you reach a TXID node or a node which is neither a TXID nor a match ancestor.After you process a TXID node or a node which is neither a TXID nor a match ancestor, stop processing and begin to ascend the tree until you find a node with a right child you haven’t processed yet.Descend into that right child and process it.After you fully process the merkle root node according to the instructions in the table above, processing is complete.Pad your flag list to a byte boundary and construct the merkleblock message using the template near the beginning of this subsection.Added in protocol version 70001.The notfound message is a reply to a getdata message which requested an object the receiving node does not have available for relay.(Nodes are not expected to relay historic transactions which are no longer in the memory pool or relay set.

Nodes may also have pruned spent transactions from older blocks, making them unable to send those blocks.)The format and maximum size limitations of the notfound message are identical to the inv message; only the message header differs.The tx message transmits a single transaction in the raw transaction format.It can be sent in a variety of situations; Transaction Response: Bitcoin Core and BitcoinJ will send it in response to a getdata message that requests the transaction with an inventory type of MSG_TX.MerkleBlock Response: Bitcoin Core will send it in response to a getdata message that requests a merkle block with an inventory type of MSG_MERKLEBLOCK.(This is in addition to sending a merkleblock message.)Each tx message in this case provides a matched transaction from that block.Unsolicited: BitcoinJ will send a tx message unsolicited for transactions it originates.For an example hexdump of the raw transaction format, see the raw transaction section.

The following network messages all help control the connection between two peers or allow them to advise each other about the rest of the network.Note that almost none of the control messages are authenticated in any way, meaning they can contain incorrect or intentionally harmful information.In addition, this section does not yet cover P2P protocol operation over the Tor network; if you would like to contribute information about Tor, please open an issue.The addr (IP address) message relays connection information for peers on the network.Each peer which wants to accept incoming connections creates an addr message providing its connection information and then sends that message to its peers unsolicited.Some of its peers send that information to their peers (also unsolicited), some of which further distribute it, allowing decentralized peer discovery for any program already on the network.An addr message may also be sent in response to a getaddr message.

Each encapsulated network IP address currently uses the following structure: The following annotated hexdump shows part of an addr message.(The message header has been omitted and the actual IP address has been replaced with a RFC5737 reserved IP address.)Added in protocol version 311.Removed in protocol version 70013 and released in Bitcoin Core 0.13.0 The legacy p2p network alert messaging system has been retired; however, internal alerts, partition detection warnings and the -alertnotify option features remain.See Alert System Retirement for details.Added in protocol version 70013 as described by BIP133.The feefilter message is a request to the receiving peer to not relay any transaction inv messages to the sending peer where the fee rate for the transaction is below the fee rate specified in the feefilter message.feefilter was introduced in Bitcoin Core 0.13.0 following the introduction of mempool limiting in Bitcoin Core 0.12.0.Mempool limiting provides protection against attacks and spam transactions that have low fee rates and are unlikely to be included in mined blocks.

The feefilter messages allows a node to inform its peers that it will not accept transactions below a specified fee rate into its mempool, and therefore that the peers can skip relaying inv messages for transactions below that fee rate to that node.The receiving peer may choose to ignore the message and not filter transaction inv messages.The fee filter is additive with bloom filters.If an SPV client loads a bloom filter and sends a feefilter message, transactions should only be relayed if they pass both filters.Note however that feefilter has no effect on block propagation or responses to getdata messages.For example, if a node requests a merkleblock from its peer by sending a getdata message with inv type MSG_FILTERED_BLOCK and it has previously sent a feefilter to that peer, the peer should respond with a merkleblock containing all the transactions matching the bloom filter, even if they are below the feefilter fee rate.inv messages generated from a mempool message are subject to a fee filter if it exists.

The annotated hexdump below shows a feefilter message.The filteradd message tells the receiving peer to add a single element to a previously-set bloom filter, such as a new public key.The element is sent directly to the receiving peer; the peer then uses the parameters set in the filterload message to add the element to the bloom filter.Because the element is sent directly to the receiving peer, there is no obfuscation of the element and none of the plausible-deniability privacy provided by the bloom filter.Clients that want to maintain greater privacy should recalculate the bloom filter themselves and send a new filterload message with the recalculated bloom filter.Note: a filteradd message will not be accepted unless a filter was previously set with the filterload message.The annotated hexdump below shows a filteradd message adding a TXID.This TXID appears in the same block used for the example hexdump in the merkleblock message; if that merkleblock message is re-sent after sending this filteradd message, six hashes are returned instead of four.

The filterclear message tells the receiving peer to remove a previously-set bloom filter.This also undoes the effect of setting the relay field in the version message to 0, allowing unfiltered access to inv messages announcing new transactions.Bitcoin Core does not require a filterclear message before a replacement filter is loaded with filterload.It also doesn’t require a filterload message before a filterclear message.There is no payload in a filterclear message.The filterload message tells the receiving peer to filter all relayed transactions and requested merkle blocks through the provided filter.This allows clients to receive transactions relevant to their wallet plus a configurable rate of false positive transactions which can provide plausible-deniability privacy.The annotated hexdump below shows a filterload message.For an example of how this payload was created, see the filterload example.Filters have two core parameters: the size of the bit field and the number of hash functions to run against each data element.

The following formulas from BIP37 will allow you to automatically select appropriate values based on the number of elements you plan to insert into the filter (n) and the false positive rate (p) you desire to maintain plausible deniability.Size of the bit field in bytes (nFilterBytes), up to a maximum of 36,000: (-1 / log(2)**2 * n * log(p)) / 8 Hash functions to use (nHashFuncs), up to a maximum of 50: nFilterBytes * 8 / n * log(2) Note that the filter matches parts of transactions (transaction elements), so the false positive rate is relative to the number of elements checked—not the number of transactions checked.Each normal transaction has a minimum of four matchable elements (described in the comparison subsection below), so a filter with a false-positive rate of 1 percent will match about 4 percent of all transactions at a minimum.According to BIP37, the formulas and limits described above provide support for bloom filters containing 20,000 items with a false positive rate of less than 0.1 percent or 10,000 items with a false positive rate of less than 0.0001 percent.

Once the size of the bit field is known, the bit field should be initialized as all zeroes.The bloom filter is populated using between 1 and 50 unique hash functions (the number specified per filter by the nHashFuncs field).Instead of using up to 50 different hash function implementations, a single implementation is used with a unique seed value for each function.The seed is nHashNum * 0xfba4c795 + nTweak as a uint32_t, where the values are: nHashNum is the sequence number for this hash function, starting at 0 for the first hash iteration and increasing up to the value of the nHashFuncs field (minus one) for the last hash iteration.0xfba4c795 is a constant optimized to create large differences in the seed for different values of nHashNum.nTweak is a per-filter constant set by the client to require the use of an arbitrary set of hash functions.If the seed resulting from the formula above is larger than four bytes, it must be truncated to its four most significant bytes (for example, 0x8967452301 & 0xffffffff → 0x67452301).

The actual hash function implementation used is the 32-bit Murmur3 hash function.Warning: the Murmur3 hash function has separate 32-bit and 64-bit versions that produce different results for the same input.Only the 32-bit Murmur3 version is used with Bitcoin bloom filters.The data to be hashed can be any transaction element which the bloom filter can match.See the next subsection for the list of transaction elements checked against the filter.The largest element which can be matched is a script data push of 520 bytes, so the data should never exceed 520 bytes.The example below from Bitcoin Core bloom.cpp combines all the steps above to create the hash function template.The seed is the first parameter; the data to be hashed is the second parameter.The result is a uint32_t modulo the size of the bit field in bits.Each data element to be added to the filter is hashed by nHashFuncs number of hash functions.Each time a hash function is run, the result will be the index number (nIndex) of a bit in the bit field.

That bit must be set to 1.For example if the filter bit field was 00000000 and the result is 5, the revised filter bit field is 00000100 (the first bit is bit 0).It is expected that sometimes the same index number will be returned more than once when populating the bit field; this does not affect the algorithm—after a bit is set to 1, it is never changed back to 0.After all data elements have been added to the filter, each set of eight bits is converted into a little-endian byte.These bytes are the value of the filter field.Comparing Transaction Elements To A Bloom Filter To compare an arbitrary data element against the bloom filter, it is hashed using the same parameters used to create the bloom filter.Specifically, it is hashed nHashFuncs times, each time using the same nTweak provided in the filter, and the resulting output is modulo the size of the bit field provided in the filter field.After each hash is performed, the filter is checked to see if the bit at that indexed location is set.

For example if the result of a hash is 5 and the filter is 01001110, the bit is considered set.If the result of every hash points to a set bit, the filter matches.If any of the results points to an unset bit, the filter does not match.The following transaction elements are compared against bloom filters.All elements will be hashed in the byte order used in blocks (for example, TXIDs will be in internal byte order).TXIDs: the transaction’s SHA256(SHA256()) hash.Outpoints: each 36-byte outpoint used this transaction’s input section is individually compared to the filter.Signature Script Data: each element pushed onto the stack by a data-pushing opcode in a signature script from this transaction is individually compared to the filter.This includes data elements present in P2SH redeem scripts when they are being spent.PubKey Script Data: each element pushed onto the the stack by a data-pushing opcode in any pubkey script from this transaction is individually compared to the filter.

(If a pubkey script element matches the filter, the filter will be immediately updated if the BLOOM_UPDATE_ALL flag was set; if the pubkey script is in the P2PKH format and matches the filter, the filter will be immediately updated if the BLOOM_UPDATE_P2PUBKEY_ONLY flag was set.See the subsection below for details.)The following annotated hexdump of a transaction is from the raw transaction format section; the elements which would be checked by the filter are emphasized in bold.Note that this transaction’s TXID (01000000017b1eab[...]) would also be checked, and that the outpoint TXID and index number below would be checked as a single 36-byte element.Clients will often want to track inputs that spend outputs (outpoints) relevant to their wallet, so the filterload field nFlags can be set to allow the filtering node to update the filter when a match is found.When the filtering node sees a pubkey script that pays a pubkey, address, or other data element matching the filter, the filtering node immediately updates the filter with the outpoint corresponding to that pubkey script.

If an input later spends that outpoint, the filter will match it, allowing the filtering node to tell the client that one of its transaction outputs has been spent.The nFlags field has three allowed values: In addition, because the filter size stays the same even though additional elements are being added to it, the false positive rate increases.Each false positive can result in another element being added to the filter, creating a feedback loop that can (after a certain point) make the filter useless.For this reason, clients using automatic filter updates need to monitor the actual false positive rate and send a new filter when the rate gets too high.The getaddr message requests an addr message from the receiving node, preferably one with lots of IP addresses of other receiving nodes.The transmitting node can use those IP addresses to quickly update its database of available nodes rather than waiting for unsolicited addr messages to arrive over time.

There is no payload in a getaddr message.The ping message helps confirm that the receiving peer is still connected.If a TCP/IP error is encountered when sending the ping message (such as a connection timeout), the transmitting node can assume that the receiving node is disconnected.The response to a ping message is the pong message.Before protocol version 60000, the ping message had no payload.As of protocol version 60001 and all later versions, the message includes a single field, the nonce.The annotated hexdump below shows a ping message.Added in protocol version 60001 as described by BIP31.The pong message replies to a ping message, proving to the pinging node that the ponging node is still alive.Bitcoin Core will, by default, disconnect from any clients which have not responded to a ping message within 20 minutes.To allow nodes to keep track of latency, the pong message sends back the same nonce received in the ping message it is replying to.

The format of the pong message is identical to the ping message; only the message header differs.Added in protocol version 70002 as described by BIP61.The reject message informs the receiving node that one of its previous messages has been rejected.The following table lists message reject codes.Codes are tied to the type of message they reply to; for example there is a 0x10 reject code for transactions and a 0x10 reject code for blocks.The annotated hexdump below shows a reject message.The sendheaders message tells the receiving peer to send new block announcements using a headers message rather than an inv message.There is no payload in a sendheaders message.The verack message acknowledges a previously-received version message, informing the connecting node that it can begin to send other messages.The verack message has no payload; for an example of a message with no payload, see the message headers section.The version message provides information about the transmitting node to the receiving node at the beginning of a connection.

Until both peers have exchanged version messages, no other messages will be accepted.If a version message is accepted, the receiving node should send a verack message—but no node should send a verack message before initializing its half of the connection by first sending a version message.The following service identifiers have been assigned.The following annotated hexdump shows a version message.(The message header has been omitted and the actual IP addresses have been replaced with RFC5737 reserved IP addresses.)Bitcoin Core RPCs accept and return the byte-wise reverse of computed SHA-256 hash values.For example, the Unix sha256sum command displays the SHA256(SHA256()) hash of mainnet block 300,000’s header as: > /bin/echo -n '020000007ef055e1674d2e6551dba41cd214debbee34aeb544c7ec670000000000000000d3998963f80c5bab43fe8c26228e98d030edf4dcbe48a666f5c39e2d7a885c9102c86d536c890019593a470d' | xxd -r -p | sha256sum -b | xxd -r -p | sha256sum -b 5472ac8b1187bfcf91d6d218bbda1eb2405d7c55f1f8cc820000000000000000 The result above is also how the hash appears in the previous-header-hash part of block 300,001’s header: However, Bitcoin Core’s RPCs use the byte-wise reverse for hashes, so if you want to get information about block 300,000 using the getblock RPC, you need to reverse the requested hash: > bitcoin-cli getblock \ 000000000000000082ccf8f1557c5d40b21edabb18d2d691cfbf87118bac7254 (Note: hex representation uses two characters to display each byte of data, which is why the reversed string looks somewhat mangled.)

The rationale for the reversal is unknown, but it likely stems from Bitcoin Core’s use of hashes (which are byte arrays in C++) as integers for the purpose of determining whether the hash is below the network target.Whatever the reason for reversing header hashes, the reversal also extends to other hashes used in RPCs, such as TXIDs and merkle roots.As header hashes and TXIDs are widely used as global identifiers in other Bitcoin software, this reversal of hashes has become the standard way to refer to certain objects.The table below should make clear where each byte order is used.Note: RPCs which return raw results, such as getrawtransaction or the raw mode of getblock, always display hashes as they appear in blocks (internal byte order).The code below may help you check byte order by generating hashes from raw hex.Bitcoin Core provides a remote procedure call (RPC) interface for various administrative tasks, wallet operations, and queries about network and block chain data.

If you start Bitcoin Core using bitcoin-qt, the RPC interface is disabled by default.To enable it, set server=1 in bitcoin.conf or supply the -server argument when invoking the program.If you start Bitcoin Core using bitcoind, the RPC interface is enabled by default.The interface requires the user to provide a password for authenticating RPC requests.This password can be set either using the rpcpassword property in bitcoin.conf or by supplying the -rpcpassword program argument.Optionally a username can be set using the rpcuser configuration value.See the Examples Page for more information about setting Bitcoin Core configuration values.Open-source client libraries for the RPC interface are readily available in most modern programming languages, so you probably don’t need to write your own from scratch.Bitcoin Core also ships with its own compiled C++ RPC client, bitcoin-cli, located in the bin directory alongside bitcoind and bitcoin-qt.

The bitcoin-cli program can be used as a command-line interface (CLI) to Bitcoin Core or for making RPC calls from applications written in languages lacking a suitable native client.The remainder of this section describes the Bitcoin Core RPC protocol in detail.The Bitcoin Core RPC service listens for HTTP POST requests on port 8332 in mainnet mode or 18332 in testnet or regtest mode.The port number can be changed by setting rpcport in bitcoin.conf.By default the RPC service binds to your server’s localhost loopback network interface so it’s not accessible from other servers.Authentication is implemented using HTTP basic authentication.RPC HTTP requests must include a Content-Type header set to text/plain and a Content-Length header set to the size of the request body.The format of the request body and response data is based on version 1.0 of the JSON-RPC specification.Specifically, the HTTP POST data of a request must be a JSON object with the following format: In the table above and in other tables describing RPC input and output, we use the following conventions “→” indicates an argument that is the child of a JSON array or JSON object.

For example, “→ → Parameter” above means Parameter is the child of the params array which itself is a child of the Request object.Plain-text names like “Request” are unnamed in the actual JSON object Code-style names like params are literal strings that appear in the JSON object.“Type” is the JSON data type and the specific Bitcoin Core type.“Presence” indicates whether or not a field must be present within its containing array or object.Note that an optional object may still have required children.The HTTP response data for a RPC request is a JSON object with the following format: As an example, here is the JSON-RPC request object for the hash of the genesis block: The command to send this request using bitcoin-cli is: Alternatively, we could POST this request using the cURL command-line program as follows: The HTTP response data for this request would be: Note: In order to minimize its size, the raw JSON response from Bitcoin Core doesn’t include any extraneous whitespace characters.

Here we’ve added whitespace to make the object more readable.Speaking of which, bitcoin-cli also transforms the raw response to make it more human-readable.It: Continuing with the example above, the output from the bitcoin-cli command would be simply: If there’s an error processing a request, Bitcoin Core sets the result field to null and provides information about the error in the error field.For example, a request for the block hash at block height -1 would be met with the following response (again, whitespace added for clarity): If bitcoin-cli encounters an error, it exits with a non-zero status code and outputs the error field as text to the process’s standard error stream: Starting in Bitcoin Core version 0.7.0, the RPC interface supports request batching as described in version 2.0 of the JSON-RPC specification.To initiate multiple RPC requests within a single HTTP request, a client can POST a JSON array filled with Request objects.

The HTTP response data is then a JSON array filled with the corresponding Response objects.Depending on your usage pattern, request batching may provide significant performance gains.The bitcoin-cli RPC client does not support batch requests.To keep this documentation compact and readable, the examples for each of the available RPC calls will be given as bitcoin-cli commands: This translates into an JSON-RPC Request object of the form: Warning: if you write programs using the JSON-RPC interface, you must ensure they handle high-precision real numbers correctly.See the Proper Money Handling Bitcoin Wiki article for details and example code.Note: the wallet RPCs are only available if Bitcoin Core was built with wallet support, which is the default.Warning: the block chain and memory pool can include arbitrary data which several of the commands below will return in hex format.If you convert this data to another format in an executable context, it could be used in an exploit.

For example, displaying a pubkey script as ASCII text in a webpage could add arbitrary Javascript to that page and create a cross-site scripting (XSS) exploit.To avoid problems, please treat block chain and memory pool data as an arbitrary input from an untrusted source.Added in Bitcoin Core 0.12.0 The abandontransaction RPC marks an in-wallet transaction and all its in-wallet descendants as abandoned.This allows their inputs to be respent.Parameter #1—a transaction identifier (TXID) Example from Bitcoin Core 0.13.1 Abandons the transaction on your node.Result (no output from bitcoin-cli because result is set to null).The addmultisigaddress RPC adds a P2SH multisig address to the wallet.Parameter #1—the number of signatures required Parameter #2—the full public keys, or addresses for known public keys Result—a P2SH address printed and stored in the wallet Example from Bitcoin Core 0.10.0 Adding a 2-of-3 P2SH multisig address to the “test account” by mixing two P2PKH addresses and one full public key: (New P2SH multisig address also stored in wallet.)

The addnode RPC attempts to add or remove a node from the addnode list, or to try a connection to a node once.Parameter #1—hostname/IP address and port of node to add or remove Parameter #2—whether to add or remove the node, or to try only once to connect Result—null plus error on failed remove Example from Bitcoin Core 0.10.0 Try connecting to the following node.Added in Bitcoin Core 0.13.0 Requires wallet support.Requires an unlocked wallet or an unencrypted wallet.The addwitnessaddress RPC adds a witness address for a script (with pubkey or redeem script known).Example from Bitcoin Core 0.13.1 The RPC is disabled by default on mainnet as long as Segregated Witness has not been activated.-walletprematurewitness enables the RPC.The backupwallet RPC safely copies wallet.dat to the specified file, which can be a directory or a path with filename.Parameter #1—destination directory or filename Example from Bitcoin Core 0.10.0 Added in Bitcoin Core 0.14.0 Requires wallet support.

Wallet must be unlocked.The bumpfee RPC replaces an unconfirmed wallet transaction that signaled RBF with a new transaction that pays a higher fee.The increased fee is deducted from the change output.The command fails if the change output is too small to increase the fee or if the wallet or mempool contains a transaction that spends one of the transaction’s outputs.The -walletrbf option needs to be enabled (default is false).Parameter #1—The TXID of the transaction Result—information about the new transaction Example from Bitcoin Core 0.14.1 Added in Bitcoin Core 0.12.0 The clearbanned RPC clears list of banned nodes.Example from Bitcoin Core 0.13.1 Result (no output from bitcoin-cli because result is set to null).The createmultisig RPC creates a P2SH multi-signature address.Parameter #1—the number of signatures required Parameter #2—the full public keys, or addresses for known public keys Result—P2SH address and hex-encoded redeem script Example from Bitcoin Core 0.10.0 Creating a 2-of-3 P2SH multisig address by mixing two P2PKH addresses and one full public key: The createrawtransaction RPC creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address.

The transaction is not stored in the wallet or transmitted to the network.Parameter #2—P2PKH or P2SH addresses and amounts Result—the unsigned raw transaction in hex Example from Bitcoin Core 0.10.0 The decoderawtransaction RPC decodes a serialized transaction hex string into a JSON object describing the transaction.Parameter #1—serialized transaction in hex Example from Bitcoin Core 0.13.1 Decode a signed one-input, three-output transaction: The decodescript RPC decodes a hex-encoded P2SH redeem script.Parameter #1—a hex-encoded redeem script Example from Bitcoin Core 0.10.0 A 2-of-3 P2SH multisig pubkey script: Added in Bitcoin Core 0.12.0 The disconnectnode RPC immediately disconnects from a specified node.Parameter #1—hostname/IP address and port of node to disconnect Result—null on success or error on failed disconnect Example from Bitcoin Core 0.14.1 Disconnects following node from your node.Requires an unlocked wallet or an unencrypted wallet.

The dumpprivkey RPC returns the wallet-import-format (WIP) private key corresponding to an address.(But does not remove it from the wallet.)Parameter #1—the address corresponding to the private key to get Example from Bitcoin Core 0.10.0 Requires wallet support.Requires an unlocked wallet or an unencrypted wallet.The dumpwallet RPC creates or overwrites a file with all wallet keys in a human-readable format.Example from Bitcoin Core 0.10.0 Create a wallet dump and then print its first 10 lines.Results (only showing the first 10 lines): The encryptwallet RPC encrypts the wallet with a passphrase.This is only to enable encryption for the first time.After encryption is enabled, you will need to enter the passphrase to use private keys.Warning: if using this RPC on the command line, remember that your shell probably saves your command lines (including the value of the passphrase parameter).In addition, there is no RPC to completely disable encryption.

If you want to return to an unencrypted wallet, you must create a new wallet and restore your data from a backup made with the dumpwallet RPC.Result—a notice (with program shutdown) Example from Bitcoin Core 0.10.0 The estimatefee RPC estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks.Parameter #1—how many blocks the transaction may wait before being included Result—the fee the transaction needs to pay per kilobyte Examples from Bitcoin Core 0.14.1 Requesting data the node can’t calculate (out of range): Added in Bitcoin Core 0.10.0.The estimatepriority RPC estimates the priority (coin age) that a transaction needs in order to be included within a certain number of blocks as a free high-priority transaction.This should not to be confused with the prioritisetransaction RPC which will remain supported for adding fee deltas to transactions.Warning: estimatepriority has been removed and will no longer be available in the next major release (planned for Bitcoin Core 0.15.0).

Use the RPC listed in the “See Also” subsection below instead.Transaction priority is relative to a transaction’s byte size.Parameter #1—how many blocks the transaction may wait before being included as a free high-priority transaction Result—the priority a transaction needs Examples from Bitcoin Core 0.10.0 Requesting data the node can’t calculate yet: The fundrawtransaction RPC adds inputs to a transaction until it has enough in value to meet its out value.This will not modify existing inputs, and will add one change output to the outputs.Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.The inputs added will not be signed, use signrawtransaction for that.All existing inputs must have their previous output transaction be in the wallet.Parameter #1—The hex string of the raw transaction Result—information about the created transaction Example from Bitcoin Core 0.13.1 The generate RPC nearly instantly generates blocks.

Parameter #1—the number of blocks to generate Parameter #2—the maximum number of iterations to try Result—the generated block header hashes Example from Bitcoin Core 0.13.1 Using regtest mode (also works in normal mode), generate 2 blocks: Added in Bitcoin Core 0.13.0 The generatetoaddress RPC mines blocks immediately to a specified address.Parameter #1—the number of blocks to generate Parameter #2—a transaction identifier (TXID) Parameter #3—the maximum number of iterations to try Result—the generated block header hashes Example from Bitcoin Core 0.13.1 Using regtest mode, generate 2 blocks with maximal 500000 iterations: The getaccountaddress RPC returns the current Bitcoin address for receiving payments to this account.If the account doesn’t exist, it creates both the account and a new address for receiving payment.Once a payment has been received to an address, future calls to this RPC for the same account will return a different address.

Warning: getaccountaddress will be removed in a later version of Bitcoin Core.Use the RPCs listed in the See Also subsection below instead.Example from Bitcoin Core 0.10.0 Get an address for the default account: The getaccount RPC returns the name of the account associated with the given address.Example from Bitcoin Core 0.10.0 The getaddednodeinfo RPC returns information about the given added node, or all added nodes (except onetry nodes).Only nodes which have been manually added using the addnode RPC will have their information displayed.Parameter #1—whether to display connection information Parameter #2—what node to display information about Result—a list of added nodes Example from Bitcoin Core 0.14.1 Result (real hostname and IP address replaced): The getaddressesbyaccount RPC returns a list of every address assigned to a particular account.Warning: getaddressesbyaccount will be removed in a later version of Bitcoin Core.Example from Bitcoin Core 0.10.0 Get the addresses assigned to the account “doc test”: The getbalance RPC gets the balance in decimal bitcoins across all accounts or for a particular account.

Parameter #2—the minimum number of confirmations Parameter #3—whether to include watch-only addresses Examples from Bitcoin Core 0.10.0 Get the balance for the “test1” account, including transactions with at least one confirmation and those spent to watch-only addresses in that account.The getbestblockhash RPC returns the header hash of the most recent block on the best block chain.Result—hash of the tip from the best block chain Example from Bitcoin Core 0.10.0 The getblock RPC gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block.Parameter #2—whether to get JSON or hex output Result (if format was false)—a serialized block Result (if format was true or omitted)—a JSON block Example from Bitcoin Core 0.13.1 Get a block in raw hex: Get the same block in JSON: The getblockchaininfo RPC provides information about the current state of the block chain.

Result—A JSON object providing information about the block chain Example from Bitcoin Core 0.14.1 The getblockcount RPC returns the number of blocks in the local best block chain.Result—the number of blocks in the local best block chain Example from Bitcoin Core 0.10.0 The getblockhash RPC returns the header hash of a block at the given height in the local best block chain.Example from Bitcoin Core 0.10.0 Added in Bitcoin Core 0.12.0 The getblockheader RPC gets a block header with a particular header hash from the local block database either as a JSON object or as a serialized block header.Parameter #2—JSON or hex output Result (if format was false)—a serialized block header Result (if format was true or omitted)—a JSON block header Example from Bitcoin Core 0.12.1 Get a block header in raw hex: Get the same block in JSON: The getblocktemplate RPC gets a block template or proposal for use with mining software.For more information, please see the following resources: The getchaintips RPC returns information about the highest-height block (tip) of each local block chain.

Result—an array of block chain tips Example from Bitcoin Core 0.10.0 The getconnectioncount RPC returns the number of connections to other nodes.Result—the number of connections to other nodes Example from Bitcoin Core 0.10.0 Example from Bitcoin Core 0.10.0 The getgenerate RPC was removed in Bitcoin Core 0.13.0.If you have an older version of Bitcoin Core, use help getgenerate to get help.The gethashespersec RPC was removed in Bitcoin Core 0.11.0.If you have an older version of Bitcoin Core, use help gethashespersec to get help.The getinfo RPC prints various information about the node and the network.Warning: getinfo will be removed in a later version of Bitcoin Core.Result—information about the node and network Example from Bitcoin Core 0.10.0 with wallet support enabled Added in Bitcoin Core 0.14.0 The getmemoryinfo RPC returns information about memory usage.Example from Bitcoin Core 0.14.1 Added in Bitcoin Core 0.13.0 The getmempoolancestors RPC returns all in-mempool ancestors for a transaction in the mempool.

Parameter #1—a transaction identifier (TXID) Result (format: true)—a JSON object describing each transaction Examples from Bitcoin Core 0.13.1 Added in Bitcoin Core 0.13.0 The getmempooldescendants RPC returns all in-mempool descendants for a transaction in the mempool.Parameter #1—a transaction identifier (TXID) Result (format: true)—a JSON object describing each transaction Examples from Bitcoin Core 0.13.1 Added in Bitcoin Core 0.13.0 The getmempoolentry RPC returns mempool data for given transaction (must be in mempool).Parameter #1—a transaction identifier (TXID) Result —a JSON object describing the transaction Examples from Bitcoin Core 0.13.1 The getmempoolinfo RPC returns information about the node’s current transaction memory pool.Result—information about the transaction memory pool Example from Bitcoin Core 0.14.1 The getmininginfo RPC returns various mining-related information.Example from Bitcoin Core 0.14.1 The getnettotals RPC returns information about network traffic, including bytes in, bytes out, and the current time.

Result—the current bytes in, bytes out, and current time Example from Bitcoin Core 0.13.1 The getnetworkhashps RPC returns the estimated current or historical network hashes per second based on the last n blocks.Parameter #1—number of blocks to average Example from Bitcoin Core 0.10.0 Get the average hashes per second for all the blocks since the last difficulty change before block 227255.The getnetworkinfo RPC returns information about the node’s connection to the network.Result—information about the node’s connection to the network Example from Bitcoin Core 0.13.1 Result (actual addresses have been replaced with reserved addresses): The getnewaddress RPC returns a new Bitcoin address for receiving payments.If an account is specified, payments received with the address will be credited to that account.Result—a bitcoin address never previously returned Example from Bitcoin Core 0.10.0 Create a new address in the “doc test” account: The getpeerinfo RPC returns data about each connected network node.

Result—information about each currently-connected network node Example from Bitcoin Core 0.13.1 Result (edited to show only a single entry, with IP addresses changed to RFC5737 reserved IP addresses): The getrawchangeaddress RPC returns a new Bitcoin address for receiving change.This is for use with raw transactions, not normal use.Result—a P2PKH address which can be used in raw transactions Example from Bitcoin Core 0.10.0 The getrawmempool RPC returns all transaction identifiers (TXIDs) in the memory pool as a JSON array, or detailed information about each transaction in the memory pool as a JSON object.Result (format false)—an array of TXIDs Result (format: true)—a JSON object describing each transaction Examples from Bitcoin Core 0.13.1 The getrawtransaction RPC gets a hex-encoded serialized transaction or a JSON object describing the transaction.By default, Bitcoin Core only stores complete transaction data for UTXOs and your own transactions, so the RPC may fail on historic transactions unless you use the non-default txindex=1 in your Bitcoin Core startup settings.

Note: if you begin using txindex=1 after downloading the block chain, you must rebuild your indexes by starting Bitcoin Core with the option -reindex.This may take several hours to complete, during which time your node will not process new blocks or transactions.This reindex only needs to be done once.Parameter #1—the TXID of the transaction to get Parameter #2—whether to get the serialized or decoded transaction Result (if transaction not found)—null Result (if verbose=false)—the serialized transaction Result (if verbose=true)—the decoded transaction Examples from Bitcoin Core 0.14.1 A transaction in serialized transaction format: Get the same transaction in JSON: The getreceivedbyaccount RPC returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations.It does not count coinbase transactions.Warning: getreceivedbyaccount will be removed in a later version of Bitcoin Core.

Parameter #2—the minimum number of confirmations Result—the number of bitcoins received Example from Bitcoin Core 0.10.0 Get the bitcoins received by the “doc test” account with six or more confirmations: The getreceivedbyaddress RPC returns the total amount received by the specified address in transactions with the specified number of confirmations.Parameter #2—the minimum number of confirmations Result—the number of bitcoins received Example from Bitcoin Core 0.10.0 Get the bitcoins received for a particular address, only counting transactions with six or more confirmations: The gettransaction RPC gets detailed information about an in-wallet transaction.Parameter #1—a transaction identifier (TXID) Parameter #2—whether to include watch-only addresses in details and calculations Result—a description of the transaction Example from Bitcoin Core 0.13.1 The gettxout RPC returns details about a transaction output.

Only unspent transaction outputs (UTXOs) are guaranteed to be available.Parameter #1—the TXID of the output to get Parameter #2—the output index number (vout) of the output to get Parameter #3—whether to display unconfirmed outputs from the memory pool Result—a description of the output Example from Bitcoin Core 0.10.0 Get the UTXO from the following transaction from the first output index (“0”), searching the memory pool if necessary.The gettxoutproof RPC returns a hex-encoded proof that one or more specified transactions were included in a block.NOTE: By default this function only works when there is an unspent output in the UTXO set for this transaction.To make it always work, you need to maintain a transaction index, using the -txindex command line option, or specify the block in which the transaction is included in manually (by block header hash).Parameter #1—the transaction hashes to prove Parameter #2—the block to look for txids in Result—serialized, hex-encoded data for the proof Example from Bitcoin Core 0.11.0 Get the hex-encoded proof that “txid” was included in block 0000000000000000140e84bf183d8d5207d65fbfae596bdf48f684d13d951847: The gettxoutsetinfo RPC returns statistics about the confirmed unspent transaction output (UTXO) set.

Note that this call may take some time and that it only counts outputs from confirmed transactions—it does not count outputs from the memory pool.Result—statistics about the UTXO set Example from Bitcoin Core 0.10.0 The getunconfirmedbalance RPC returns the wallet’s total unconfirmed balance.Result—the balance of unconfirmed transactions paying this wallet Example from Bitcoin Core 0.10.0 Result (no unconfirmed incoming payments): The getwalletinfo RPC provides information about the wallet.Example from Bitcoin Core 0.10.0 The getwork RPC was removed in Bitcoin Core 0.10.0.If you have an older version of Bitcoin Core, use help getwork to get help.The help RPC lists all available public RPC commands, or gets help for the specified RPC.Commands which are unavailable will not be listed, such as wallet RPCs if wallet support is disabled.Parameter—the name of the RPC to get help for Result—a list of RPCs or detailed help for a specific RPC Example from Bitcoin Core 0.10.0 Command to get help about the help RPC: The importaddress RPC adds an address or pubkey script to the wallet without the associated private key, allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs.

Parameter #1—the address or pubkey script to watch Parameter #2—The account into which to place the address or pubkey script Parameter #3—whether to rescan the block chain Example from Bitcoin Core 0.10.0 Add an address, rescanning the local block database for any transactions matching it.Show that the address has been added: Added in Bitcoin Core 0.14.0 Requires wallet support.The importmulti RPC imports addresses or scripts (with private keys, public keys, or P2SH redeem scripts) and optionally performs the minimum necessary rescan for all imports.Parameter #1—the addresses/scripts to import Parameter #2—options regarding the import Example from Bitcoin Core 0.14.1 Import the address 1NL9w5fP9kX2D9ToNZPxaiwFJCngNYEYJo (giving it a label and scanning the entire block chain) and the scriptPubKey 76a9149e857da0a5b397559c78c98c9d3f7f655d19c68688ac (giving a specific timestamp and label): Result (scriptPubKey import failed because internal was not set to true): Requires wallet support.

The importprivkey RPC adds a private key to your wallet.The key should be formatted in the wallet import format created by the dumpprivkey RPC.Parameter #1—the private key to import Parameter #2—the account into which the key should be placed Parameter #3—whether to rescan the block chain Example from Bitcoin Core 0.10.0 Import the private key for the address mgnucj8nYqdrPFh2JfZSB1NmUThUGnmsqe, giving it a label and scanning the entire block chain: Added in Bitcoin Core 0.13.0 The importprunedfunds RPC imports funds without the need of a rescan.Meant for use with pruned wallets.Corresponding address or script must previously be included in wallet.The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.Parameter #1—the raw transaction to import Parameter #2—the tx out proof that cointains the transaction Example from Bitcoin Core 0.13.1 Requires wallet support.

The importwallet RPC imports private keys from a file in wallet dump file format (see the dumpwallet RPC).These keys will be added to the keys currently in the wallet.This call may need to rescan all or parts of the block chain for transactions affecting the newly-added keys, which may take several minutes.Parameter #1—the file to import Example from Bitcoin Core 0.10.0 Import the file shown in the example subsection of the dumpwallet RPC.The keypoolrefill RPC fills the cache of unused pre-generated keys (the keypool).Parameter #1—the new keypool size Example from Bitcoin Core 0.10.0 Generate one extra key than the default: The listaccounts RPC lists accounts and their balances.Warning: listaccounts will be removed in a later version of Bitcoin Core.Parameter #1—the minimum number of confirmations a transaction must have Parameter #2—whether to include watch-only addresses in results Result—a list of accounts and their balances Example from Bitcoin Core 0.10.0 Display account balances with one confirmation and watch-only addresses included.

The listaddressgroupings RPC lists groups of addresses that may have had their common ownership made public by common use as inputs in the same transaction or from being used as change from a previous transaction.Result—an array of arrays describing the groupings Example from Bitcoin Core 0.10.0 Result (edited to only the first two results): Added in Bitcoin Core 0.12.0 The listbanned RPC lists all banned IPs/Subnets.Result—information about each banned IP/Subnet Examples from Bitcoin Core 0.12.1 The listlockunspent RPC returns a list of temporarily unspendable (locked) outputs.Result—an array of locked outputs Example from Bitcoin Core 0.10.0 The listreceivedbyaccount RPC lists the total number of bitcoins received by each account.Warning: listreceivedbyaccount will be removed in a later version of Bitcoin Core.Parameter #1—the minimum number of confirmations a transaction must have to be counted Parameter #2—whether to include empty accounts Parameter #3—whether to include watch-only addresses in results Result—account names, balances, and minimum confirmations Example from Bitcoin Core 0.10.0 Get the balances for all non-empty accounts, including only transactions which have been confirmed at least six times: Result (edited to only show the first two results): The listreceivedbyaddress RPC lists the total number of bitcoins received by each address.

Parameter #1—the minimum number of confirmations a transaction must have to be counted Parameter #2—whether to include empty accounts Parameter #3—whether to include watch-only addresses in results Result—addresses, account names, balances, and minimum confirmations Example from Bitcoin Core 0.13.1 List addresses with balances confirmed by at least six blocks, including watch-only addresses: Result (edit to show only two entries): The listsinceblock RPC gets all transactions affecting the wallet which have occurred since a particular block, plus the header hash of a block at a particular depth.Parameter #1—a block header hash Parameter #2—the target confirmations for the lastblock field Parameter #3—whether to include watch-only addresses in details and calculations Example from Bitcoin Core 0.13.1 Get all transactions since a particular block (including watch-only transactions) and the header hash of the sixth most recent block.

Result (edited to show only two payments): The listtransactions RPC returns the most recent transactions that affect the wallet.Parameter #1—an account name to get transactions from Parameter #2—the number of transactions to get Parameter #3—the number of transactions to skip Parameter #4—whether to include watch-only addresses in details and calculations Example from Bitcoin Core 0.13.1 List the most recent transaction from all accounts including watch-only addresses.The listunspent RPC returns an array of unspent transaction outputs belonging to this wallet.Note: as of Bitcoin Core 0.10.0, outputs affecting watch-only addresses will be returned; see the spendable field in the results described below.Parameter #1—the minimum number of confirmations an output must have Parameter #2—the maximum number of confirmations an output may have Parameter #3—the addresses an output must pay Result—the list of unspent outputs Example from Bitcoin Core 0.13.1 Get all outputs confirmed at least 6 times for a particular address: The lockunspent RPC temporarily locks or unlocks specified transaction outputs.

A locked transaction output will not be chosen by automatic coin selection when spending bitcoins.Locks are stored in memory only, so nodes start with zero locked outputs and the locked output list is always cleared when a node stops or fails.Parameter #1—whether to lock or unlock the outputs Parameter #2—the outputs to lock or unlock Example from Bitcoin Core 0.10.0 Verify the outputs have been locked: Unlock one of the above outputs: Verify the output has been unlocked: The move RPC moves a specified amount from one account in your wallet to another using an off-block-chain transaction.Warning: move will be removed in a later version of Bitcoin Core.Warning: it’s allowed to move more funds than are in an account, giving the sending account a negative balance and giving the receiving account a balance that may exceed the number of bitcoins in the wallet (or the number of bitcoins in existence).Example from Bitcoin Core 0.10.0 Move 0.1 bitcoins from “doc test” to “test1”, giving the transaction the comment “Example move”: The ping RPC sends a P2P ping message to all connected nodes to measure ping time.

Results are provided by the getpeerinfo RPC pingtime and pingwait fields as decimal seconds.The P2P ping message is handled in a queue with all other commands, so it measures processing backlog, not just network ping.Example from Bitcoin Core 0.10.0 Get the results using the getpeerinfo RPC: Added in Bitcoin Core 0.14.0 The preciousblock RPC treats a block as if it were received before others with the same work.A later preciousblock call can override the effect of an earlier one.The effects of preciousblock are not retained across restarts.Result—null or error on failure Example from Bitcoin Core 0.14.1 Result (no output from bitcoin-cli because result is set to null).The prioritisetransaction RPC adds virtual priority or fee to a transaction, allowing it to be accepted into blocks mined by this node (or miners which use this node) with a lower priority or fee.(It can also remove virtual priority or fee, requiring the transaction have a higher priority or fee to be accepted into a locally-mined block.)

Parameter #1—the TXID of the transaction to modify Parameter #2—the change to make to the virtual priority Parameter #3—the change to make to the virtual fee Result—true if the priority is changed Example from Bitcoin Core 0.10.0 Added in Bitcoin Core 0.14.0 The pruneblockchain RPC prunes the blockchain up to a specified height or timestamp.The -prune option needs to be enabled (disabled by default).Parameter #1—the block height or timestamp Result—the height of the last block pruned Examples from Bitcoin Core 0.14.1 Added in Bitcoin Core 0.13.0 The removeprunedfunds RPC deletes the specified transaction from the wallet.Meant for use with pruned wallets and as a companion to importprunedfunds.This will effect wallet balances.Parameter #1—the raw transaction to import Example from Bitcoin Core 0.13.1 Requires wallet support.The sendfrom RPC spends an amount from a local account to a bitcoin address.Warning: sendfrom will be removed in a later version of Bitcoin Core.

Warning: if account1 receives an unconfirmed payment and transfers it to account2 with the move RPC, account2 will be able to spend those bitcoins even if this parameter is set to 1 or higher.Parameter #6—a comment about who the payment was sent to Result—a TXID of the sent transaction Example from Bitcoin Core 0.10.0 Spend 0.1 bitcoins from the account “test” to the address indicated below using only UTXOs with at least six confirmations, giving the transaction the comment “Example spend” and labeling the spender “”: Requires wallet support.The sendmany RPC creates and broadcasts a transaction which sends outputs to multiple addresses.Parameter #2—the addresses and amounts to pay Warning: if account1 receives an unconfirmed payment and transfers it to account2 with the move RPC, account2 will be able to spend those bitcoins even if this parameter is set to 1 or higher.Result—a TXID of the sent transaction Example from Bitcoin Core 0.10.0 From the account test1, send 0.1 bitcoins to the first address and 0.2 bitcoins to the second address, with a comment of “Example Transaction”.

The sendrawtransaction RPC validates a transaction and broadcasts it to the peer-to-peer network.Parameter #1—a serialized transaction to broadcast *Parameter #2–whether to allow high fees** Result—a TXID or error message Examples from Bitcoin Core 0.10.0 Requires wallet support.The sendtoaddress RPC spends an amount to a given address.Parameter #4—a comment about who the payment was sent to Result—a TXID of the sent transaction Example from Bitcoin Core 0.10.0 Spend 0.1 bitcoins to the address below with the comment “sendtoadress ”: The setaccount RPC puts the specified address in the given account.Warning: setaccount will be removed in a later version of Bitcoin Core.Example from Bitcoin Core 0.10.0 Put the address indicated below in the “doc test” account.Added in Bitcoin Core 0.12.0 The setban RPC attempts add or remove a IP/Subnet from the banned list.Parameter #1—IP/Subnet of the node Parameter #2—whether to add or remove the node Parameter #3—time how long the ip is banned Parameter #4—whether a relative or absolute timestamp Example from Bitcoin Core 0.12.1 Result (no output from bitcoin-cli because result is set to null).

The setgenerate RPC was removed in Bitcoin Core 0.13.0.If you have an older version of Bitcoin Core, use help setgenerate RPC to get help.For testing, the generate call can still be used to mine a block, and the generatetoaddress RPC call has been added to mine to a specific address.This works with wallet disabled.Added in Bitcoin Core 0.14.0 The setnetworkactive RPC disables/enables all P2P network activity.Parameter #1—whether to disable or enable all P2P network activity Result—null or error on failure Example from Bitcoin Core 0.14.1 Result (no output from bitcoin-cli because result is set to null).The settxfee RPC sets the transaction fee per kilobyte paid by transactions created by this wallet.Parameter #1—the transaction fee amount per kilobyte Example from Bitcoin Core 0.10.0 Set the transaction fee per kilobyte to 100,000 satoshis.The signmessage RPC signs a message with the private key of an address.Parameter #1—the address corresponding to the private key to sign with Parameter #2—the message to sign Example from Bitcoin Core 0.13.1 Sign a the message “Hello, World!”

using the following address: Added in Bitcoin Core 0.13.0 The signmessagewithprivkey RPC signs a message with a given private key.Parameter #1—the private key to sign with Parameter #2—the message to sign Example from Bitcoin Core 0.13.1 Sign a the message “Hello, World!”using the following private key: The signrawtransaction RPC signs a transaction in the serialized transaction format using private keys stored in the wallet or provided in the call.Parameter #1—the transaction to sign Parameter #2—unspent transaction output details Parameter #3—private keys for signing Result—the transaction with any signatures made Example from Bitcoin Core 0.10.0 Sign the hex generated in the example section for the createrawtransaction RPC: The stop RPC safely shuts down the Bitcoin Core server.Result—the server is safely shut down Example from Bitcoin Core 0.10.0 The submitblock RPC accepts a block, verifies it is a valid addition to the block chain, and broadcasts it to the network.

Extra parameters are ignored by Bitcoin Core but may be used by mining pools or other programs.Parameter #1—the new block in serialized block format as hex Example from Bitcoin Core 0.10.0 Submit the following block with the workid, “test”.Result (the block above was already on a local block chain): The validateaddress RPC returns information about the given Bitcoin address.Parameter #1—a P2PKH or P2SH address Example from Bitcoin Core 0.13.1 Validate the following P2PKH address from the wallet: Validate the following P2SH multisig address from the wallet: The verifychain RPC verifies each entry in the local block chain database.Parameter #1—how thoroughly to check each block Parameter #2—the number of blocks to check Example from Bitcoin Core 0.10.0 Verify the most recent 10,000 blocks in the most through way: Result (took 4 minutes and 25 seconds on a generic PC laptop; it would’ve taken much longer on mainnet): The verifymessage RPC verifies a signed message.

Parameter #1—the address corresponding to the signing key Result: true, false, or an error Example from Bitcoin Core 0.10.0 Check the signature on the message created in the example for signmessage: The verifytxoutproof RPC verifies that a proof points to one or more transactions in a block, returning the transactions the proof commits to and throwing an RPC error if the block is not in our best block chain.Parameter #1—The hex-encoded proof generated by gettxoutproof Result—txid(s) which the proof commits to Example from Bitcoin Core 0.11.0 Requires wallet support.Requires an unlocked wallet.The walletlock RPC removes the wallet encryption key from memory, locking the wallet.After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked.Example from Bitcoin Core 0.10.0 Requires wallet support.Requires an encrypted wallet.The walletpassphrase RPC stores the wallet decryption key in memory for the indicated number of seconds.

Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock time that overrides the old one.Warning: if using this RPC on the command line, remember that your shell probably saves your command lines (including the value of the passphrase parameter).Parameter #2—the number of seconds to leave the wallet unlocked Example from Bitcoin Core 0.10.0 Unlock the wallet for 10 minutes (the passphrase is “test”): Requires wallet support.The walletpassphrasechange RPC changes the wallet passphrase from ‘old passphrase’ to ‘new passphrase’.Example from Bitcoin Core 0.10.0 Change the wallet passphrase from “test” to “example”: As of version 0.10.0, Bitcoin Core provides an unauthenticated HTTP REST interface.The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet and port 18332 for testnet.It must be enabled by either starting Bitcoin Core with the -rest option or by specifying rest=1 in the configuration file.

Make sure that the RPC interface is also activated.Set server=1 in bitcoin.conf or supply the -server argument when starting Bitcoin Core.Starting Bitcoin Core with bitcoind automatically enables the RPC interface.The interface is not intended for public access and is only accessible from localhost by default.Warning: A web browser can access a HTTP REST interface running on localhost, possibly allowing third parties to use cross-site scripting attacks to download your transaction and block data, reducing your privacy.If you have privacy concerns, you should not run a browser on the same computer as a REST-enabled Bicoin Core node.The interface uses standard HTTP status codes and returns a plain-text description of errors for debugging.The GET block operation gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block.Parameter #1—the header hash of the block to retrieve Examples from Bitcoin Core 0.13.1 Request a block in hex-encoded serialized block format: Get the same block in JSON: The GET block/notxdetails operation gets a block with a particular header hash from the local block database either as a JSON object or as a serialized block.

The JSON object includes TXIDs for transactions within the block rather than the complete transactions GET block returns.Parameter #1—the header hash of the block to retrieve Examples from Bitcoin Core 0.10.0 Request a block in hex-encoded serialized block format: Get the same block in JSON: The GET chaininfo operation returns information about the current state of the block chain.Supports only json as output format.Examples from Bitcoin Core 0.13.1 Get blockchain info in JSON: The GET getutxos operation returns an UTXO set given a set of outpoints.Parameter #1—Include memory pool transactions Examples from Bitcoin Core 0.13.1 The GET headers operation returns a specified amount of block headers in upward direction.Parameter #1—the amount of block headers to retrieve Parameter #2—the header hash of the block to retrieve Examples from Bitcoin Core 0.13.1 Request 5 block headers in hex-encoded serialized block format: Get the same block headers in JSON: The GET mempool/contents operation returns all transaction in the memory pool with detailed information.