Bitcoin transaction

This is the approved revision of this page, as well as being the most recent.

A transaction is a section of data confirmed by a signature. It is sent to the Bitcoin network and forms blocks. It typically contains references to preceding transactions and associates a certain number of bitcoins with one or several public keys (Bitcoin addresses). It is not encrypted because there is nothing to encrypt in the Bitcoin system. A block chain browser is where all transactions are combined in the form of a block chain. They can be found and verified. This is necessary to determine technical transaction parameters as well as verify the details of payments.


The general format of Bitcoin transactionsEdit

Field Description Size
Version number Currently 1 4 bytes
In-Counter Positive integer VI = Varlnt 1-9 bytes
List of inputs The first input of the first transaction is also called a coinbase <In-counter> many inputs
Out-counter Positive integer VI = Varlnt 1-9 bytes
List of outputs The first output of the first transaction use Bitcoins found for the block <out-counter> many outputs
Lock time If not equal to 0 and sequence numbers are inferior to OxFFFFFFFF: block height or timestamp (for final transactions) 4 bytes

Example of a Bitcoin transaction with input and outputEdit


Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
Value: 5000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d


Input in this transaction imports 50BTC from output # 0 in transactions f5d8…, then the output sends 50 BTC to a Bitcoin address (expressed here in the form of a hexadecimal system – 4043…). When the recipient wants to spend their money, he will reference this transaction’s output # 0 for his own transaction’s input.


Input is a reference to the output of another transaction. A transaction often possesses several inputs. The values of these references are resumed and the total value of bitcoins can be used for the current transaction output. Previous tx is the hash of a preceding transaction. Index is a certain output from this transaction. ScriptSig is the first half of the script (see below for more details about this).

The script is composed of two elements: the signature and the public key. The public key belongs to the user who applies the transaction outputs and confirms that the creator of the transaction has the right to have at his disposal the sum of money obtained from the outputs. Another element is EDCSA (hash signature of a simplified version of the transaction). In combination with the public key, this signature confirms that the transaction has been created by the real owner of this Bitcoin address.


The output contains instructions about sending the bitcoins. The value is an amount in satoshi (1 BTC = 100000000 satoshi), which can be used by the transaction for which the current transaction is the input. ScriptPubKey is the second half of the script (this will be elaborated upon afterwards). There can be more than one output and these will share the amount sent from the inputs. Each transaction output may only be used as the input for the subsequent transaction once, with the effect that the sum of all current transaction inputs must be used in the output. Otherwise the remaining sum from the transaction inputs will be lost. For example, if the input is equal to 50BTC and the user must only send 25BTC, Bitcoin creates two outputs of 25BTC each: one will go to the destination, the other will go to the owner of the funds again (the so-called ‘change’ – a transaction in which the user in fact sends money to himself). Any amount remaining from the input of bitcoins not used in the transaction will become the fee for the transaction. The person generating the block will receive this fee.

Transaction verificationEdit

In order to verify if the inputs are permitted to collect the requisite sums from the outputs of the preceding transactions, Bitcoin uses the standard system of the script (see below) of scriptSig input and scriptPubKey output which this transaction references. They are evaluated with the help of scriptPubKey using the remaining values in the scriptSig stack.

The input is confirmed if the scriptPubKey script returns a “true” value. Using the script system, the sender can create very complex conditions to fulfill by those who wish to obtain the output value. For example, it is possible to create an input which any user will obtain without authorization. It is equally possible to request that the input be signed by 10 different keys or verified by password.

General format of each transaction input – TxinEdit

Field Description Size
Hash of preceding transaction Hashed double SHA256 of preceding transaction 32 bytes
Previous Txout-index Arithmetical integer. It indexes outputs of the preceding transaction 4 bytes
List of inputs The first input of the first transaction is also called a coinbase <In-counter> many inputs
Length of Txin script Arithmetical integer VI = Varlnt 1-9 bytes
Txin-script / scriptSig Script <length within the script> many bytes
Sequence number Normally 0[FFFFFFFF; functions in the case that the lock time of the transaction > 0 4 bytes

The input adequately describes where and how the number of bitcoins can be obtained which can be redeemed by their new owner. If it is the only input of the first transaction in the block, it is called the generated transaction input. Its contents are completely ignored.

General format of each transaction output – TxoutEdit

Field Description Size
Value Arithmetical integer giving a satoshi amount (BTE/10^8) necessary for transactions 8 bytes
Length of Txout-script Arithmetical stack 1-9 bytes
Txout-script / scriptPubKey Script <length of output script> many bytes

The output determines the conditions of use of the Bitcoin data in the following transactions, the sum of the output values of the first transaction in the block is a value of bitcoins taken for the block. Here a fee amount is added from the other transactions added to this block.

See AlsoEdit


Read in another language