Module Bitcoinml.Tx

val amount_check : ?⁠max_money:Stdint.Int64.t -> Stdint.Int64.t -> bool

amount_check ~max_money:Int64.t num checks if num exceeds ~max_money or 21M

module In : sig ... end

Transaction input

module Out : sig ... end

Transaction output

module Witness : sig ... end

Witness data

type t = {
hash : Hash.t;
version : Stdint.int32;
txin : In.t list;
txout : Out.t list;
locktime : Stdint.uint32;
size : int;
vsize : int;
witness : Witness.t option;
}
val parse : ?⁠coinbase:bool -> ?⁠hex:bool -> string -> string * t option

parse ~coinbase:bool ~hex:bool data parses a binary data and returns the parsed transaction; data could be a binary data, or an hex human readable string if ~hex is true

val parse_legacy : ?⁠coinbase:bool -> ?⁠hex:bool -> string -> string * t option

parse_legacy ~coinbase:bool ~hex:bool data; same as parse but disabling segwit

val parse_all : string -> int -> t list option

parse_all data n parses a list of n transactions encoded in data

val parse_all_legacy : string -> int -> t list option

parse_all_legacy data n; same as parse_all but disabling segwit

val serialize : ?⁠hex:bool -> t -> string

serialize ~hex:bool tx serializes the transaction tx; the result is a binary data, or an hex human readable string if ~hex is true

val serialize_legacy : ?⁠hex:bool -> t -> string

serialize_legacy ~hex:bool tx; same as serialize but disabling segwit

val serialize_all : t list -> string

serialize_all txl serializes a list of transaction txl

val serialize_all_legacy : t list -> string

serialize_all_legacy txl; same as serialize_all but disabling segwit

val is_witness : t -> bool

is_witness tx returns true if tx hash witness data

val is_coinbase : t -> bool

is_coinbase tx returns true if tx is a coinbase transaction