Bitcoin transaction header

The script contains two components, a signature and a public key. The public key must match the hash given in the script of the redeemed output. The public key is used to verify the redeemers signature, which is the second component. More precisely, the second component is an ECDSA signature over a hash of a simplified version of the transaction. It, combined with the public key, proves the transaction was created by the real owner of the bitcoins in question.

Various flags define how the transaction is simplified and can be used to create different types of payment. An output contains instructions for sending bitcoins. ScriptPubKey is the second half of a script discussed later. There can be more than one output, and they share the combined value of the inputs.

Because each output from one transaction can only ever be referenced once by an input of a subsequent transaction, the entire combined input value needs to be sent in an output if you don't want to lose it. If the input is worth 50 BTC but you only want to send 25 BTC, Bitcoin will create two outputs worth 25 BTC: one to the destination, and one back to you known as " change ", though you send it to yourself. Any input bitcoins not redeemed in an output is considered a transaction fee ; whoever generates the block can claim it by inserting it into the coinbase transaction of that block.

To verify that inputs are authorized to collect the values of referenced outputs, Bitcoin uses a custom Forth-like scripting system. The input's scriptSig and the referenced output's scriptPubKey are evaluated in that order , with scriptPubKey using the values left on the stack by scriptSig. The input is authorized if scriptPubKey returns true.

Through the scripting system, the sender can create very complex conditions that people have to meet in order to claim the output's value. For example, it's possible to create an output that can be claimed by anyone without any authorization. It's also possible to require that an input be signed by ten different keys, or be redeemable with a password instead of a key.

It is possible to design more complex types of transactions, and link them together into cryptographically enforced agreements. These are known as Contracts. A Bitcoin address is only a hash, so the sender can't provide a full public key in scriptPubKey. When redeeming coins that have been sent to a Bitcoin address, the recipient provides both the signature and the public key.

The script verifies that the provided public key does hash to the hash in scriptPubKey, and then it also checks the signature against the public key. The value represents a minimal fee and is expressed in satoshis per bytes.

3. Bitcoin — Incubed documentation

Upon receipt of a "feefilter" message, the node will be permitted, but not required, to filter transaction invs for transactions that fall below the feerate provided in the feefilter message interpreted as satoshis per kilobyte. The fee filter is additive with a bloom filter for transactions so if an SPV client were to load a bloom filter and send a feefilter message, transactions would only be relayed if they passed both filters.

Jump to: navigation , search. Type names used in this documentation are from the C99 standard. Bitcoin Core documentation. Categories : Technical Developer Bitcoin Core documentation. Navigation menu Personal tools Create account Log in. Namespaces Page Discussion. Views Read View source View history. Sister projects Essays Source. This page was last edited on 14 December , at Content is available under Creative Commons Attribution 3.

Privacy policy About Bitcoin Wiki Disclaimers. Magic value indicating message origin network, and used to seek to next message when stream state is unknown. IPv6 address.

Bitcoin & Cryptocurrency Glossary

Network byte order. The original client only supported IPv4 and only read the last 4 bytes to get the IPv4 address. Only to be used in getdata message. Indicates the reply should be a merkleblock message rather than a block message; this only works if a bloom filter has been set. See BIP 37 for more info. Indicates the reply should be a cmpctblock message. See BIP for more info. Hash of a block with witness data.

The reference to a Merkle tree collection which is a hash of all transactions related to this block. A timestamp recording when this block was created Will overflow in [2]. The nonce used to generate this block… to allow variations of the header and compute different hashes. As encoded in tx messages. The short transaction IDs calculated from the transactions which were not provided explicitly in prefilledtxn.

As defined by PrefilledTransaction definition, above.

Used to provide the coinbase transaction and a select few which we expect a peer may be missing. List of CompactSizes. Differentially encoded. Node random nonce, randomly generated every time a version packet is sent. This nonce is used to detect connections to self. User Agent 0x00 if string is 0 bytes long. Whether the remote peer should announce relayed transactions or not, see BIP See BIP Never formally proposed as a BIP , and discontinued.

Introduction

Was historically sporadically seen on the network. Address of other nodes on the network.

Tracking Bitcoin Transactions (Forensics) - Programmer explains

The block number or timestamp at which this transaction is unlocked: Value Description 0. Transaction version as defined by the sender. Intended for "replacement" of transactions when information is updated before inclusion into a block. Usually contains the public key as a Bitcoin script setting up conditions to claim this output.

A Unix timestamp recording when this block was created Currently limited to dates before the year ! The calculated difficulty target being used for this block. Block headers. Optional extra data provided by some errors. Currently, all errors which provide this field fill it with the TXID or block header hash of the object being rejected, so the field is 32 bytes. The filter itself is simply a bit field of arbitrary byte-aligned size.

The maximum size is 36, bytes. The number of hash functions to use in this filter. The maximum value allowed in this field is Block version information, based upon the software version creating this block note, this is signed.

Flag bits, packed per 8 in a byte, least significant bit first. Extra 0 bits are padded on to reach full byte size. All alerts with an ID number less than or equal to this number should be cancelled: deleted and not accepted in the future. This alert only applies to versions greater than or equal to this version.

A Decomposition Of The Bitcoin Block Header

Other versions should still relay it. This must be strictly greater than the median time of the previous 11 blocks. Full nodes will not be accepting blocks with headers that are more than 2 hours in the future according to their clock. Unix time is not a true representation of UTC. According to the Bitcoin protocols, the block propagation time must be on average 10 minutes, so the timestamp must fall within the allowable time that is within this range.

The variability, however, is due to the difficulty which will be discussed next.