The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bitcoin::Crypto::Types - Bitcoin-specific data types

SYNOPSIS

        use Bitcoin::Crypto::Types qw(
                BIP44Purpose
                FormatStr
                FormatDesc
                ByteStr
                ScriptType
                ScriptDesc
                BitcoinScript
                PSBTMapType
                PSBTFieldType
                IntMaxBits
                SatoshiAmount
                DerivationPath
        );

DESCRIPTION

This module is a Type::Tiny library for types which are either specific for Bitcoin or are used by Bitcoin::Crypto to implement its routines.

AVAILABLE TYPES

BIP44Purpose

An integer with one of the available purpose numbers for BIP44, like 44.

FormatStr

A string with one of the available format names, like hex.

FormatDesc

An array reference with exactly two elements, where the first one is "FormatStr" and the second one is a string with the data encoded in that format.

ByteStr

A string where each character is 8 bit. Can be coerced from "FormatDesc".

ScriptType

A string with one of the available script type names, like P2WPKH.

ScriptDesc

An array reference with exactly two elements, where the first one is "ScriptType" or a string address, and the second one is defined data specific for that script type.

BitcoinScript

An instance of Bitcoin::Crypto::Script. Can be coerced from "ScriptDesc" or "ByteStr" (or any of its coercion types).

PSBTMapType

A string with one of the available PSBT map type names, like global.

PSBTFieldType

An instance of Bitcoin::Crypto::PSBT::FieldType. Can be coerced from a string name of the PSBT field, or from an array reference of two values, where the first one is "PSBTMapType" and the second one is a positive integer with field code.

IntMaxBits

A non-negative integer which must be small enough to be representable with the specified number of bits (parametrizable).

SatoshiAmount

A non-negative integer, represented as Math::BigInt object. Can be coerced from an integer or from a string.

DerivationPath

An instance of Bitcoin::Crypto::DerivationPath. Can be coerced from a string or a class consuming Bitcoin::Crypto::Role::WithDerivationPath.

SEE ALSO

Type::Library