├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── README.md ├── autogen.sh ├── build.cmd ├── builds ├── cmake │ ├── CMakeLists.txt │ ├── CMakePresets.json │ └── modules │ │ ├── FindDl.cmake │ │ ├── FindIcu-I18N.cmake │ │ ├── FindPng.cmake │ │ ├── FindQrencode.cmake │ │ ├── FindRt.cmake │ │ └── FindSecp256K1.cmake ├── msvc │ ├── .gitignore │ ├── build │ │ ├── build_all.bat │ │ ├── build_base.bat │ │ └── nuget_all.bat │ ├── debug.natvis │ ├── nuget.config │ ├── properties │ │ ├── Arm.props │ │ ├── Arm64.props │ │ ├── Common.props │ │ ├── DLL.props │ │ ├── Debug.props │ │ ├── DebugDEXE.props │ │ ├── DebugDLL.props │ │ ├── DebugLEXE.props │ │ ├── DebugLIB.props │ │ ├── DebugLTCG.props │ │ ├── DebugSEXE.props │ │ ├── EXE.props │ │ ├── LIB.props │ │ ├── LTCG.props │ │ ├── Link.props │ │ ├── Messages.props │ │ ├── Output.props │ │ ├── Release.props │ │ ├── ReleaseDEXE.props │ │ ├── ReleaseDLL.props │ │ ├── ReleaseLEXE.props │ │ ├── ReleaseLIB.props │ │ ├── ReleaseLTCG.props │ │ ├── ReleaseSEXE.props │ │ ├── Win32.props │ │ └── x64.props │ ├── resource.h │ ├── resource.rc │ └── vs2022 │ │ ├── .vs │ │ └── libbitcoin-system │ │ │ └── FileContentIndex │ │ │ └── .gitignore │ │ ├── libbitcoin-system-examples │ │ ├── libbitcoin-system-examples.props │ │ ├── libbitcoin-system-examples.vcxproj │ │ ├── libbitcoin-system-examples.vcxproj.filters │ │ └── packages.config │ │ ├── libbitcoin-system-test │ │ ├── libbitcoin-system-test.props │ │ ├── libbitcoin-system-test.vcxproj │ │ ├── libbitcoin-system-test.vcxproj.filters │ │ ├── libbitcoin-system-test.xml │ │ └── packages.config │ │ ├── libbitcoin-system.import.props │ │ ├── libbitcoin-system.import.xml │ │ ├── libbitcoin-system.sln │ │ └── libbitcoin-system │ │ ├── libbitcoin-system.props │ │ ├── libbitcoin-system.vcxproj │ │ ├── libbitcoin-system.vcxproj.filters │ │ ├── libbitcoin-system.xml │ │ └── packages.config └── vscode │ └── system.code-workspace ├── configure.ac ├── doc └── historic │ ├── README │ ├── index.html │ ├── inner_core.png │ ├── make_transaction.png │ ├── multiple_currencies.png │ ├── pluggable.png │ ├── python_layer.png │ ├── switching_nets.png │ └── switching_serialisers.png ├── examples └── main.cpp ├── include └── bitcoin │ ├── system.hpp │ └── system │ ├── allocator.hpp │ ├── arena.hpp │ ├── boost.hpp │ ├── chain │ ├── annex.hpp │ ├── block.hpp │ ├── chain.hpp │ ├── chain_state.hpp │ ├── checkpoint.hpp │ ├── compact.hpp │ ├── context.hpp │ ├── enums │ │ ├── coverage.hpp │ │ ├── extension.hpp │ │ ├── flags.hpp │ │ ├── key_version.hpp │ │ ├── magic_numbers.hpp │ │ ├── numbers.hpp │ │ ├── opcode.hpp │ │ ├── policy.hpp │ │ ├── script_pattern.hpp │ │ ├── script_version.hpp │ │ └── selection.hpp │ ├── header.hpp │ ├── input.hpp │ ├── operation.hpp │ ├── output.hpp │ ├── point.hpp │ ├── prevout.hpp │ ├── script.hpp │ ├── stripper.hpp │ ├── taproot.hpp │ ├── tapscript.hpp │ ├── transaction.hpp │ └── witness.hpp │ ├── config │ ├── base16.hpp │ ├── base2.hpp │ ├── base32.hpp │ ├── base58.hpp │ ├── base64.hpp │ ├── base85.hpp │ ├── block.hpp │ ├── config.hpp │ ├── hash160.hpp │ ├── hash256.hpp │ ├── header.hpp │ ├── input.hpp │ ├── output.hpp │ ├── parameter.hpp │ ├── parser.hpp │ ├── point.hpp │ ├── printer.hpp │ ├── script.hpp │ └── transaction.hpp │ ├── constants.hpp │ ├── constraints.hpp │ ├── crypto │ ├── aes256.hpp │ ├── crypto.hpp │ ├── der_parser.hpp │ ├── pseudo_random.hpp │ ├── ring_signature.hpp │ └── secp256k1.hpp │ ├── data │ ├── array_cast.hpp │ ├── byte_cast.hpp │ ├── collection.hpp │ ├── data.hpp │ ├── data_array.hpp │ ├── data_chunk.hpp │ ├── data_reference.hpp │ ├── data_slab.hpp │ ├── data_slice.hpp │ ├── exclusive_slice.hpp │ ├── external_ptr.hpp │ ├── iterable.hpp │ ├── memory.hpp │ ├── no_fill_allocator.hpp │ └── string.hpp │ ├── define.hpp │ ├── endian │ ├── batch.hpp │ ├── endian.hpp │ ├── integers.hpp │ ├── integrals.hpp │ ├── minimal.hpp │ ├── nominal.hpp │ ├── stream.hpp │ ├── swaps.hpp │ ├── uintx_t.hpp │ └── unsafe.hpp │ ├── error │ ├── block_error_t.hpp │ ├── error.hpp │ ├── error_t.hpp │ ├── errorno_t.hpp │ ├── macros.hpp │ ├── op_error_t.hpp │ ├── script_error_t.hpp │ └── transaction_error_t.hpp │ ├── exceptions.hpp │ ├── execution.hpp │ ├── filter │ ├── bloom.hpp │ ├── filter.hpp │ ├── golomb.hpp │ └── sieve.hpp │ ├── forks.hpp │ ├── funclets.hpp │ ├── hash │ ├── accumulator.hpp │ ├── algorithm.hpp │ ├── algorithms.hpp │ ├── checksum.hpp │ ├── functions.hpp │ ├── hash.hpp │ ├── hmac.hpp │ ├── pbkd.hpp │ ├── rmd │ │ ├── algorithm.hpp │ │ ├── rmd.hpp │ │ ├── rmd128.hpp │ │ └── rmd160.hpp │ ├── scrypt.hpp │ ├── sha │ │ ├── algorithm.hpp │ │ ├── sha.hpp │ │ ├── sha160.hpp │ │ ├── sha256.hpp │ │ └── sha512.hpp │ └── siphash.hpp │ ├── have.hpp │ ├── impl │ ├── chain │ │ ├── annex.ipp │ │ ├── compact.ipp │ │ ├── operation_patterns.ipp │ │ ├── script_patterns.ipp │ │ ├── tapscript.ipp │ │ ├── transaction_patterns.ipp │ │ └── witness_patterns.ipp │ ├── data │ │ ├── array_cast.ipp │ │ ├── byte_cast.ipp │ │ ├── collection.ipp │ │ ├── data_array.ipp │ │ ├── data_reference.ipp │ │ ├── data_slab.ipp │ │ ├── data_slice.ipp │ │ ├── external_ptr.ipp │ │ └── memory.ipp │ ├── endian │ │ ├── batch.ipp │ │ ├── integers.ipp │ │ ├── integrals.ipp │ │ ├── minimal.ipp │ │ ├── nominal.ipp │ │ ├── stream.ipp │ │ ├── swaps.ipp │ │ ├── uintx_t.ipp │ │ └── unsafe.ipp │ ├── filter │ │ ├── bloom.ipp │ │ └── sieve.ipp │ ├── hash │ │ ├── accumulator.ipp │ │ ├── checksum.ipp │ │ ├── functions.ipp │ │ ├── hmac.ipp │ │ ├── pbkd.ipp │ │ ├── rmd │ │ │ └── algorithm.ipp │ │ ├── scrypt.ipp │ │ └── sha │ │ │ ├── algorithm_compress.ipp │ │ │ ├── algorithm_double.ipp │ │ │ ├── algorithm_functions.ipp │ │ │ ├── algorithm_iterate.ipp │ │ │ ├── algorithm_konstant.ipp │ │ │ ├── algorithm_merkle.ipp │ │ │ ├── algorithm_midstate.ipp │ │ │ ├── algorithm_native.ipp │ │ │ ├── algorithm_padding.ipp │ │ │ ├── algorithm_parsing.ipp │ │ │ ├── algorithm_schedule.ipp │ │ │ ├── algorithm_sigma.ipp │ │ │ ├── algorithm_single.ipp │ │ │ └── algorithm_stream.ipp │ ├── machine │ │ ├── interpreter.ipp │ │ ├── interpreter_connect.ipp │ │ ├── interpreter_run.ipp │ │ ├── number_boolean.ipp │ │ ├── number_chunk.ipp │ │ ├── number_integer.ipp │ │ ├── program.ipp │ │ ├── program_construct.ipp │ │ ├── program_sign.ipp │ │ ├── stack.ipp │ │ └── stack_variant.ipp │ ├── math │ │ ├── addition.ipp │ │ ├── bits.ipp │ │ ├── bytes.ipp │ │ ├── byteswap.ipp │ │ ├── cast.ipp │ │ ├── division.ipp │ │ ├── limits.ipp │ │ ├── logarithm.ipp │ │ ├── multiplication.ipp │ │ ├── overflow.ipp │ │ ├── power.ipp │ │ ├── rotate.ipp │ │ └── sign.ipp │ ├── radix │ │ ├── base_16.ipp │ │ ├── base_2n.ipp │ │ └── base_58.ipp │ ├── serial │ │ ├── deserialize.ipp │ │ └── serialize.ipp │ ├── stream │ │ ├── device.ipp │ │ ├── iostream │ │ │ ├── iostream.ipp │ │ │ ├── istream.ipp │ │ │ └── ostream.ipp │ │ └── streamers │ │ │ ├── bit_reader.ipp │ │ │ ├── bit_writer.ipp │ │ │ ├── byte_reader.ipp │ │ │ ├── byte_writer.ipp │ │ │ ├── sha256_writer.ipp │ │ │ ├── sha256t_writer.ipp │ │ │ └── sha256x2_writer.ipp │ ├── wallet │ │ └── addresses │ │ │ └── checked.ipp │ └── words │ │ ├── dictionaries.ipp │ │ └── dictionary.ipp │ ├── intrinsics │ ├── byte_swap.hpp │ ├── cpuid.hpp │ ├── detection.hpp │ ├── intel │ │ ├── intel.hpp │ │ ├── intel_128.hpp │ │ ├── intel_256.hpp │ │ ├── intel_512.hpp │ │ └── intel_sha.hpp │ ├── intrinsics.hpp │ ├── neon │ │ ├── neon.hpp │ │ ├── neon_128.hpp │ │ └── neon_sha.hpp │ ├── none │ │ ├── none_128.hpp │ │ └── none_sha.hpp │ ├── rotate.hpp │ ├── sve │ │ └── sve.hpp │ └── types.hpp │ ├── literals.hpp │ ├── machine │ ├── interpreter.hpp │ ├── machine.hpp │ ├── number.hpp │ ├── number_boolean.hpp │ ├── number_chunk.hpp │ ├── number_integer.hpp │ ├── program.hpp │ └── stack.hpp │ ├── math │ ├── addition.hpp │ ├── bits.hpp │ ├── bytes.hpp │ ├── byteswap.hpp │ ├── cast.hpp │ ├── division.hpp │ ├── functional.hpp │ ├── limits.hpp │ ├── logarithm.hpp │ ├── math.hpp │ ├── multiplication.hpp │ ├── overflow.hpp │ ├── power.hpp │ ├── rotate.hpp │ └── sign.hpp │ ├── preprocessor.hpp │ ├── radix │ ├── base_10.hpp │ ├── base_16.hpp │ ├── base_2048.hpp │ ├── base_2n.hpp │ ├── base_32.hpp │ ├── base_58.hpp │ ├── base_64.hpp │ ├── base_85.hpp │ └── radix.hpp │ ├── serial │ ├── deserialize.hpp │ ├── props.hpp │ ├── serial.hpp │ └── serialize.hpp │ ├── settings.hpp │ ├── stream │ ├── binary.hpp │ ├── device.hpp │ ├── devices │ │ ├── copy_sink.hpp │ │ ├── copy_source.hpp │ │ ├── flip_sink.hpp │ │ └── push_sink.hpp │ ├── iostream │ │ ├── iostream.hpp │ │ ├── istream.hpp │ │ └── ostream.hpp │ ├── make_stream.hpp │ ├── make_streamer.hpp │ ├── stream.hpp │ ├── stream_result.hpp │ ├── streamers.hpp │ ├── streamers │ │ ├── bit_flipper.hpp │ │ ├── bit_reader.hpp │ │ ├── bit_writer.hpp │ │ ├── byte_flipper.hpp │ │ ├── byte_reader.hpp │ │ ├── byte_writer.hpp │ │ ├── interfaces │ │ │ ├── bitflipper.hpp │ │ │ ├── bitreader.hpp │ │ │ ├── bitwriter.hpp │ │ │ ├── byteflipper.hpp │ │ │ ├── bytereader.hpp │ │ │ └── bytewriter.hpp │ │ ├── sha256_writer.hpp │ │ ├── sha256t_writer.hpp │ │ └── sha256x2_writer.hpp │ └── streams.hpp │ ├── typelets.hpp │ ├── types.hpp │ ├── unicode │ ├── ascii.hpp │ ├── code_points.hpp │ ├── conversion.hpp │ ├── normalization.hpp │ ├── unicode.hpp │ └── utf8_everywhere │ │ ├── console_streambuf.hpp │ │ ├── environment.hpp │ │ ├── ifstream.hpp │ │ ├── ofstream.hpp │ │ ├── paths.hpp │ │ ├── stdio.hpp │ │ ├── unicode_istream.hpp │ │ ├── unicode_ostream.hpp │ │ ├── unicode_streambuf.hpp │ │ └── utf8_everywhere.hpp │ ├── version.hpp │ ├── wallet │ ├── addresses │ │ ├── bitcoin_uri.hpp │ │ ├── checked.hpp │ │ ├── payment_address.hpp │ │ ├── qr_code.hpp │ │ ├── stealth_address.hpp │ │ ├── stealth_receiver.hpp │ │ ├── stealth_sender.hpp │ │ ├── tiff.hpp │ │ ├── uri.hpp │ │ ├── uri_reader.hpp │ │ └── witness_address.hpp │ ├── context.hpp │ ├── keys │ │ ├── ec_point.hpp │ │ ├── ec_private.hpp │ │ ├── ec_public.hpp │ │ ├── ec_scalar.hpp │ │ ├── ek_private.hpp │ │ ├── ek_public.hpp │ │ ├── ek_token.hpp │ │ ├── encrypted_keys.hpp │ │ ├── hd_private.hpp │ │ ├── hd_public.hpp │ │ ├── mini_keys.hpp │ │ └── stealth.hpp │ ├── message.hpp │ ├── mnemonics │ │ ├── electrum.hpp │ │ ├── electrum_v1.hpp │ │ └── mnemonic.hpp │ ├── neutrino.hpp │ ├── point_value.hpp │ ├── points_value.hpp │ └── wallet.hpp │ ├── warnings.hpp │ └── words │ ├── catalogs │ ├── electrum.hpp │ ├── electrum_v1.hpp │ └── mnemonic.hpp │ ├── dictionaries.hpp │ ├── dictionary.hpp │ ├── language.hpp │ ├── languages.hpp │ └── words.hpp ├── install-cmake.sh ├── install-cmakepresets.sh ├── install.sh ├── libbitcoin-system-test_runner.sh ├── libbitcoin-system.pc.in ├── m4 ├── .gitignore ├── ax_boost_base.m4 ├── ax_boost_chrono.m4 ├── ax_boost_date_time.m4 ├── ax_boost_filesystem.m4 ├── ax_boost_iostreams.m4 ├── ax_boost_json.m4 ├── ax_boost_locale.m4 ├── ax_boost_program_options.m4 ├── ax_boost_regex.m4 ├── ax_boost_system.m4 ├── ax_boost_thread.m4 ├── ax_boost_unit_test_framework.m4 ├── ax_check_compile_flag.m4 ├── ax_check_link_flag.m4 ├── ax_check_preproc_flag.m4 ├── ax_cxx_compile_stdcxx.m4 └── ax_pthread.m4 ├── src ├── arena.cpp ├── chain │ ├── block.cpp │ ├── chain_state.cpp │ ├── checkpoint.cpp │ ├── context.cpp │ ├── enums │ │ └── opcode.cpp │ ├── header.cpp │ ├── input.cpp │ ├── operation.cpp │ ├── output.cpp │ ├── point.cpp │ ├── script.cpp │ ├── script_extract.cpp │ ├── taproot.cpp │ ├── transaction.cpp │ ├── transaction_cache.cpp │ ├── transaction_sighash.cpp │ ├── transaction_sighash_v0.cpp │ ├── transaction_sighash_v1.cpp │ ├── witness.cpp │ └── witness_extract.cpp ├── config │ ├── base16.cpp │ ├── base2.cpp │ ├── base32.cpp │ ├── base58.cpp │ ├── base64.cpp │ ├── base85.cpp │ ├── block.cpp │ ├── hash160.cpp │ ├── hash256.cpp │ ├── header.cpp │ ├── input.cpp │ ├── output.cpp │ ├── parameter.cpp │ ├── parser.cpp │ ├── point.cpp │ ├── printer.cpp │ ├── script.cpp │ └── transaction.cpp ├── crypto │ ├── aes256.cpp │ ├── der_parser.cpp │ ├── ec_context.cpp │ ├── ec_context.hpp │ ├── pseudo_random.cpp │ ├── ring_signature.cpp │ └── secp256k1.cpp ├── data │ ├── data_chunk.cpp │ └── string.cpp ├── define.cpp ├── endian │ └── endian.cpp ├── error │ ├── block_error_t.cpp │ ├── error_t.cpp │ ├── errorno_t.cpp │ ├── op_error_t.cpp │ ├── script_error_t.cpp │ └── transaction_error_t.cpp ├── filter │ └── golomb.cpp ├── hash │ ├── accumulator.cpp │ ├── checksum.cpp │ └── siphash.cpp ├── math │ └── math.cpp ├── radix │ ├── base_10.cpp │ ├── base_2048.cpp │ ├── base_32.cpp │ ├── base_58.cpp │ ├── base_64.cpp │ └── base_85.cpp ├── serial │ └── props.cpp ├── settings.cpp ├── stream │ └── binary.cpp ├── unicode │ ├── ascii.cpp │ ├── code_points.cpp │ ├── conversion.cpp │ ├── normalization.cpp │ └── utf8_everywhere │ │ ├── console_streambuf.cpp │ │ ├── environment.cpp │ │ ├── ifstream.cpp │ │ ├── ofstream.cpp │ │ ├── paths.cpp │ │ ├── stdio.cpp │ │ ├── unicode_istream.cpp │ │ ├── unicode_ostream.cpp │ │ └── unicode_streambuf.cpp ├── wallet │ ├── addresses │ │ ├── bitcoin_uri.cpp │ │ ├── payment_address.cpp │ │ ├── qr_code.cpp │ │ ├── qrencode │ │ │ ├── bitstream.c │ │ │ ├── bitstream.h │ │ │ ├── mask.c │ │ │ ├── mask.h │ │ │ ├── mmask.c │ │ │ ├── mmask.h │ │ │ ├── mqrspec.c │ │ │ ├── mqrspec.h │ │ │ ├── qrencode.c │ │ │ ├── qrencode.h │ │ │ ├── qrencode_inner.h │ │ │ ├── qrinput.c │ │ │ ├── qrinput.h │ │ │ ├── qrspec.c │ │ │ ├── qrspec.h │ │ │ ├── rsecc.c │ │ │ ├── rsecc.h │ │ │ ├── split.c │ │ │ └── split.h │ │ ├── stealth_address.cpp │ │ ├── stealth_receiver.cpp │ │ ├── stealth_sender.cpp │ │ ├── tiff.cpp │ │ ├── uri.cpp │ │ └── witness_address.cpp │ ├── context.cpp │ ├── keys │ │ ├── ec_point.cpp │ │ ├── ec_private.cpp │ │ ├── ec_public.cpp │ │ ├── ec_scalar.cpp │ │ ├── ek_private.cpp │ │ ├── ek_public.cpp │ │ ├── ek_token.cpp │ │ ├── encrypted_keys.cpp │ │ ├── hd_private.cpp │ │ ├── hd_public.cpp │ │ ├── mini_keys.cpp │ │ ├── parse_encrypted_keys │ │ │ ├── parse_encrypted_key.hpp │ │ │ ├── parse_encrypted_key.ipp │ │ │ ├── parse_encrypted_prefix.hpp │ │ │ ├── parse_encrypted_prefix.ipp │ │ │ ├── parse_encrypted_private.cpp │ │ │ ├── parse_encrypted_private.hpp │ │ │ ├── parse_encrypted_public.cpp │ │ │ ├── parse_encrypted_public.hpp │ │ │ ├── parse_encrypted_token.cpp │ │ │ └── parse_encrypted_token.hpp │ │ └── stealth.cpp │ ├── message.cpp │ ├── mnemonics │ │ ├── electrum.cpp │ │ ├── electrum_v1.cpp │ │ └── mnemonic.cpp │ ├── neutrino.cpp │ ├── point_value.cpp │ └── points_value.cpp └── words │ ├── catalogs │ ├── electrum.cpp │ ├── electrum_v1.cpp │ └── mnemonic.cpp │ └── languages.cpp └── test ├── .gitignore ├── allocator.cpp ├── arena.cpp ├── chain ├── annex.cpp ├── block.cpp ├── block_malleable.cpp ├── chain_state.cpp ├── checkpoint.cpp ├── compact.cpp ├── context.cpp ├── enums │ └── opcode.cpp ├── header.cpp ├── input.cpp ├── operation.cpp ├── output.cpp ├── point.cpp ├── satoshi_words.cpp ├── script.cpp ├── script.hpp ├── stripper.cpp ├── taproot.cpp ├── tapscript.cpp ├── transaction.cpp └── witness.cpp ├── config ├── base16.cpp ├── base2.cpp ├── base32.cpp ├── base58.cpp ├── base64.cpp ├── base85.cpp ├── block.cpp ├── hash256.cpp ├── parameter.cpp └── printer.cpp ├── constants.cpp ├── constraints.cpp ├── crypto ├── aes256.cpp ├── elliptic_curve.cpp ├── pseudo_random.cpp └── ring_signature.cpp ├── data ├── array_cast.cpp ├── byte_cast.cpp ├── collection.cpp ├── data_array.cpp ├── data_chunk.cpp ├── data_reference.cpp ├── data_slab.cpp ├── data_slice.cpp ├── exclusive_slice.cpp ├── external_ptr.cpp ├── integer.cpp ├── iterable.cpp ├── memory.cpp ├── no_fill_allocator.cpp └── string.cpp ├── define.cpp ├── endian ├── batch.cpp ├── integers.cpp ├── integrals.cpp ├── minimal.cpp ├── nominal.cpp ├── stream.cpp ├── swaps.cpp ├── uintx_t.cpp └── unsafe.cpp ├── error ├── block_error_t.cpp ├── error.cpp ├── error_t.cpp ├── errorno_t.cpp ├── op_error_t.cpp ├── script_error_t.cpp └── transaction_error_t.cpp ├── filter ├── bloom.cpp ├── golomb.cpp └── sieve.cpp ├── funclets.cpp ├── hacks.cpp ├── hash ├── accumulator.cpp ├── checksum.cpp ├── functions.cpp ├── hash.hpp ├── hmac.cpp ├── pbkd.cpp ├── performance │ ├── baseline │ │ ├── byteswap.h │ │ ├── common.h │ │ ├── endian.h │ │ ├── rmd160.cpp │ │ ├── rmd160.h │ │ ├── sha256.cpp │ │ └── sha256.h │ ├── performance.cpp │ └── performance.hpp ├── rmd │ ├── algorithm.cpp │ └── analysis.cpp ├── scrypt.cpp ├── sha │ ├── algorithm.cpp │ ├── analysis.cpp │ ├── sha160.cpp │ ├── sha256.cpp │ ├── sha512.cpp │ └── vector.cpp ├── siphash.cpp └── siphash.hpp ├── intrinsics ├── byte_swap.cpp ├── cpuid.cpp ├── detection.cpp ├── intel_128.cpp ├── intel_256.cpp ├── intel_512.cpp ├── platforms │ ├── intel.cpp │ ├── neon.cpp │ └── sve.cpp ├── rotate.cpp └── types.cpp ├── literals.cpp ├── machine ├── interpreter.cpp ├── number.cpp ├── program.cpp ├── sizing.cpp └── stack.cpp ├── main.cpp ├── math ├── addition.cpp ├── bits.cpp ├── bytes.cpp ├── byteswap.cpp ├── cast.cpp ├── division.cpp ├── limits.cpp ├── logarithm.cpp ├── multiplication.cpp ├── overflow.cpp ├── power.cpp ├── rotate.cpp └── sign.cpp ├── radix ├── base_10.cpp ├── base_16.cpp ├── base_2048.cpp ├── base_2n.cpp ├── base_32.cpp ├── base_58.cpp ├── base_64.cpp └── base_85.cpp ├── serial ├── deserialize.cpp ├── props.cpp └── serialize.cpp ├── settings.cpp ├── stream ├── binary.cpp ├── device.cpp ├── devices │ ├── copy_sink.cpp │ ├── copy_source.cpp │ ├── flip_sink.cpp │ └── push_sink.cpp ├── iostream │ ├── iostream.cpp │ ├── istream.cpp │ └── ostream.cpp ├── stream.cpp ├── streamers.cpp └── streamers │ ├── bit_flipper.cpp │ ├── bit_reader.cpp │ ├── bit_writer.cpp │ ├── byte_flipper.cpp │ ├── byte_reader.cpp │ ├── byte_writer.cpp │ ├── sha256_writer.cpp │ ├── sha256t_writer.cpp │ └── sha256x2_writer.cpp ├── test.cpp ├── test.hpp ├── typelets.cpp ├── types.cpp ├── unicode ├── ascii.cpp ├── code_points.cpp ├── conversion.cpp ├── normalization.cpp └── utf8_everywhere │ ├── environment.cpp │ ├── ifstream.cpp │ ├── ofstream.cpp │ ├── unicode_istream.cpp │ └── unicode_ostream.cpp ├── utreexo ├── utreexo.cpp └── utreexo.hpp ├── wallet ├── addresses │ ├── bitcoin_uri.cpp │ ├── checked.cpp │ ├── payment_address.cpp │ ├── qr_code.cpp │ ├── stealth_address.cpp │ ├── stealth_receiver.cpp │ ├── stealth_sender.cpp │ ├── tiff.cpp │ ├── uri.cpp │ ├── uri_reader.cpp │ └── witness_address.cpp ├── context.cpp ├── keys │ ├── ec_point.cpp │ ├── ec_private.cpp │ ├── ec_public.cpp │ ├── ec_scalar.cpp │ ├── encrypted_keys.cpp │ ├── hd_private.cpp │ ├── hd_public.cpp │ ├── mini_keys.cpp │ └── stealth.cpp ├── message.cpp ├── mnemonics │ ├── electrum.cpp │ ├── electrum.hpp │ ├── electrum_v1.cpp │ ├── electrum_v1.hpp │ ├── mnemonic.cpp │ └── mnemonic.hpp ├── neutrino.cpp ├── point_value.cpp └── points_value.cpp └── words ├── catalogs ├── electrum.cpp ├── electrum.hpp ├── electrum_v1.cpp ├── electrum_v1.hpp ├── mnemonic.cpp └── mnemonic.hpp ├── dictionaries.cpp ├── dictionaries.hpp ├── dictionary.cpp ├── dictionary.hpp ├── languages.cpp └── languages.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | .libs 3 | *.la 4 | *.lo 5 | *.o 6 | *.pyc 7 | Makefile 8 | Makefile.in 9 | libbitcoin.pc 10 | 11 | bin 12 | obj 13 | build 14 | .*.swp 15 | *~ 16 | /*.kdev4 17 | /.cproject 18 | /.project 19 | /.settings 20 | /nbproject 21 | 22 | /aclocal.m4 23 | /autom4te.cache 24 | /build-aux 25 | /config.* 26 | /configure 27 | /libtool 28 | .dirstamp 29 | /.vs 30 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(gdb) Launch", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/obj/nix-gnu-debug-static-without_icu/libbitcoin-system-test", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${workspaceFolder}/obj/nix-gnu-debug-static-without_icu", 15 | "environment": [], 16 | "externalConsole": false, 17 | "MIMode": "gdb", 18 | "setupCommands": [ 19 | { 20 | "description": "Enable pretty-printing for gdb", 21 | "text": "-enable-pretty-printing", 22 | "ignoreFailures": true 23 | }, 24 | { 25 | "description": "Set Disassembly Flavor to Intel", 26 | "text": "-gdb-set disassembly-flavor intel", 27 | "ignoreFailures": true 28 | } 29 | ] 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.sourceDirectory": "${workspaceFolder}/builds/cmake", 3 | "cmake.useCMakePresets": "always" 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "cmake", 6 | "label": "CMake: build", 7 | "command": "build", 8 | "targets": [ 9 | "bitcoin-system", 10 | "libbitcoin-system-examples", 11 | "libbitcoin-system-test" 12 | ], 13 | "preset": "${command:cmake.activeBuildPresetName}", 14 | "group": "build", 15 | "problemMatcher": [], 16 | "detail": "CMake template build task" 17 | }, 18 | { 19 | "type": "cmake", 20 | "label": "CMake: clean", 21 | "command": "clean", 22 | "preset": "${command:cmake.activeBuildPresetName}", 23 | "problemMatcher": [], 24 | "detail": "CMake template clean task" 25 | }, 26 | { 27 | "type": "cmake", 28 | "label": "CMake: install", 29 | "command": "install", 30 | "preset": "${command:cmake.activeBuildPresetName}", 31 | "problemMatcher": [], 32 | "detail": "CMake template install task" 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | commits libbitcoin developers 2 | -------------------------------------------- 3 | 2572 Eric Voskuil (evoskuil) 4 | 1256 Amir Taaki (genjix) 5 | 196 Phillip Mienk (pmienk) 6 | 90 William Swanson (swansontec) 7 | 50 Neill Miller (thecodefactory) 8 | 39 Kamil Domański (kdomanski) 9 | 26 Patrick Strateman (phantomcircuit) 10 | 25 Pablo Castellano (pablog) 11 | 19 Yarvis Hatsa 12 | 11 Robert Williamson (bobalot) 13 | 9 RojavaCrypto 14 | 5 Noel Maersk (veox) 15 | 4 Jan Engelhardt 16 | 4 Peter Hille 17 | 2 Shawn David Pringle 18 | 2 mlmikael 19 | 2 Jake Hickey (shunyata) 20 | 1 Alexander Regueiro 21 | 1 Andy Weidenbaum 22 | 1 Bardi Harborow 23 | 1 Ben Holden-Crowther 24 | 1 Chang Lan 25 | 1 Dave Huseby 26 | 1 Dimitri John Ledkov 27 | 1 Jaromil 28 | 1 Kevin Johnson 29 | 1 Omid Aladini 30 | 1 Rafał Krupiński 31 | 1 Lucas Betschart (lclc) 32 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | Use command 'git log --oneline --decorate' for latest change log. 2 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | See https://libbitcoin.org -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | See README.md -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ############################################################################### 3 | # Copyright (c) 2014-2025 libbitcoin-system developers (see COPYING). 4 | # 5 | # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY 6 | # 7 | ############################################################################### 8 | 9 | autoreconf -i 10 | -------------------------------------------------------------------------------- /builds/cmake/modules/FindDl.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Copyright (c) 2014-2025 libbitcoin developers (see COPYING). 3 | # 4 | ############################################################################### 5 | # Finddl 6 | # 7 | # Use this module by invoking find_package with the form:: 8 | # 9 | # find_package( dl 10 | # [REQUIRED] # Fail with error if dl is not found 11 | # ) 12 | # 13 | # Defines the following for use: 14 | # 15 | # dl_FOUND - True if headers and requested libraries were found 16 | # dl_LIBRARIES - dl libraries to be linked 17 | # dl_LIBS - dl libraries to be linked 18 | # 19 | 20 | if (DEFINED dl_FIND_VERSION) 21 | message( SEND_ERROR "Library 'dl' unable to process specified version: ${dl_FIND_VERSION}" ) 22 | endif() 23 | 24 | if (MSVC) 25 | message( STATUS "MSVC environment detection for 'dl' not currently supported." ) 26 | set( dl_FOUND false ) 27 | else () 28 | # required 29 | if ( dl_FIND_REQUIRED ) 30 | set( _dl_REQUIRED "REQUIRED" ) 31 | endif() 32 | 33 | find_library(dl_LIBRARIES dl) 34 | 35 | if (dl_LIBRARIES-NOTFOUND) 36 | set( dl_FOUND false ) 37 | else () 38 | set( dl_FOUND true ) 39 | set( dl_LIBS "-ldl" ) 40 | endif() 41 | endif() 42 | 43 | if ( dl_FIND_REQUIRED AND ( NOT dl_FOUND ) ) 44 | message( SEND_ERROR "Library 'dl' not found." ) 45 | endif() 46 | -------------------------------------------------------------------------------- /builds/cmake/modules/FindRt.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Copyright (c) 2014-2025 libbitcoin developers (see COPYING). 3 | # 4 | ############################################################################### 5 | # Findrt 6 | # 7 | # Use this module by invoking find_package with the form:: 8 | # 9 | # find_package( rt 10 | # [REQUIRED] # Fail with error if rt is not found 11 | # ) 12 | # 13 | # Defines the following for use: 14 | # 15 | # rt_FOUND - True if headers and requested libraries were found 16 | # rt_LIBRARIES - rt libraries to be linked 17 | # rt_LIBS - rt libraries to be linked 18 | # 19 | 20 | if (DEFINED rt_FIND_VERSION) 21 | message( SEND_ERROR 22 | "Library 'rt' unable to process version: ${rt_FIND_VERSION}" ) 23 | endif() 24 | 25 | if (MSVC) 26 | message( STATUS 27 | "MSVC environment detection for rt not currently supported." ) 28 | 29 | set( rt_FOUND false ) 30 | elseif (ANDROID) 31 | message( STATUS 32 | "ANDROID enviornment detection for rt skipped, provided by libc." ) 33 | 34 | set( rt_FOUND true ) 35 | else () 36 | # required 37 | if ( rt_FIND_REQUIRED ) 38 | set( _rt_REQUIRED "REQUIRED" ) 39 | endif() 40 | 41 | find_library(rt_LIBRARIES rt) 42 | 43 | if (rt_LIBRARIES-NOTFOUND) 44 | set( rt_FOUND false ) 45 | else () 46 | set( rt_FOUND true ) 47 | set( rt_LIBS "-lrt" ) 48 | endif() 49 | endif() 50 | 51 | if ( rt_FIND_REQUIRED AND ( NOT rt_FOUND ) ) 52 | message( SEND_ERROR "Library 'rt' not found." ) 53 | endif() 54 | -------------------------------------------------------------------------------- /builds/msvc/.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.json 3 | *.suo 4 | *.opensdf 5 | *.sdf 6 | *.log 7 | *.aps 8 | *.user 9 | *.ipch 10 | *.VC.* 11 | *.vsidx 12 | -------------------------------------------------------------------------------- /builds/msvc/build/build_all.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | CALL nuget_all.bat 3 | ECHO. 4 | CALL build_base.bat vs2022 libbitcoin-system "Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build" 5 | CALL build_base.bat vs2019 libbitcoin-system "Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build" 6 | CALL build_base.bat vs2017 libbitcoin-system "Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build" 7 | REM CALL build_base.bat vs2015 libbitcoin-system "Microsoft Visual Studio 14.0\VC" 8 | REM CALL build_base.bat vs2013 libbitcoin-system "Microsoft Visual Studio 12.0\VC" 9 | PAUSE 10 | -------------------------------------------------------------------------------- /builds/msvc/build/build_base.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | REM Usage: [buildbase.bat vs2017 libbitcoin "Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"] 3 | REM Usage: [buildbase.bat vs2015 libbitcoin "Microsoft Visual Studio 14.0\VC"] 4 | REM Usage: [buildbase.bat vs2013 libbitcoin "Microsoft Visual Studio 12.0\VC"] 5 | 6 | SET studio=%1 7 | SET project=%2 8 | SET version=%~3 9 | 10 | SET log=%studio%.log 11 | SET solution=..\%studio%\%project%.sln 12 | SET tools=%version%\vcvarsall.bat 13 | SET environment=%programfiles(x86)%\%tools% 14 | 15 | IF NOT EXIST "%environment%" SET environment=%programfiles%\%tools% 16 | IF NOT EXIST "%environment%" GOTO no_tools 17 | 18 | ECHO Building: %solution% 19 | 20 | CALL "%environment%" x86 > nul 21 | ECHO Platform=x86 22 | 23 | ECHO Configuration=StaticDebug 24 | msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=Win32 %solution% >> %log% 25 | IF errorlevel 1 GOTO error 26 | ECHO Configuration=StaticRelease 27 | msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=Win32 %solution% >> %log% 28 | IF errorlevel 1 GOTO error 29 | 30 | CALL "%environment%" x86_amd64 > nul 31 | ECHO Platform=x64 32 | 33 | ECHO Configuration=StaticDebug 34 | msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=x64 %solution% >> %log% 35 | IF errorlevel 1 GOTO error 36 | ECHO Configuration=StaticRelease 37 | msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=x64 %solution% >> %log% 38 | IF errorlevel 1 GOTO error 39 | 40 | ECHO Complete: %solution% 41 | GOTO end 42 | 43 | :error 44 | ECHO *** ERROR, build terminated early, see: %log% 45 | GOTO end 46 | 47 | :no_tools 48 | ECHO *** ERROR, build tools not found: %tools% 49 | 50 | :end 51 | 52 | -------------------------------------------------------------------------------- /builds/msvc/build/nuget_all.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | ECHO Downloading libbitcoin vs2022 dependencies from NuGet 3 | CALL nuget.exe install ..\vs2022\libbitcoin-system\packages.config 4 | CALL nuget.exe install ..\vs2022\libbitcoin-system-examples\packages.config 5 | CALL nuget.exe install ..\vs2022\libbitcoin-system-test\packages.config 6 | ECHO. 7 | ECHO Downloading libbitcoin vs2019 dependencies from NuGet 8 | CALL nuget.exe install ..\vs2019\libbitcoin-system\packages.config 9 | CALL nuget.exe install ..\vs2019\libbitcoin-system-examples\packages.config 10 | CALL nuget.exe install ..\vs2019\libbitcoin-system-test\packages.config 11 | ECHO. 12 | ECHO Downloading libbitcoin vs2017 dependencies from NuGet 13 | CALL nuget.exe install ..\vs2017\libbitcoin-system\packages.config 14 | CALL nuget.exe install ..\vs2017\libbitcoin-system-examples\packages.config 15 | CALL nuget.exe install ..\vs2017\libbitcoin-system-test\packages.config 16 | -------------------------------------------------------------------------------- /builds/msvc/debug.natvis: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | { m_backend } 13 | 14 | 15 | 16 | 17 | { m_data } 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /builds/msvc/nuget.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /builds/msvc/properties/Arm.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>ARM32 Settings 6 | 7 | 8 | 9 | 10 | 13 | WIN32;_WIN32;_ARM_;%(PreprocessorDefinitions) 14 | 15 | 16 | MachineARM 17 | 18 | 19 | /MACHINE:ARM %(AdditionalOptions) 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /builds/msvc/properties/Arm64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>ARM64 Settings 6 | 7 | 8 | 9 | 10 | 13 | WIN32;_WIN32;_ARM64;%(PreprocessorDefinitions) 14 | 15 | 16 | MachineARM64 17 | 18 | 19 | /MACHINE:ARM64 %(AdditionalOptions) 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /builds/msvc/properties/DLL.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Dynamic Library 6 | dynamic 7 | .dll 8 | 9 | 10 | 11 | 12 | _DLL;_WINDLL;%(PreprocessorDefinitions) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /builds/msvc/properties/Debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <_PropertySheetDisplayName>Debug Settings 10 | Debug 11 | 12 | 13 | 14 | 15 | 16 | EnableFastChecks 17 | ProgramDatabase 18 | true 19 | true 20 | Disabled 21 | _DEBUG;%(PreprocessorDefinitions) 22 | 23 | 24 | _DEBUG;%(PreprocessorDefinitions) 25 | 26 | 27 | true 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /builds/msvc/properties/DebugDEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Debug Dynamic 6 | dynamic 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDebugDLL 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/DebugDLL.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Dynamic Debug Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreadedDebugDLL 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /builds/msvc/properties/DebugLEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Debug Link Time Code Generation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDebug 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/DebugLIB.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Debug Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreadedDebug 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /builds/msvc/properties/DebugLTCG.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Debug Link Time Code Generation Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreadedDebug 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /builds/msvc/properties/DebugSEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Debug Static 6 | static 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDebug 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/EXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Application 6 | true 7 | 8 | 9 | 10 | 11 | _CONSOLE;%(PreprocessorDefinitions) 12 | 13 | 14 | Console 15 | 16 | 17 | -------------------------------------------------------------------------------- /builds/msvc/properties/LIB.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Library 6 | static 7 | .lib 8 | 9 | 10 | 11 | 12 | _LIB;%(PreprocessorDefinitions) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /builds/msvc/properties/LTCG.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Link Time Code Generation Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /builds/msvc/properties/Link.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Link Time Code Generation Settings 6 | ltcg 7 | 8 | 9 | 10 | 11 | true 12 | 13 | 14 | UseLinkTimeCodeGeneration 15 | 16 | 17 | true 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /builds/msvc/properties/Messages.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Build Messages 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /builds/msvc/properties/Output.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Output Settings 6 | 7 | $(ProjectDir)..\..\ 8 | $(ProjectDir)..\..\..\..\ 9 | $(ProjectDir)..\..\..\..\..\ 10 | $(ProjectDir)..\..\..\..\bin\$(PlatformName)\$(DebugOrRelease)\$(PlatformToolset)\$(DefaultLinkage)\ 11 | $(ProjectDir)..\..\..\..\obj\$(TargetName)\$(PlatformName)\$(DebugOrRelease)\$(PlatformToolset)\$(DefaultLinkage)\ 12 | $(OutDir) 13 | $(TargetName) 14 | $(TargetDir)$(TargetName)$(TargetExt) 15 | 16 | 17 | 18 | 19 | $(OutDir)$(TargetName).lib 20 | 21 | 22 | $(OutDir)$(TargetName).log 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /builds/msvc/properties/ReleaseDEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Release Dynamic 6 | dynamic 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreadedDLL 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/ReleaseDLL.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Dynamic Release Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreadedDLL 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /builds/msvc/properties/ReleaseLEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Release Link Time Code Generation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreaded 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/ReleaseLIB.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Release Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreaded 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /builds/msvc/properties/ReleaseLTCG.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Static Release Link Time Code Generation Library 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | MultiThreaded 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /builds/msvc/properties/ReleaseSEXE.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>Console Release Static 6 | static 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | MultiThreaded 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/Win32.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>x86 Settings 6 | 7 | 8 | 9 | 10 | WIN32;_WIN32;%(PreprocessorDefinitions) 11 | 12 | 13 | MachineX86 14 | 15 | 16 | /MACHINE:X86 %(AdditionalOptions) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /builds/msvc/properties/x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | <_PropertySheetDisplayName>x64 Settings 6 | 7 | 8 | 9 | 10 | 13 | WIN32;_WIN32;WIN64;_WIN64;%(PreprocessorDefinitions) 14 | 15 | 16 | MachineX64 17 | 18 | 19 | /MACHINE:X64 %(AdditionalOptions) 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /builds/msvc/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/builds/msvc/resource.h -------------------------------------------------------------------------------- /builds/msvc/resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/builds/msvc/resource.rc -------------------------------------------------------------------------------- /builds/msvc/vs2022/.vs/libbitcoin-system/FileContentIndex/.gitignore: -------------------------------------------------------------------------------- 1 | *.vsidx 2 | *.lock 3 | -------------------------------------------------------------------------------- /builds/msvc/vs2022/libbitcoin-system-examples/libbitcoin-system-examples.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | {B726DF7D-6D1D-48FB-0000-000000000001} 12 | 13 | 14 | {B726DF7D-6D1D-48FB-0000-000000000000} 15 | 16 | 17 | 18 | 19 | src 20 | 21 | 22 | 23 | 24 | resource 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | resource 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /builds/msvc/vs2022/libbitcoin-system-examples/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /builds/msvc/vs2022/libbitcoin-system-test/libbitcoin-system-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /builds/msvc/vs2022/libbitcoin-system-test/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /builds/msvc/vs2022/libbitcoin-system/libbitcoin-system.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 29 | 30 | -------------------------------------------------------------------------------- /builds/msvc/vs2022/libbitcoin-system/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /builds/vscode/system.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "../../../libbitcoin-system" 5 | } 6 | ], 7 | "settings": {} 8 | } 9 | -------------------------------------------------------------------------------- /doc/historic/README: -------------------------------------------------------------------------------- 1 | This is the historic founding document behind libbitcoin. 2 | 3 | -------------------------------------------------------------------------------- /doc/historic/inner_core.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/inner_core.png -------------------------------------------------------------------------------- /doc/historic/make_transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/make_transaction.png -------------------------------------------------------------------------------- /doc/historic/multiple_currencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/multiple_currencies.png -------------------------------------------------------------------------------- /doc/historic/pluggable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/pluggable.png -------------------------------------------------------------------------------- /doc/historic/python_layer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/python_layer.png -------------------------------------------------------------------------------- /doc/historic/switching_nets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/switching_nets.png -------------------------------------------------------------------------------- /doc/historic/switching_serialisers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/doc/historic/switching_serialisers.png -------------------------------------------------------------------------------- /include/bitcoin/system/chain/context.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_CONTEXT_HPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_CONTEXT_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | namespace chain { 29 | 30 | class BC_API context final 31 | { 32 | public: 33 | /// Determine if the flag is active for this block. 34 | bool is_enabled(chain::flags flag) const NOEXCEPT; 35 | 36 | /// Header context within chain. 37 | uint32_t flags; 38 | uint32_t timestamp; 39 | uint32_t median_time_past; 40 | size_t height; 41 | uint32_t minimum_block_version; 42 | uint32_t work_required; 43 | }; 44 | 45 | bool operator==(const context& left, const context& right) NOEXCEPT; 46 | bool operator!=(const context& left, const context& right) NOEXCEPT; 47 | 48 | } // namespace chain 49 | } // namespace system 50 | } // namespace libbitcoin 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/bitcoin/system/chain/enums/extension.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_ENUMS_EXTENSION_HPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_ENUMS_EXTENSION_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace chain { 27 | 28 | /// An integer in range 0-127 used for indicating extensions are appended to 29 | /// the output of signature hash message [bip141]. 30 | enum class extension : uint8_t 31 | { 32 | /// Undocumented, from Satoshi source. 33 | taproot = 0, 34 | 35 | /// We define the tapscript message extension ext to bip341 Common 36 | /// Signature Message, indicated by extension flag of 1 [bip342]. 37 | tapscript = 1 38 | }; 39 | 40 | } // namespace chain 41 | } // namespace system 42 | } // namespace libbitcoin 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/bitcoin/system/chain/enums/key_version.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_ENUMS_KEY_VERSION_HPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_ENUMS_KEY_VERSION_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace chain { 27 | 28 | /// For future extensions that define unknown public key types, making sure 29 | /// signatures can't be moved from one key type to another [bip342]. 30 | enum class key_version : uint8_t 31 | { 32 | /// Version of public keys in the tapscript signature opcode execution. 33 | tapscript = 0 34 | }; 35 | 36 | } // namespace chain 37 | } // namespace system 38 | } // namespace libbitcoin 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/bitcoin/system/chain/enums/policy.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_ENUMS_POLICIES_HPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_ENUMS_POLICIES_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace chain { 28 | 29 | /// Analog to chain::flags but without impacting validation. These provide 30 | /// additional validation context, giving a node the option to reject an 31 | /// unconfirmed transaction. 32 | enum policy : uint32_t 33 | { 34 | no_policy = 0, 35 | 36 | /// Mask to set all rule bits. 37 | all_policy = bit_all 38 | }; 39 | 40 | } // namespace chain 41 | } // namespace system 42 | } // namespace libbitcoin 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/bitcoin/system/chain/enums/script_version.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_ENUMS_SCRIPT_VERSION_HPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_ENUMS_SCRIPT_VERSION_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace chain { 27 | 28 | /// Script versions [bip141]. 29 | enum class script_version 30 | { 31 | /// If the version byte is 0 (either P2WPKH or P2WSH or invalid) [bip141]. 32 | segwit = 0, 33 | 34 | /// Taproot output is native segwit output with version number 1 [bip341]. 35 | taproot = 1, 36 | 37 | /// All reserved script versions [2..16]. 38 | reserved, 39 | 40 | /// All unversioned scripts. 41 | unversioned 42 | }; 43 | 44 | } // namespace chain 45 | } // namespace system 46 | } // namespace libbitcoin 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/bitcoin/system/chain/enums/selection.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_ENUMS_SELECTION_HPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_ENUMS_SELECTION_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace chain { 27 | 28 | /// Network selection for settings construction. 29 | enum class selection 30 | { 31 | none, 32 | mainnet, 33 | testnet, 34 | regtest 35 | }; 36 | 37 | } // namespace config 38 | } // namespace system 39 | } // namespace libbitcoin 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/base2.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_BASE2_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_BASE2_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for base2 encoded data. 30 | class BC_API base2 final 31 | { 32 | public: 33 | base2() NOEXCEPT; 34 | base2(binary&& value) NOEXCEPT; 35 | base2(const binary& value) NOEXCEPT; 36 | base2(const std::string& binary) THROWS; 37 | 38 | operator const binary&() const NOEXCEPT; 39 | 40 | friend std::istream& operator>>(std::istream& stream, 41 | base2& argument) THROWS; 42 | friend std::ostream& operator<<(std::ostream& stream, 43 | const base2& argument) NOEXCEPT; 44 | 45 | private: 46 | binary value_; 47 | }; 48 | 49 | } // namespace config 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/base32.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_BASE32_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_BASE32_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for base32 encoded data. 30 | class BC_API base32 final 31 | { 32 | public: 33 | base32() NOEXCEPT; 34 | base32(data_chunk&& value) NOEXCEPT; 35 | base32(const data_chunk& value) NOEXCEPT; 36 | base32(const std::string& base32) THROWS; 37 | 38 | operator const data_chunk&() const NOEXCEPT; 39 | 40 | friend std::istream& operator>>(std::istream& stream, 41 | base32& argument) THROWS; 42 | friend std::ostream& operator<<(std::ostream& stream, 43 | const base32& argument) NOEXCEPT; 44 | 45 | private: 46 | data_chunk value_; 47 | }; 48 | 49 | } // namespace config 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/base58.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_BASE58_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_BASE58_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for base58 encoded text. 30 | class BC_API base58 final 31 | { 32 | public: 33 | base58() NOEXCEPT; 34 | base58(data_chunk&& value) NOEXCEPT; 35 | base58(const data_chunk& value) NOEXCEPT; 36 | base58(const std::string& base58) THROWS; 37 | 38 | operator const data_chunk&() const NOEXCEPT; 39 | 40 | friend std::istream& operator>>(std::istream& stream, 41 | base58& argument) THROWS; 42 | friend std::ostream& operator<<(std::ostream& stream, 43 | const base58& argument) NOEXCEPT; 44 | 45 | private: 46 | data_chunk value_; 47 | }; 48 | 49 | } // namespace config 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/base64.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_BASE64_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_BASE64_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for base64 encoded data. 30 | class BC_API base64 final 31 | { 32 | public: 33 | base64() NOEXCEPT; 34 | base64(data_chunk&& value) NOEXCEPT; 35 | base64(const data_chunk& value) NOEXCEPT; 36 | base64(const std::string& base64) THROWS; 37 | 38 | operator const data_chunk&() const NOEXCEPT; 39 | 40 | friend std::istream& operator>>(std::istream& stream, 41 | base64& argument) THROWS; 42 | friend std::ostream& operator<<(std::ostream& stream, 43 | const base64& argument) NOEXCEPT; 44 | 45 | private: 46 | data_chunk value_; 47 | }; 48 | 49 | } // namespace config 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/block.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_BLOCK_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_BLOCK_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for chain::block. 30 | class BC_API block final 31 | : public chain::block 32 | { 33 | public: 34 | block() NOEXCEPT; 35 | block(chain::block&& value) NOEXCEPT; 36 | block(const chain::block& value) NOEXCEPT; 37 | block(const std::string& base16) THROWS; 38 | 39 | std::string to_string() const NOEXCEPT; 40 | 41 | friend std::istream& operator>>(std::istream& stream, 42 | block& argument) THROWS; 43 | friend std::ostream& operator<<(std::ostream& stream, 44 | const block& argument) NOEXCEPT; 45 | }; 46 | 47 | } // namespace config 48 | } // namespace system 49 | } // namespace libbitcoin 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/config.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_CONFIG_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_CONFIG_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/hash160.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_HASH160_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_HASH160_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for a bitcoin 160 bit hash. 30 | class BC_API hash160 final 31 | { 32 | public: 33 | hash160() NOEXCEPT; 34 | hash160(short_hash&& value) NOEXCEPT; 35 | hash160(const short_hash& value) NOEXCEPT; 36 | hash160(const std::string& base16) THROWS; 37 | 38 | operator const short_hash&() const NOEXCEPT; 39 | 40 | friend std::istream& operator>>(std::istream& stream, 41 | hash160& argument) THROWS; 42 | friend std::ostream& operator<<(std::ostream& stream, 43 | const hash160& argument) NOEXCEPT; 44 | 45 | private: 46 | short_hash value_; 47 | }; 48 | 49 | } // namespace config 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/header.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_HEADER_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_HEADER_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for chain::header. 30 | class BC_API header final 31 | : public chain::header 32 | { 33 | public: 34 | header() NOEXCEPT; 35 | header(chain::header&& value) NOEXCEPT; 36 | header(const chain::header& value) NOEXCEPT; 37 | header(const std::string& base16) THROWS; 38 | 39 | ////std::string to_string() const NOEXCEPT; 40 | 41 | friend std::istream& operator>>(std::istream& stream, 42 | header& argument) THROWS; 43 | friend std::ostream& operator<<(std::ostream& stream, 44 | const header& argument) NOEXCEPT; 45 | }; 46 | 47 | } // namespace config 48 | } // namespace system 49 | } // namespace libbitcoin 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/input.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_INPUT_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_INPUT_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for chain::input. 30 | class BC_API input final 31 | : public chain::input 32 | { 33 | public: 34 | input() NOEXCEPT; 35 | input(chain::input&& value) NOEXCEPT; 36 | input(const chain::input& value) NOEXCEPT; 37 | input(const std::string& tuple) THROWS; 38 | 39 | ////std::string to_string() const NOEXCEPT; 40 | 41 | friend std::istream& operator>>(std::istream& stream, 42 | input& argument) THROWS; 43 | friend std::ostream& operator<<(std::ostream& stream, 44 | const input& argument) NOEXCEPT; 45 | }; 46 | 47 | } // namespace explorer 48 | } // namespace system 49 | } // namespace libbitcoin 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/output.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_OUTPUT_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_OUTPUT_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for chain::output. 30 | class BC_API output final 31 | : public chain::output 32 | { 33 | public: 34 | output() NOEXCEPT; 35 | output(chain::output&& value) NOEXCEPT; 36 | output(const chain::output& value) NOEXCEPT; 37 | output(const std::string& tuple) THROWS; 38 | 39 | ////std::string to_string() const NOEXCEPT; 40 | 41 | friend std::istream& operator>>(std::istream& stream, 42 | output& argument) THROWS; 43 | friend std::ostream& operator<<(std::ostream& stream, 44 | const output& argument) NOEXCEPT; 45 | }; 46 | 47 | } // namespace config 48 | } // namespace system 49 | } // namespace libbitcoin 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/point.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CONFIG_POINT_HPP 20 | #define LIBBITCOIN_SYSTEM_CONFIG_POINT_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for chain::point. 30 | class BC_API point final 31 | : public chain::point 32 | { 33 | public: 34 | static const std::string delimiter; 35 | 36 | point() NOEXCEPT; 37 | point(chain::point&& value) NOEXCEPT; 38 | point(const chain::point& value) NOEXCEPT; 39 | point(const std::string& tuple) THROWS; 40 | 41 | ////std::string to_string() const NOEXCEPT; 42 | 43 | friend std::istream& operator>>(std::istream& stream, 44 | point& argument) THROWS; 45 | friend std::ostream& operator<<(std::ostream& stream, 46 | const point& argument) NOEXCEPT; 47 | }; 48 | 49 | } // namespace config 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/config/transaction.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_TRANSACTION_HPP 20 | #define LIBBITCOIN_SYSTEM_TRANSACTION_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace config { 28 | 29 | /// Serialization helper for chain::script. 30 | class BC_API transaction final 31 | : public chain::transaction 32 | { 33 | public: 34 | transaction() NOEXCEPT; 35 | transaction(chain::transaction&& value) NOEXCEPT; 36 | transaction(const chain::transaction& value) NOEXCEPT; 37 | transaction(const std::string& base16) THROWS; 38 | 39 | ////std::string to_string() const NOEXCEPT; 40 | 41 | friend std::istream& operator>>(std::istream& stream, 42 | transaction& argument) THROWS; 43 | friend std::ostream& operator<<(std::ostream& stream, 44 | const transaction& argument) NOEXCEPT; 45 | }; 46 | 47 | } // namespace config 48 | } // namespace system 49 | } // namespace libbitcoin 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/bitcoin/system/crypto/aes256.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CRYPTO_AES256_HPP 20 | #define LIBBITCOIN_SYSTEM_CRYPTO_AES256_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace aes256 { 28 | 29 | /// This is an implementation of AES256. 30 | /// NIST selected three members of the Rijndael family, each with a block 31 | /// size of 128 bits, but three different key lengths: 128, 192 and 256 bits. 32 | 33 | constexpr size_t block_size = bytes<128>; 34 | typedef data_array block; 35 | 36 | constexpr size_t secret_size = bytes<256>; 37 | typedef data_array secret; 38 | 39 | /// Perform aes256 encryption/decryption on a data block. 40 | void encrypt(block& bytes, const secret& key) NOEXCEPT; 41 | void decrypt(block& bytes, const secret& key) NOEXCEPT; 42 | 43 | } // namespace aes256 44 | } // namespace system 45 | } // namespace libbitcoin 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/bitcoin/system/crypto/crypto.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CRYPTO_CRYPTO_HPP 20 | #define LIBBITCOIN_SYSTEM_CRYPTO_CRYPTO_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/bitcoin/system/data/data.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_DATA_DATA_HPP 20 | #define LIBBITCOIN_SYSTEM_DATA_DATA_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/bitcoin/system/endian/endian.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_ENDIAN_ENDIAN_HPP 20 | #define LIBBITCOIN_SYSTEM_ENDIAN_ENDIAN_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | // integers -> 33 | // integrals -> 34 | // swaps -> 35 | // stream -> swaps 36 | // unsafe -> swaps 37 | // batch -> swaps 38 | // nominal -> swaps, integers, integrals, 39 | // uintx_t -> nominal, minimal 40 | // minimal -> integers 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/bitcoin/system/error/error.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_ERROR_ERROR_HPP 20 | #define LIBBITCOIN_SYSTEM_ERROR_ERROR_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | namespace libbitcoin { 33 | namespace system { 34 | 35 | using code = std::error_code; 36 | 37 | } // namespace system 38 | } // namespace libbitcoin 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/bitcoin/system/filter/filter.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_FILTER_FILTER_HPP 20 | #define LIBBITCOIN_SYSTEM_FILTER_FILTER_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/bitcoin/system/hash/algorithm.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_HASH_ALGORITHM_HPP 20 | #define LIBBITCOIN_SYSTEM_HASH_ALGORITHM_HPP 21 | 22 | namespace libbitcoin { 23 | namespace system { 24 | 25 | /// For algorithm common type constraint. 26 | struct algorithm_t{}; 27 | 28 | } // namespace system 29 | } // namespace libbitcoin 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/bitcoin/system/hash/algorithms.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_HASH_ALGORITHMS_HPP 20 | #define LIBBITCOIN_SYSTEM_HASH_ALGORITHMS_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | 29 | using rmd128 = rmd::algorithm>; 30 | using rmd128_256 = rmd::algorithm>; // not fully implemented 31 | using rmd160 = rmd::algorithm>; 32 | using rmd160_320 = rmd::algorithm>; // not fully implemented 33 | 34 | /// bc::system sha algorithm aliases (compressed, vectorized, cached). 35 | using sha160 = sha::algorithm; 36 | using sha256_224 = sha::algorithm>; 37 | using sha256 = sha::algorithm>; 38 | using sha512_256 = sha::algorithm>; 39 | using sha512_224 = sha::algorithm>; 40 | using sha512_384 = sha::algorithm>; 41 | using sha512 = sha::algorithm>; 42 | 43 | } // namespace system 44 | } // namespace libbitcoin 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/bitcoin/system/hash/hash.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_HASH_HASH_HPP 20 | #define LIBBITCOIN_SYSTEM_HASH_HASH_HPP 21 | 22 | // algorithms is a group include for /sha and /rmd. 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /include/bitcoin/system/hash/siphash.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | // Sponsored in part by Digital Contract Design, LLC 21 | 22 | #ifndef LIBBITCOIN_SYSTEM_HASH_SIPHASH 23 | #define LIBBITCOIN_SYSTEM_HASH_SIPHASH 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | namespace libbitcoin { 32 | namespace system { 33 | 34 | typedef std::tuple siphash_key; 35 | 36 | BC_API uint64_t siphash(const siphash_key& key, 37 | const data_slice& message) NOEXCEPT; 38 | BC_API uint64_t siphash(const half_hash& hash, 39 | const data_slice& message) NOEXCEPT; 40 | 41 | constexpr siphash_key to_siphash_key(const half_hash& hash) NOEXCEPT 42 | { 43 | const auto part = split(hash); 44 | const auto hi = from_little_endian(part.first); 45 | const auto lo = from_little_endian(part.second); 46 | return std::make_tuple(hi, lo); 47 | } 48 | 49 | } // namespace system 50 | } // namespace libbitcoin 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/bitcoin/system/impl/chain/witness_patterns.ipp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_CHAIN_WITNESS_PATTERNS_IPP 20 | #define LIBBITCOIN_SYSTEM_CHAIN_WITNESS_PATTERNS_IPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace chain { 28 | 29 | BC_PUSH_WARNING(SMART_PTR_NOT_NEEDED) 30 | BC_PUSH_WARNING(NO_VALUE_OR_CONST_REF_SHARED_PTR) 31 | 32 | // static 33 | constexpr bool witness::is_push_size(const chunk_cptrs& stack) NOEXCEPT 34 | { 35 | return std::all_of(stack.begin(), stack.end(), 36 | [](const auto& element) NOEXCEPT 37 | { 38 | return element->size() <= max_push_data_size; 39 | }); 40 | } 41 | 42 | // static 43 | constexpr bool witness::is_reserved_pattern(const chunk_cptrs& stack) NOEXCEPT 44 | { 45 | return is_one(stack.size()) && stack.front()->size() == hash_size; 46 | } 47 | 48 | BC_POP_WARNING() 49 | BC_POP_WARNING() 50 | 51 | } // namespace chain 52 | } // namespace system 53 | } // namespace libbitcoin 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/bitcoin/system/impl/data/external_ptr.ipp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_DATA_EXTERNAL_POINTER_IPP 20 | #define LIBBITCOIN_SYSTEM_DATA_EXTERNAL_POINTER_IPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | } // namespace system 29 | } // namespace libbitcoin 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/bitcoin/system/impl/radix/base_58.ipp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_RADIX_BASE_58_IPP 20 | #define LIBBITCOIN_SYSTEM_RADIX_BASE_58_IPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | 29 | template 30 | bool decode_base58(data_array& out, const std::string& in) NOEXCEPT 31 | { 32 | data_chunk data{}; 33 | if (!decode_base58(data, in) || (data.size() != Size)) 34 | return false; 35 | 36 | std::copy(data.begin(), data.end(), out.begin()); 37 | return true; 38 | } 39 | 40 | // TODO: determine if the sizing function is always accurate. 41 | template 42 | data_array base58_array(const char(&string)[Size]) NOEXCEPT 43 | { 44 | // log(58) / log(256), rounded up. 45 | data_array out{}; 46 | if (!decode_base58(out, string)) 47 | out.fill(0); 48 | 49 | return out; 50 | } 51 | 52 | } // namespace system 53 | } // namespace libbitcoin 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/bitcoin/system/intrinsics/intrinsics.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_INTRINSICS_INTRINSICS_HPP 20 | #define LIBBITCOIN_SYSTEM_INTRINSICS_INTRINSICS_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/bitcoin/system/intrinsics/neon/neon.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_INTRINSICS_NEON_HPP 20 | #define LIBBITCOIN_SYSTEM_INTRINSICS_NEON_HPP 21 | 22 | #include 23 | 24 | #if defined(HAVE_NEON) 25 | #include 26 | #endif // HAVE_NEON 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/bitcoin/system/intrinsics/none/none_sha.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_INTRINSICS_NONE_SHA_HPP 20 | #define LIBBITCOIN_SYSTEM_INTRINSICS_NONE_SHA_HPP 21 | 22 | #include 23 | #include 24 | 25 | #if !defined(HAVE_SHA) 26 | 27 | namespace libbitcoin { 28 | namespace system { 29 | namespace sha { 30 | 31 | INLINE void schedule(xint128_t&, xint128_t) NOEXCEPT 32 | { 33 | } 34 | 35 | INLINE void schedule(xint128_t&, xint128_t, xint128_t) NOEXCEPT 36 | { 37 | } 38 | 39 | INLINE void compress(xint128_t&, xint128_t&, xint128_t) NOEXCEPT 40 | { 41 | } 42 | 43 | INLINE void shuffle(xint128_t&, xint128_t&) NOEXCEPT 44 | { 45 | } 46 | 47 | INLINE void unshuffle(xint128_t&, xint128_t&) NOEXCEPT 48 | { 49 | } 50 | 51 | } // namespace sha 52 | } // namespace system 53 | } // namespace libbitcoin 54 | 55 | #endif // HAVE_SHA 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/bitcoin/system/intrinsics/sve/sve.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without any implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_INTRINSICS_SVE_HPP 20 | #define LIBBITCOIN_SYSTEM_INTRINSICS_SVE_HPP 21 | 22 | #include 23 | 24 | #if defined(HAVE_SVE) 25 | #include 26 | #endif // HAVE_SVE 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/bitcoin/system/machine/machine.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_MACHINE_MACHINE_HPP 20 | #define LIBBITCOIN_SYSTEM_MACHINE_MACHINE_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /include/bitcoin/system/machine/number.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_MACHINE_NUMBER_HPP 20 | #define LIBBITCOIN_SYSTEM_MACHINE_NUMBER_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace machine { 28 | namespace number { 29 | 30 | constexpr uint8_t positive_sign_byte = 0x00; 31 | constexpr uint8_t negative_sign_byte = to_negated(positive_sign_byte); 32 | 33 | } // namespace number 34 | } // namespace machine 35 | } // namespace system 36 | } // namespace libbitcoin 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/bitcoin/system/machine/number_chunk.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_MACHINE_NUMBER_CHUNK_HPP 20 | #define LIBBITCOIN_SYSTEM_MACHINE_NUMBER_CHUNK_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | namespace machine { 29 | namespace number { 30 | 31 | class BC_API chunk 32 | { 33 | public: 34 | static inline data_chunk from_bool(bool vary) NOEXCEPT; 35 | static inline data_chunk from_integer(int64_t vary) NOEXCEPT; 36 | }; 37 | 38 | } // namespace number 39 | } // namespace machine 40 | } // namespace system 41 | } // namespace libbitcoin 42 | 43 | #include 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/bitcoin/system/math/multiplication.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_MATH_MULTIPLICATION_HPP 20 | #define LIBBITCOIN_SYSTEM_MATH_MULTIPLICATION_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | 27 | /// Safely determine whether product is a whole mutiple of value. 28 | template = true> 30 | constexpr bool is_multiple(Integer product, Integer value) NOEXCEPT; 31 | 32 | /// Safely determine whether product is left * right. 33 | template = true> 35 | constexpr bool is_product(Integer product, Integer left, 36 | Integer right) NOEXCEPT; 37 | 38 | /// Integer maximum if would overflow, otherwise the product. 39 | template = true> 41 | constexpr Unsigned ceilinged_multiply(Unsigned left, Unsigned right) NOEXCEPT; 42 | 43 | } // namespace system 44 | } // namespace libbitcoin 45 | 46 | #include 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/bitcoin/system/radix/base_64.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_RADIX_BASE_64_HPP 20 | #define LIBBITCOIN_SYSTEM_RADIX_BASE_64_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | /// Encode data as base64. 29 | BC_API std::string encode_base64(const data_slice& unencoded) NOEXCEPT; 30 | 31 | /// Attempt to decode base64 data. 32 | /// False if the input contains non-base64 characters. 33 | BC_API bool decode_base64(data_chunk& out, const std::string& in) NOEXCEPT; 34 | 35 | } // namespace system 36 | } // namespace libbitcoin 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /include/bitcoin/system/radix/base_85.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_RADIX_BASE_85_HPP 20 | #define LIBBITCOIN_SYSTEM_RADIX_BASE_85_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | /// Encode data as base85 (Z85). 29 | /// False if the input is not of base85 size (% 4). 30 | BC_API bool encode_base85(std::string& out, const data_slice& in) NOEXCEPT; 31 | 32 | /// Attempt to decode base85 (Z85) data. 33 | /// False if the input contains non-base85 characters or length (% 5). 34 | BC_API bool decode_base85(data_chunk& out, const std::string& in) NOEXCEPT; 35 | 36 | } // namespace system 37 | } // namespace libbitcoin 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/bitcoin/system/radix/radix.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_RADIX_RADIX_HPP 20 | #define LIBBITCOIN_SYSTEM_RADIX_RADIX_HPP 21 | 22 | ////#include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /include/bitcoin/system/serial/serial.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_SERIAL_SERIAL_HPP 20 | #define LIBBITCOIN_SYSTEM_SERIAL_SERIAL_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/devices/flip_sink.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_STREAM_DEVICES_FLIP_SINK_HPP 20 | #define LIBBITCOIN_SYSTEM_STREAM_DEVICES_FLIP_SINK_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | 29 | /// Sink for ios::stream, copies bytes to/from Container. 30 | // The only derivation is override of copy_sink::category. 31 | // This allows copy_sink to avoid an unnecessary output_sequence invocation. 32 | template 33 | class flip_sink 34 | : public copy_sink 35 | { 36 | public: 37 | struct category 38 | : ios::seekable, ios::direct_tag 39 | { 40 | }; 41 | 42 | using copy_sink::copy_sink; 43 | }; 44 | 45 | } // namespace system 46 | } // namespace libbitcoin 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/make_stream.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_STREAM_MAKE_STREAM_HPP 20 | #define LIBBITCOIN_SYSTEM_STREAM_MAKE_STREAM_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | template 29 | using make_stream = ios::stream; 30 | 31 | } // namespace system 32 | } // namespace libbitcoin 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/stream_result.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_STREAM_STREAM_RESULT_HPP 20 | #define LIBBITCOIN_SYSTEM_STREAM_STREAM_RESULT_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | 27 | template 28 | Stream& stream_result(Stream& stream, bool success) NOEXCEPT 29 | { 30 | if (success) 31 | stream.clear(Stream::failbit); 32 | else 33 | stream.setstate(Stream::failbit); 34 | 35 | return stream; 36 | } 37 | 38 | } // namespace system 39 | } // namespace libbitcoin 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/streamers/interfaces/bitflipper.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BITFLIPPER_HPP 20 | #define LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BITFLIPPER_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace libbitcoin { 28 | namespace system { 29 | 30 | /// A bit reader/writer interface. 31 | class bitflipper 32 | : public virtual bitreader, 33 | public virtual bitwriter, 34 | public virtual byteflipper 35 | { 36 | }; 37 | 38 | } // namespace system 39 | } // namespace libbitcoin 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/streamers/interfaces/bitreader.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | // Sponsored in part by Digital Contract Design, LLC 21 | 22 | #ifndef LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BITREADER_HPP 23 | #define LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BITREADER_HPP 24 | 25 | #include 26 | #include 27 | 28 | namespace libbitcoin { 29 | namespace system { 30 | 31 | /// A bit reader interface. 32 | class bitreader 33 | : public virtual bytereader 34 | { 35 | public: 36 | /// Read one bit (high to low). 37 | virtual bool read_bit() NOEXCEPT = 0; 38 | 39 | /// Read size bits into an integer (high to low). 40 | virtual uint64_t read_bits(size_t bits) NOEXCEPT = 0; 41 | 42 | /// Advance the iterator. 43 | virtual void skip_bit() NOEXCEPT = 0; 44 | virtual void skip_bits(size_t bits) NOEXCEPT = 0; 45 | 46 | /// Rewind the iterator. 47 | virtual void rewind_bit() NOEXCEPT = 0; 48 | virtual void rewind_bits(size_t bits) NOEXCEPT = 0; 49 | }; 50 | 51 | } // namespace system 52 | } // namespace libbitcoin 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/streamers/interfaces/bitwriter.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | // Sponsored in part by Digital Contract Design, LLC 21 | 22 | #ifndef LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BITWRITER_HPP 23 | #define LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BITWRITER_HPP 24 | 25 | #include 26 | #include 27 | 28 | namespace libbitcoin { 29 | namespace system { 30 | 31 | /// A bit writer interface. 32 | class bitwriter 33 | : public virtual bytewriter 34 | { 35 | public: 36 | /// Write one bit (high to low). 37 | virtual void write_bit(bool value) NOEXCEPT = 0; 38 | 39 | /// Write size bits from an integer (high to low) 40 | virtual void write_bits(uint64_t value, size_t bits) NOEXCEPT = 0; 41 | }; 42 | 43 | } // namespace system 44 | } // namespace libbitcoin 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/bitcoin/system/stream/streamers/interfaces/byteflipper.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BYTEFLIPPER_HPP 20 | #define LIBBITCOIN_SYSTEM_STREAM_STREAMERS_INTERFACES_BYTEFLIPPER_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | 29 | /// A byte reader/writer interface. 30 | class byteflipper 31 | : public virtual bytereader, 32 | public virtual bytewriter 33 | { 34 | }; 35 | 36 | } // namespace system 37 | } // namespace libbitcoin 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/bitcoin/system/unicode/unicode.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_UNICODE_UNICODE_HPP 20 | #define LIBBITCOIN_SYSTEM_UNICODE_UNICODE_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /include/bitcoin/system/unicode/utf8_everywhere/ifstream.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_IFSTREAM_HPP 20 | #define LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_IFSTREAM_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | 29 | /// Use bc::system::ifstream in place of std::ifstream. 30 | /// This provides unicode and long path translation for Win32. 31 | class BC_API ifstream 32 | : public std::ifstream 33 | { 34 | public: 35 | /// This also opens the file. 36 | ifstream(const std::filesystem::path& path, 37 | std::ifstream::openmode mode=std::ifstream::in) THROWS; 38 | }; 39 | 40 | } // namespace system 41 | } // namespace libbitcoin 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/bitcoin/system/unicode/utf8_everywhere/ofstream.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_OFSTREAM_HPP 20 | #define LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_OFSTREAM_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | 29 | /// Use bc::system::ofstream in place of std::ofstream. 30 | /// This provides unicode and long path translation for Win32. 31 | class BC_API ofstream 32 | : public std::ofstream 33 | { 34 | public: 35 | /// This also opens the file. 36 | ofstream(const std::filesystem::path& path, 37 | std::ofstream::openmode mode=std::ofstream::out) THROWS; 38 | }; 39 | 40 | } // namespace system 41 | } // namespace libbitcoin 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/bitcoin/system/unicode/utf8_everywhere/unicode_istream.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_UNICODE_ISTREAM_HPP 20 | #define LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_UNICODE_ISTREAM_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | 27 | /// Class to expose a narrowing input stream. 28 | /// std::wcin must be patched by console_streambuf if used for Windows input. 29 | class BC_API unicode_istream 30 | : public std::istream 31 | { 32 | public: 33 | DELETE_COPY_MOVE(unicode_istream); 34 | 35 | /// Construct instance of a conditionally-narrowing input stream. 36 | unicode_istream(std::istream& narrow_stream, std::wistream& wide_stream, 37 | size_t wide_size) THROWS; 38 | 39 | /// Delete the unicode_streambuf that wraps wide_stream. 40 | virtual ~unicode_istream() NOEXCEPT; 41 | }; 42 | 43 | } // namespace system 44 | } // namespace libbitcoin 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/bitcoin/system/unicode/utf8_everywhere/unicode_ostream.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_UNICODE_OSTREAM_HPP 20 | #define LIBBITCOIN_SYSTEM_UNICODE_UTF8_EVERYWHERE_UNICODE_OSTREAM_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | 27 | /// Class to expose a widening output stream. 28 | class BC_API unicode_ostream 29 | : public std::ostream 30 | { 31 | public: 32 | DELETE_COPY_MOVE(unicode_ostream); 33 | 34 | /// Construct instance of a conditionally-widening output stream. 35 | unicode_ostream(std::ostream& narrow_stream, std::wostream& wide_stream, 36 | size_t wide_size) THROWS; 37 | 38 | /// Delete the unicode_streambuf that wraps wide_stream. 39 | virtual ~unicode_ostream() NOEXCEPT; 40 | }; 41 | 42 | } // namespace system 43 | } // namespace libbitcoin 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/bitcoin/system/version.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) 2014-2025 libbitcoin-system developers (see COPYING). 3 | // 4 | // GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY 5 | // 6 | /////////////////////////////////////////////////////////////////////////////// 7 | #ifndef LIBBITCOIN_SYSTEM_VERSION_HPP 8 | #define LIBBITCOIN_SYSTEM_VERSION_HPP 9 | 10 | /** 11 | * The semantic version of this repository as: [major].[minor].[patch] 12 | * For interpretation of the versioning scheme see: http://semver.org 13 | */ 14 | 15 | #define LIBBITCOIN_SYSTEM_VERSION "4.0.0" 16 | #define LIBBITCOIN_SYSTEM_MAJOR_VERSION 4 17 | #define LIBBITCOIN_SYSTEM_MINOR_VERSION 0 18 | #define LIBBITCOIN_SYSTEM_PATCH_VERSION 0 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/bitcoin/system/wallet/addresses/tiff.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WALLET_ADDRESSES_TIFF_HPP 20 | #define LIBBITCOIN_SYSTEM_WALLET_ADDRESSES_TIFF_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | /// Convert a data chunk to a black on white tiff file. 29 | class BC_API tiff 30 | { 31 | public: 32 | /// The image bit stream is stored at the end of the file. 33 | /// This is the file offset in bytes to the start of the image data. 34 | static uint32_t image_offset; 35 | 36 | /// The maximal image data size is 0xffffffff. 37 | /// The last byte of each image row may contain padding. 38 | static size_t max_image_bytes; 39 | 40 | /// False if width parameter is inconsistent with data size. 41 | /// Each row is padded to a whole byte, all rows are the same length. 42 | static bool to_image(std::ostream& out, const data_chunk& data, 43 | uint16_t width) NOEXCEPT; 44 | }; 45 | 46 | } // namespace system 47 | } // namespace libbitcoin 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /include/bitcoin/system/wallet/keys/mini_keys.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WALLET_KEYS_MINI_KEYS_HPP 20 | #define LIBBITCOIN_SYSTEM_WALLET_KEYS_MINI_KEYS_HPP 21 | 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | namespace wallet { 28 | 29 | /// Convert Cascasius minikey to secret parameter. 30 | BC_API bool minikey_to_secret(ec_secret& out_secret, 31 | const std::string& key) NOEXCEPT; 32 | 33 | } // namespace wallet 34 | } // namespace system 35 | } // namespace libbitcoin 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/bitcoin/system/words/catalogs/electrum.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WORDS_CATALOGS_ELECTRUM_HPP 20 | #define LIBBITCOIN_SYSTEM_WORDS_CATALOGS_ELECTRUM_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | namespace words { 29 | namespace electrum { 30 | 31 | typedef words::dictionary<2048> catalog; 32 | 33 | // TODO: these are static initializations. 34 | 35 | extern const catalog::words& en; 36 | extern const catalog::words& es; 37 | extern const catalog::words& it; 38 | extern const catalog::words& fr; 39 | extern const catalog::words& cs; 40 | extern const catalog::words& pt; 41 | extern const catalog::words& ja; 42 | extern const catalog::words& ko; 43 | extern const catalog::words& zh_Hans; 44 | extern const catalog::words& zh_Hant; 45 | 46 | typedef words::dictionaries<10, catalog::size()> catalogs; 47 | 48 | } // namespace electrum 49 | } // namespace words 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/words/catalogs/electrum_v1.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WORDS_CATALOGS_ELECTRUM_V1_HPP 20 | #define LIBBITCOIN_SYSTEM_WORDS_CATALOGS_ELECTRUM_V1_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | namespace words { 29 | namespace electrum_v1 { 30 | 31 | typedef words::dictionary<1626> catalog; 32 | 33 | extern const catalog::words en; 34 | extern const catalog::words pt; 35 | 36 | typedef words::dictionaries<2, catalog::size()> catalogs; 37 | 38 | } // namespace electrum_v1 39 | } // namespace words 40 | } // namespace system 41 | } // namespace libbitcoin 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/bitcoin/system/words/catalogs/mnemonic.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WORDS_CATALOGS_MNEMONIC_HPP 20 | #define LIBBITCOIN_SYSTEM_WORDS_CATALOGS_MNEMONIC_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace libbitcoin { 27 | namespace system { 28 | namespace words { 29 | namespace mnemonic { 30 | 31 | typedef words::dictionary<2048> catalog; 32 | 33 | // TODO: these are static initializations. 34 | 35 | extern const catalog::words en; 36 | extern const catalog::words es; 37 | extern const catalog::words it; 38 | extern const catalog::words fr; 39 | extern const catalog::words cs; 40 | extern const catalog::words pt; 41 | extern const catalog::words ja; 42 | extern const catalog::words ko; 43 | extern const catalog::words zh_Hans; 44 | extern const catalog::words zh_Hant; 45 | 46 | typedef words::dictionaries<10, catalog::size()> catalogs; 47 | 48 | } // namespace mnemonic 49 | } // namespace words 50 | } // namespace system 51 | } // namespace libbitcoin 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/bitcoin/system/words/language.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WORDS_LANGUAGE_HPP 20 | #define LIBBITCOIN_SYSTEM_WORDS_LANGUAGE_HPP 21 | 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | 27 | typedef enum class language 28 | { 29 | en, 30 | es, 31 | it, 32 | fr, 33 | cs, 34 | pt, 35 | ja, 36 | ko, 37 | zh_Hans, 38 | zh_Hant, 39 | none 40 | } language; 41 | 42 | } // namespace system 43 | } // namespace libbitcoin 44 | 45 | namespace std 46 | { 47 | template<> 48 | struct hash 49 | { 50 | size_t operator()(const bc::system::language& value) const NOEXCEPT 51 | { 52 | return std::hash{}(static_cast(value)); 53 | } 54 | }; 55 | } // namespace std 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/bitcoin/system/words/words.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_WORDS_WORDS_HPP 20 | #define LIBBITCOIN_SYSTEM_WORDS_WORDS_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libbitcoin-system-test_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ############################################################################### 3 | # Copyright (c) 2014-2025 libbitcoin-system developers (see COPYING). 4 | # 5 | # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY 6 | # 7 | ############################################################################### 8 | 9 | # Define tests and options. 10 | #============================================================================== 11 | BOOST_UNIT_TEST_OPTIONS=\ 12 | "--run_test=* "\ 13 | "--log_level=warning "\ 14 | "--show_progress=no "\ 15 | "--detect_memory_leak=0 "\ 16 | "--report_level=no "\ 17 | "--build_info=yes" 18 | 19 | 20 | # Run tests. 21 | #============================================================================== 22 | # ALlow CI to send errors to standard output 23 | if [[ $CI == true ]]; then 24 | ./test/libbitcoin-system-test ${BOOST_UNIT_TEST_OPTIONS} 25 | else 26 | ./test/libbitcoin-system-test ${BOOST_UNIT_TEST_OPTIONS} > test.log 27 | fi 28 | -------------------------------------------------------------------------------- /libbitcoin-system.pc.in: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Copyright (c) 2014-2025 libbitcoin-system developers (see COPYING). 3 | # 4 | # GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY 5 | # 6 | ############################################################################### 7 | 8 | # Substitutions 9 | #============================================================================== 10 | prefix=@prefix@ 11 | exec_prefix=@exec_prefix@ 12 | libdir=@libdir@ 13 | includedir=@includedir@ 14 | 15 | 16 | # Metadata 17 | #============================================================================== 18 | Name: libbitcoin-system 19 | Description: Bitcoin Cross-Platform C++ Development Toolkit 20 | URL: https://github.com/libbitcoin/libbitcoin-system 21 | Version: @PACKAGE_VERSION@ 22 | 23 | 24 | # Variables 25 | #============================================================================== 26 | # Dependencies that publish package configuration. 27 | #------------------------------------------------------------------------------ 28 | Requires: @icu_i18n_PKG@ libsecp256k1 >= 0.1.0.20 29 | 30 | # Include directory and any other required compiler flags. 31 | #------------------------------------------------------------------------------ 32 | Cflags: -I${includedir} @icu@ @avx2@ @avx512@ @shani@ @sse41@ @boost_CPPFLAGS@ @pthread_CPPFLAGS@ 33 | 34 | # Lib directory, lib and any required that do not publish pkg-config. 35 | #------------------------------------------------------------------------------ 36 | Libs: -L${libdir} -lbitcoin-system @boost_LDFLAGS@ @boost_iostreams_LIBS@ @boost_locale_LIBS@ @boost_program_options_LIBS@ @boost_thread_LIBS@ @pthread_LIBS@ @rt_LIBS@ @dl_LIBS@ 37 | 38 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | /libtool.m4 2 | /lt*.m4 3 | -------------------------------------------------------------------------------- /src/chain/context.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace chain { 27 | 28 | bool context::is_enabled(chain::flags flag) const NOEXCEPT 29 | { 30 | return to_bool(flag & flags); 31 | } 32 | 33 | bool operator==(const context& left, const context& right) NOEXCEPT 34 | { 35 | return left.flags == right.flags 36 | && left.timestamp == right.timestamp 37 | && left.median_time_past == right.median_time_past 38 | && left.height == right.height 39 | && left.minimum_block_version == right.minimum_block_version 40 | && left.work_required == right.work_required; 41 | } 42 | 43 | bool operator!=(const context& left, const context& right) NOEXCEPT 44 | { 45 | return !(left == right); 46 | } 47 | 48 | } // namespace chain 49 | } // namespace system 50 | } // namespace libbitcoin 51 | -------------------------------------------------------------------------------- /src/endian/endian.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | // This is a maintainer file to force rebuild of /system/endian only. 22 | 23 | namespace libbitcoin { 24 | namespace system { 25 | 26 | } // namespace system 27 | } // namespace libbitcoin 28 | -------------------------------------------------------------------------------- /src/error/error_t.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace error { 27 | 28 | DEFINE_ERROR_T_MESSAGE_MAP(error) 29 | { 30 | { success, "success" }, 31 | { not_found, "object does not exist" }, 32 | { not_implemented, "feature not implemented" } 33 | ////{ error_last, "unmapped code" } 34 | }; 35 | 36 | DEFINE_ERROR_T_CATEGORY(error, "bc", "system code") 37 | 38 | } // namespace error 39 | } // namespace system 40 | } // namespace libbitcoin 41 | -------------------------------------------------------------------------------- /src/hash/accumulator.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | 27 | /// Explicit template instantiation. 28 | template class accumulator; 29 | template class accumulator; 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/math/math.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | // This is a maintainer file to force rebuild of /math only. 22 | 23 | namespace libbitcoin { 24 | namespace system { 25 | 26 | } // namespace system 27 | } // namespace libbitcoin 28 | -------------------------------------------------------------------------------- /src/unicode/utf8_everywhere/ifstream.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | // VC++ EXTENSION: "construct with wide-named file". 29 | ifstream::ifstream(const std::filesystem::path& path, 30 | std::ifstream::openmode mode) THROWS 31 | : std::ifstream(to_extended_path(path), mode) 32 | { 33 | // This opens the stream, and creates file system file if out/app mode. 34 | } 35 | 36 | } // namespace system 37 | } // namespace libbitcoin 38 | -------------------------------------------------------------------------------- /src/unicode/utf8_everywhere/ofstream.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace libbitcoin { 26 | namespace system { 27 | 28 | // VC++ EXTENSION: "construct with wide-named file". 29 | ofstream::ofstream(const std::filesystem::path& path, 30 | std::ofstream::openmode mode) THROWS 31 | : std::ofstream(to_extended_path(path), mode) 32 | { 33 | // This opens the stream, and creates file system file if out/app mode. 34 | } 35 | 36 | } // namespace system 37 | } // namespace libbitcoin 38 | -------------------------------------------------------------------------------- /src/unicode/utf8_everywhere/unicode_istream.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | 23 | namespace libbitcoin { 24 | namespace system { 25 | 26 | #ifdef HAVE_MSC 27 | unicode_istream::unicode_istream(std::istream&, std::wistream& wide_stream, 28 | size_t wide_size) THROWS 29 | : std::istream(new unicode_streambuf(wide_stream.rdbuf(), wide_size)) 30 | #else 31 | unicode_istream::unicode_istream(std::istream& narrow_stream, 32 | std::wistream&, size_t) THROWS 33 | : std::istream(narrow_stream.rdbuf()) 34 | #endif 35 | { 36 | } 37 | 38 | unicode_istream::~unicode_istream() NOEXCEPT 39 | { 40 | #ifdef HAVE_MSC 41 | delete rdbuf(); 42 | #endif 43 | } 44 | 45 | } // namespace system 46 | } // namespace libbitcoin 47 | -------------------------------------------------------------------------------- /src/unicode/utf8_everywhere/unicode_ostream.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | 23 | namespace libbitcoin { 24 | namespace system { 25 | 26 | #ifdef HAVE_MSC 27 | unicode_ostream::unicode_ostream(std::ostream&, std::wostream& wide_stream, 28 | size_t wide_size) THROWS 29 | : std::ostream(new unicode_streambuf(wide_stream.rdbuf(), wide_size)) 30 | #else 31 | unicode_ostream::unicode_ostream(std::ostream& narrow_stream, 32 | std::wostream&, size_t) THROWS 33 | : std::ostream(narrow_stream.rdbuf()) 34 | #endif 35 | { 36 | } 37 | 38 | unicode_ostream::~unicode_ostream() NOEXCEPT 39 | { 40 | #ifdef HAVE_MSC 41 | delete rdbuf(); 42 | #endif 43 | } 44 | 45 | } // namespace system 46 | } // namespace libbitcoin 47 | -------------------------------------------------------------------------------- /src/wallet/addresses/qrencode/bitstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Binary sequence class. 5 | * Copyright (C) 2006-2017 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef BITSTREAM_H 23 | #define BITSTREAM_H 24 | 25 | typedef struct { 26 | size_t length; 27 | size_t datasize; 28 | unsigned char *data; 29 | } BitStream; 30 | 31 | extern BitStream *BitStream_new(void); 32 | #ifdef WITH_TESTS 33 | extern BitStream *BitStream_newWithBits(size_t size, unsigned char *bits); 34 | #endif 35 | extern int BitStream_append(BitStream *bstream, BitStream *arg); 36 | extern int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num); 37 | extern int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data); 38 | #define BitStream_size(__bstream__) (__bstream__->length) 39 | #define BitStream_reset(__bstream__) (__bstream__->length = 0) 40 | extern unsigned char *BitStream_toByte(BitStream *bstream); 41 | extern void BitStream_free(BitStream *bstream); 42 | 43 | #endif /* BITSTREAM_H */ 44 | -------------------------------------------------------------------------------- /src/wallet/addresses/qrencode/mask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking. 5 | * Copyright (C) 2006-2017 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef MASK_H 23 | #define MASK_H 24 | 25 | extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level); 26 | extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level); 27 | 28 | #ifdef WITH_TESTS 29 | extern int Mask_calcN2(int width, unsigned char *frame); 30 | extern int Mask_calcN1N3(int length, int *runLength); 31 | extern int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength); 32 | extern int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength); 33 | extern int Mask_evaluateSymbol(int width, unsigned char *frame); 34 | extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level); 35 | extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask); 36 | #endif 37 | 38 | #endif /* MASK_H */ 39 | -------------------------------------------------------------------------------- /src/wallet/addresses/qrencode/mmask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking for Micro QR Code. 5 | * Copyright (C) 2006-2017 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef MMASK_H 23 | #define MMASK_H 24 | 25 | extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level); 26 | extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level); 27 | 28 | #ifdef WITH_TESTS 29 | extern int MMask_evaluateSymbol(int width, unsigned char *frame); 30 | extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level); 31 | extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask); 32 | #endif 33 | 34 | #endif /* MMASK_H */ 35 | -------------------------------------------------------------------------------- /src/wallet/addresses/qrencode/rsecc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Reed solomon error correction code encoder specialized for QR code. 5 | * This code is rewritten by Kentaro Fukuchi, referring to the FEC library 6 | * developed by Phil Karn (KA9Q). 7 | * 8 | * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q 9 | * Copyright (C) 2014-2017 Kentaro Fukuchi 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 | */ 25 | 26 | #ifndef RSECC_H 27 | #define RSECC_H 28 | 29 | extern int RSECC_encode(size_t data_length, size_t ecc_length, const unsigned char *data, unsigned char *ecc); 30 | 31 | #endif /* RSECC_H */ 32 | -------------------------------------------------------------------------------- /src/wallet/context.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | namespace libbitcoin { 22 | namespace system { 23 | namespace wallet { 24 | 25 | const context btc_mainnet_p2kh = ctx::btc::main::p2pkh; 26 | const context btc_mainnet_p2sh = ctx::btc::main::p2sh; 27 | const context btc_testnet_p2kh = ctx::btc::test::p2pkh; 28 | const context btc_testnet_p2sh = ctx::btc::test::p2sh; 29 | 30 | const context btc_mainnet = btc_mainnet_p2kh; 31 | const context btc_testnet = btc_testnet_p2kh; 32 | 33 | const context btc = btc_mainnet; 34 | 35 | } // namespace wallet 36 | } // namespace system 37 | } // namespace libbitcoin 38 | -------------------------------------------------------------------------------- /src/wallet/keys/mini_keys.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | namespace libbitcoin { 25 | namespace system { 26 | namespace wallet { 27 | 28 | static bool check_minikey(const std::string& minikey) NOEXCEPT 29 | { 30 | // Legacy minikeys are 22 chars long. 31 | const auto size = minikey.size(); 32 | const auto valid = (size == 22u || size == 30u); 33 | return valid && sha256_hash(minikey + "?").front() == 0x00; 34 | } 35 | 36 | bool minikey_to_secret(ec_secret& out_secret, const std::string& key) NOEXCEPT 37 | { 38 | if (!check_minikey(key)) 39 | return false; 40 | 41 | out_secret = sha256_hash(key); 42 | return true; 43 | } 44 | 45 | } // namespace wallet 46 | } // namespace system 47 | } // namespace libbitcoin 48 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | test_libbitcoin 2 | -------------------------------------------------------------------------------- /test/chain/annex.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(annex_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(annex_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/chain/context.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(context_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(context_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/chain/satoshi_words.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(satoshi_words) 22 | 23 | BOOST_AUTO_TEST_CASE(satoshi_words_mainnet) 24 | { 25 | const auto block = settings(chain::selection::mainnet).genesis_block; 26 | const auto message = to_string((*(*block.transactions_ptr())[0]->inputs_ptr())[0]->script().ops()[2].data()); 27 | BOOST_REQUIRE_EQUAL(message, "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"); 28 | } 29 | 30 | BOOST_AUTO_TEST_SUITE_END() 31 | -------------------------------------------------------------------------------- /test/chain/stripper.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(stripper_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(stripper__always__success) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/chain/taproot.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(taproot_tests) 22 | 23 | using namespace system::chain; 24 | 25 | BOOST_AUTO_TEST_CASE(taproot_test) 26 | { 27 | BOOST_REQUIRE(true); 28 | } 29 | 30 | BOOST_AUTO_TEST_SUITE_END() 31 | -------------------------------------------------------------------------------- /test/chain/tapscript.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(tapscript_tests) 22 | 23 | using namespace system::chain; 24 | 25 | BOOST_AUTO_TEST_CASE(tapscript_test) 26 | { 27 | BOOST_REQUIRE(true); 28 | } 29 | 30 | BOOST_AUTO_TEST_SUITE_END() 31 | -------------------------------------------------------------------------------- /test/config/base16.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(base16_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /test/config/base2.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(base2_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /test/config/base32.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(base32_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /test/config/base58.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(base58_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | #define BASE58_ENCODED_A "vYxp6yFC7qiVtK1RcGQQt3L6EqTc8YhEDLnSMLqDvp8D" 26 | #define BASE58_DECODED_A \ 27 | {{ \ 28 | 0x03, 0x1b, 0xab, 0x84, 0xe6, 0x87, 0xe3, 0x65, 0x14, 0xee, 0xaf, 0x5a, \ 29 | 0x01, 0x7c, 0x30, 0xd3, 0x2c, 0x1f, 0x59, 0xdd, 0x4e, 0xa6, 0x62, 0x9d, \ 30 | 0xa7, 0x97, 0x0c, 0xa3, 0x74, 0x51, 0x3d, 0xd0, 0x06 \ 31 | }} 32 | 33 | BOOST_AUTO_TEST_CASE(base58__constructor__default__does_not_throw) 34 | { 35 | BOOST_REQUIRE_NO_THROW(base58()); 36 | } 37 | 38 | BOOST_AUTO_TEST_CASE(base58__constructor__valid_string_cast__decodes) 39 | { 40 | const data_chunk original(BASE58_DECODED_A); 41 | const data_chunk instance(base58(BASE58_ENCODED_A)); 42 | BOOST_REQUIRE(original == instance); 43 | } 44 | 45 | BOOST_AUTO_TEST_SUITE_END() 46 | -------------------------------------------------------------------------------- /test/config/base64.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(base64_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /test/config/base85.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(base85_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /test/config/hash256.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(hash256_tests) 22 | 23 | using namespace bc::system::config; 24 | 25 | BOOST_AUTO_TEST_SUITE(hash256__construct) 26 | 27 | BOOST_AUTO_TEST_CASE(hash256__construct__default__null_hash) 28 | { 29 | const hash256 uninitialized_hash; 30 | BOOST_REQUIRE_EQUAL((const hash_digest&)uninitialized_hash, null_hash); 31 | } 32 | 33 | BOOST_AUTO_TEST_SUITE_END() 34 | 35 | BOOST_AUTO_TEST_SUITE_END() 36 | -------------------------------------------------------------------------------- /test/data/external_ptr.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(external_ptr_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(external_ptr__construct__default__unassigned) 24 | { 25 | const external_ptr empty{}; 26 | BOOST_REQUIRE(!empty); 27 | } 28 | 29 | BOOST_AUTO_TEST_SUITE_END() 30 | 31 | 32 | // stdlib object sizes are subjsct to implementation (including debug builds). 33 | #if defined(HAVE_MSC) && defined(NDEBUG) 34 | 35 | // std::unique_ptr owns storage, deleting the referenced object on destruct. 36 | static_assert(sizeof(std::unique_ptr>) == 1 * sizeof(size_t)); 37 | 38 | // std::shared_ptr owns storage, deleting the referenced object on destruct. 39 | static_assert(sizeof(std::shared_ptr>) == 2 * sizeof(size_t)); 40 | 41 | // std::weak_ptr doubles storage cost and is overly restrictive. 42 | static_assert(sizeof(std::weak_ptr>) == 2 * sizeof(size_t)); 43 | 44 | // external_ptr is safer and more flexible than a raw pointer, at same cost. 45 | static_assert(sizeof(external_ptr>) == 1 * sizeof(size_t)); 46 | 47 | #endif // HAVE_MSC && NDEBUG -------------------------------------------------------------------------------- /test/data/iterable.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/test/data/iterable.cpp -------------------------------------------------------------------------------- /test/endian/integers.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(endian_integers_tests) 22 | 23 | // These are fully covered as dependencies for other endian functions. 24 | // Data to_big_data(Data&&, Integer) 25 | // Data to_little_data(Data&&, Integer) 26 | // Integer from_big_array(data_array) 27 | // Integer from_big_array(length, data_array) 28 | // Integer from_big_chunk(length, data_chunk) 29 | // Integer from_little_array(data_array) 30 | // Integer from_little_array(length, data_array) 31 | // Integer from_little_chunk(length, data_chunk) 32 | 33 | BOOST_AUTO_TEST_SUITE_END() 34 | -------------------------------------------------------------------------------- /test/error/error_t.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(error_t_tests) 22 | 23 | // These test std::error_code equality operator overrides. 24 | 25 | BOOST_AUTO_TEST_CASE(error_t__code__success__false_exected_message) 26 | { 27 | constexpr auto value = error::success; 28 | const auto ec = code(value); 29 | BOOST_REQUIRE(!ec); 30 | BOOST_REQUIRE(ec == value); 31 | BOOST_REQUIRE_EQUAL(ec.message(), "success"); 32 | } 33 | 34 | BOOST_AUTO_TEST_CASE(error_t__code__not_found__true_exected_message) 35 | { 36 | constexpr auto value = error::not_found; 37 | const auto ec = code(value); 38 | BOOST_REQUIRE(ec); 39 | BOOST_REQUIRE(ec == value); 40 | BOOST_REQUIRE_EQUAL(ec.message(), "object does not exist"); 41 | } 42 | 43 | BOOST_AUTO_TEST_CASE(error_t__code__not_implemented__true_exected_message) 44 | { 45 | constexpr auto value = error::not_implemented; 46 | const auto ec = code(value); 47 | BOOST_REQUIRE(ec); 48 | BOOST_REQUIRE(ec == value); 49 | BOOST_REQUIRE_EQUAL(ec.message(), "feature not implemented"); 50 | } 51 | 52 | BOOST_AUTO_TEST_SUITE_END() 53 | -------------------------------------------------------------------------------- /test/filter/golomb.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "../test.hpp" 21 | 22 | BOOST_AUTO_TEST_SUITE(golomb_tests) 23 | 24 | BOOST_AUTO_TEST_CASE(golomb_test) 25 | { 26 | BOOST_REQUIRE(true); 27 | } 28 | 29 | BOOST_AUTO_TEST_SUITE_END() 30 | -------------------------------------------------------------------------------- /test/hash/performance/baseline/byteswap.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2019 The Bitcoin Core developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef BITCOIN_COMPAT_BYTESWAP_H 6 | #define BITCOIN_COMPAT_BYTESWAP_H 7 | 8 | #include 9 | #include 10 | #include "../../../test.hpp" 11 | 12 | BC_PUSH_WARNING(USE_CONSTEXPR_FOR_FUNCTION) 13 | BC_PUSH_WARNING(USE_NOEXCEPT_FOR_FUNCTION) 14 | 15 | namespace baseline { 16 | 17 | // Give baseline benefit of intrinsics. 18 | // native implementation is equivalent. 19 | #ifndef bswap_16 20 | #define bswap_16 byte_swap16 21 | #endif 22 | #ifndef bswap_32 23 | #define bswap_32 byte_swap32 24 | #endif 25 | #ifndef bswap_64 26 | #define bswap_64 byte_swap64 27 | #endif 28 | 29 | ////inline uint16_t bswap_16(uint16_t x) 30 | ////{ 31 | //// return (x >> 8) | (x << 8); 32 | ////} 33 | //// 34 | ////inline uint32_t bswap_32(uint32_t x) 35 | ////{ 36 | //// return (((x & 0xff000000U) >> 24) | ((x & 0x00ff0000U) >> 8) | 37 | //// ((x & 0x0000ff00U) << 8) | ((x & 0x000000ffU) << 24)); 38 | ////} 39 | //// 40 | ////inline uint64_t bswap_64(uint64_t x) 41 | ////{ 42 | //// return (((x & 0xff00000000000000ull) >> 56) 43 | //// | ((x & 0x00ff000000000000ull) >> 40) 44 | //// | ((x & 0x0000ff0000000000ull) >> 24) 45 | //// | ((x & 0x000000ff00000000ull) >> 8) 46 | //// | ((x & 0x00000000ff000000ull) << 8) 47 | //// | ((x & 0x0000000000ff0000ull) << 24) 48 | //// | ((x & 0x000000000000ff00ull) << 40) 49 | //// | ((x & 0x00000000000000ffull) << 56)); 50 | ////} 51 | 52 | } // baseline 53 | 54 | BC_POP_WARNING() 55 | BC_POP_WARNING() 56 | 57 | #endif // BITCOIN_COMPAT_BYTESWAP_H 58 | -------------------------------------------------------------------------------- /test/hash/performance/baseline/rmd160.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2016 The Bitcoin Core developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef BITCOIN_CRYPTO_RIPEMD160_H 6 | #define BITCOIN_CRYPTO_RIPEMD160_H 7 | 8 | #include 9 | #include 10 | #include "../../../test.hpp" 11 | 12 | namespace baseline { 13 | 14 | class CRIPEMD160 15 | { 16 | private: 17 | uint32_t s[5]; 18 | unsigned char buf[64]; 19 | uint64_t bytes; 20 | 21 | public: 22 | static const size_t digest_bytes = 20; 23 | 24 | CRIPEMD160(); 25 | CRIPEMD160& Write(const unsigned char* data, size_t len); 26 | void Finalize(unsigned char hash[digest_bytes]); 27 | CRIPEMD160& Reset(); 28 | }; 29 | 30 | } // namespace baseline 31 | 32 | #endif // BITCOIN_CRYPTO_RIPEMD160_H 33 | -------------------------------------------------------------------------------- /test/hash/performance/baseline/sha256.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014-2018 The Bitcoin Core developers 2 | // Distributed under the MIT software license, see the accompanying 3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | #ifndef BITCOIN_CRYPTO_SHA256_H 6 | #define BITCOIN_CRYPTO_SHA256_H 7 | 8 | #include 9 | #include 10 | #include "../../../test.hpp" 11 | 12 | namespace baseline { 13 | 14 | class CSHA256 15 | { 16 | private: 17 | uint32_t s[8]; 18 | unsigned char buf[64]; 19 | uint64_t bytes; 20 | 21 | public: 22 | using digest_t = system::hash_digest; 23 | static const size_t digest_bytes = 32; 24 | 25 | CSHA256(); 26 | CSHA256& Write(const unsigned char* data, size_t len); 27 | void Finalize(unsigned char hash[digest_bytes]); 28 | CSHA256& Reset(); 29 | }; 30 | 31 | void SHA256D64(unsigned char* output, const unsigned char* input, size_t blocks); 32 | 33 | } // namespace baseline 34 | 35 | #endif // BITCOIN_CRYPTO_SHA256_H 36 | -------------------------------------------------------------------------------- /test/hash/sha/analysis.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libbitcoin/libbitcoin-system/dc29f85c65c09cb14f322c7a308aefc537df2167/test/hash/sha/analysis.cpp -------------------------------------------------------------------------------- /test/intrinsics/byte_swap.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | constexpr auto value16 = 0x0102_u16; 22 | constexpr auto value32 = 0x01020304_u32; 23 | constexpr auto value64 = 0x0102030405060708_u64; 24 | 25 | constexpr auto swap16 = 0x0201_u16; 26 | constexpr auto swap32 = 0x04030201_u32; 27 | constexpr auto swap64 = 0x0807060504030201_u64; 28 | 29 | static_assert(byte_swap8_nominal(0x01_u8) == 0x01_u8); 30 | static_assert(byte_swap16_nominal(value16) == swap16); 31 | static_assert(byte_swap32_nominal(value32) == swap32); 32 | static_assert(byte_swap64_nominal(value64) == swap64); 33 | 34 | // platform intrinsic, falls back to nominal 35 | BOOST_AUTO_TEST_CASE(byte_swap__intrinsic__always__swapped) 36 | { 37 | BOOST_REQUIRE_EQUAL(byte_swap16(value16), swap16); 38 | BOOST_REQUIRE_EQUAL(byte_swap32(value32), swap32); 39 | BOOST_REQUIRE_EQUAL(byte_swap64(value64), swap64); 40 | } 41 | -------------------------------------------------------------------------------- /test/intrinsics/cpuid.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(intrinsics_cpuid_tests) 22 | 23 | // cpuid includes a local get_bit<> utility. 24 | static_assert(!get_bit<0>(0)); 25 | static_assert( get_bit<0>(1)); 26 | static_assert(!get_bit<0>(2)); 27 | static_assert(!get_bit<0>(0b00010000_u8)); 28 | static_assert( get_bit<1>(0b00010011_u8)); 29 | static_assert( get_bit<2>(0b00010100_u8)); 30 | static_assert( get_bit<3>(0b00011000_u8)); 31 | static_assert( get_bit<4>(0b00010000_u8)); 32 | static_assert( get_bit<5>(0b00110000_u8)); 33 | static_assert( get_bit<6>(0b01010000_u8)); 34 | static_assert( get_bit<7>(0b10010000_u8)); 35 | static_assert( get_bit<31>(0x80000000_u32)); 36 | static_assert( get_bit<15>(0x8000_u16)); 37 | static_assert( get_bit< 7>(0x80_u8)); 38 | 39 | // get_cpu/get_xcr tested in detection.cpp. 40 | 41 | BOOST_AUTO_TEST_SUITE_END() 42 | -------------------------------------------------------------------------------- /test/intrinsics/platforms/neon.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(intrinsics_platforms_neon_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(intrinsics_platforms_neon_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/intrinsics/platforms/sve.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(intrinsics_platforms_sve_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(intrinsics_platforms_sve_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/machine/interpreter.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(interpreter_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(interpreter_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/machine/number.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(number_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(number_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/machine/program.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(program_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(program_test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #define BOOST_TEST_MODULE libbitcoin_test 20 | #include 21 | -------------------------------------------------------------------------------- /test/wallet/addresses/stealth_sender.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../../test.hpp" 20 | 21 | // TODO: test sender in isolation. 22 | BOOST_AUTO_TEST_SUITE(stealth_sender_tests) 23 | 24 | BOOST_AUTO_TEST_SUITE_END() 25 | -------------------------------------------------------------------------------- /test/wallet/context.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(context_tests) 22 | 23 | using namespace bc::system::wallet; 24 | 25 | BOOST_AUTO_TEST_SUITE(context_test_suite) 26 | BOOST_AUTO_TEST_SUITE_END() 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/wallet/keys/ec_point.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../../test.hpp" 20 | #include 21 | 22 | BOOST_AUTO_TEST_SUITE(ec_point_tests) 23 | 24 | const ec_compressed pointx = base16_array("0245dbb7e2cd3a5de19fde8d556fd567a036f9c377ecf69a9202aa4affce41c623"); 25 | const ec_compressed pointy = base16_array("02cfc43e064c50cfd1896766ef70e7da82b16e8cfebd8d5dec618212d0db1e6d12"); 26 | const ec_compressed sum_xy = base16_array("03332bf6821c7c0e1080efc131d2b745760a8245c0b91a05f13308ff8600d30525"); 27 | 28 | BOOST_AUTO_TEST_CASE(ec_point__sum__cool__expected) 29 | { 30 | // Cool construction here. 31 | BOOST_REQUIRE_EQUAL((pointx + pointy), sum_xy); 32 | } 33 | 34 | BOOST_AUTO_TEST_SUITE_END() 35 | -------------------------------------------------------------------------------- /test/wallet/keys/ec_public.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(ec_public_tests) 22 | 23 | using namespace bc::system::wallet; 24 | 25 | BOOST_AUTO_TEST_SUITE_END() 26 | -------------------------------------------------------------------------------- /test/wallet/keys/mini_keys.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #include "../../test.hpp" 20 | 21 | BOOST_AUTO_TEST_SUITE(mini_keys_tests) 22 | 23 | BOOST_AUTO_TEST_CASE(minikey_to_secret__test) 24 | { 25 | BOOST_REQUIRE(true); 26 | } 27 | 28 | BOOST_AUTO_TEST_SUITE_END() 29 | -------------------------------------------------------------------------------- /test/words/dictionary.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) 3 | * 4 | * This file is part of libbitcoin. 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Affero General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Affero General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Affero General Public License 17 | * along with this program. If not, see . 18 | */ 19 | #ifndef LIBBITCOIN_SYSTEM_TEST_DICTIONARY_HPP 20 | #define LIBBITCOIN_SYSTEM_TEST_DICTIONARY_HPP 21 | 22 | #include 23 | 24 | // Avoid using namespace in shared headers, but okay here. 25 | using namespace bc::system::words; 26 | 27 | namespace test { 28 | namespace mnemonics_dictionary { 29 | 30 | const size_t test_dictionary_size = 10; 31 | typedef dictionary::words test_words; 32 | 33 | // First 10 words of BIP39 es, first word not sorted for C compare (<). 34 | const test_words test_words_es 35 | { 36 | false, 37 | { 38 | "ábaco", 39 | "abdomen", 40 | "abeja", 41 | "abierto", 42 | "abogado", 43 | "abono", 44 | "aborto", 45 | "abrazo", 46 | "abrir", 47 | "abuelo" 48 | } 49 | }; 50 | 51 | // This is the instance under test. 52 | dictionary instance(language::es, test_words_es); 53 | 54 | } // namespace mnemonics_dictionary 55 | } // namespace test 56 | 57 | #endif --------------------------------------------------------------------------------