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.

script_pattern script::pattern() const
{
    // The first operations access must be method-based to guarantee the cache.
    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;
}
Clone this wiki locally