Supported Transaction Types

Bitcoin supports a number of default transaction types. Typically, only supported transaction types are broadcasted and validated within the network. Transactions that do not match the standard transaction type are generally discarded. Note that because transactions can have multiple outputs, different output types can be combined within a single transaction.

An example of a transaction with a single input spending (w + x) BTCs to two output addresses (X and Y)

Figure 3.2 An example of a transaction with a single input spending (w + x) BTCs to two output addresses (X and Y).

Pay To Public Key Hash (P2PKH) A P2PKH transaction output contains the following opcodes:

OP-DUP OP_HASH160 OP-EQUALVERIFY OP_CHECK The corresponding input that would be eligible to spend the output specifies the required signature and the full public key as follows:

Pay To Script Hash (P2SH) A P2SH transaction output can only be redeemed by an input that provides a script that matches to the hash of the corresponding

The input of transaction 2 points to the output of transaction 1

Figure 3.3 The input of transaction 2 points to the output of transaction 1.

Table 3.1

Transaction Format Within a Bitcoin Block

Field

Description

Size

Version number

Version, currently 1

4 bytes

Input counter

positive integer

1—9 bytes

List of inputs

see Table 3.2

Output counter

positive integer

1—9 bytes

List of outputs

see Table 3.2

Variable

Locktime

Block height or time when transaction is valid

4 bytes

Table 3.2

Transaction Input Format

Field

Description

Size

Previous transaction hash

Dependency

32 bytes

Previous transaction output index

Dependency index

4 bytes

Script length

1—9 bytes

ScriptSig (Signature script)

Input script

Variable

Sequence number

OxFFFFFFFF

4 bytes

output. For example, a P2SH output contains the following transaction outputs:

OP-HASH160 OP_EQUALVERIFY

The redeeming input consequently needs to provide a redeemScript, that hashes to the input’s hash. Note that every standard script can be used for this purpose:

P2SH outputs are currently widely used in multisignature (multisig) transactions.

Multisig A multisignature (or commonly referred to as multisig) transaction requires multiple signatures in order to be redeemable. Multisig transaction outputs are usually denoted as m-of-n, m being the minimum number of signatures that are required for the transaction output to be redeemable, out of the n possible signatures that correspond to the public keys defined in the transaction output. An example transaction output is:

Table 3.3

Transaction Output Format

Field

Description

Size

Value

Positive integer of Satoshis to be transferred

4 bytes

Script length

1—9 bytes

ScriptSig (Pubkey script)

Output script

Variable

[B pubkey] [C pubkey..]

OP_CHECKMULTISIG

while the redeeming input follows this structure:

OP-0 [B signature] [C signature..]

Note that P2SH allows an entity to create a transaction so that the responsibility for providing the redeem conditions is pushed from the sender to the redeemer of the funds. Consequently, the sender is not required to pay an excess in transaction fees if the redeem script happens to be complex. Multisignature transactions can be realized with either M-of-N output scripts as well as P2SH.

 
Source
< Prev   CONTENTS   Source   Next >