Skip to content

Standardness

Eric Voskuil edited this page Mar 16, 2017 · 4 revisions

Standardness is a Bitcoin convention pertaining to transactions and unrelated to validity (non-standard transactions can be valid). Standardness is sometimes used to determine whether a transaction will be stored and/or relayed to peers. Bitcoin includes a Turing incomplete scripting language. Transaction inputs and outputs include such scripts, which in turn control the transfer of ownership of bitcoins.

The following libbitcoin method shows the list of script op codes (operations_) being converted to a standard pattern identifier:

script_pattern script::pattern() const
{
    if (is_null_data_pattern(operations_))
        return script_pattern::null_data;

    if (is_pay_multisig_pattern(operations_))
        return script_pattern::pay_multisig;

    if (is_pay_public_key_pattern(operations_))
        return script_pattern::pay_public_key;

    if (is_pay_key_hash_pattern(operations_))
        return script_pattern::pay_key_hash;

    if (is_pay_script_hash_pattern(operations_))
        return script_pattern::pay_script_hash;

    if (is_sign_multisig_pattern(operations_))
        return script_pattern::sign_multisig;

    if (is_sign_public_key_pattern(operations_))
        return script_pattern::sign_public_key;

    if (is_sign_key_hash_pattern(operations_))
        return script_pattern::sign_key_hash;

    if (is_sign_script_hash_pattern(operations_))
        return script_pattern::sign_script_hash;

    return script_pattern::non_standard;
}

A payment address may be derived from standard scripts that pay to an address. Similarly stealth payment metadata can be derived from stealth transactions. Stealth transactions combine pairs of standard scripts, specifically a null_data pattern and any pay pattern that includes a payment address.

Clone this wiki locally