5#ifndef BITCOIN_UTIL_BIP32_H
6#define BITCOIN_UTIL_BIP32_H
33[[nodiscard]]
bool ParseHDKeypath(
const std::string& keypath_str, std::vector<uint32_t>& keypath);
36std::string
WriteHDKeypath(
const std::vector<uint32_t>& keypath,
bool apostrophe =
false);
37std::string
FormatHDKeypath(
const std::vector<uint32_t>& path,
bool apostrophe =
false);
bool ParseHDKeypath(const std::string &keypath_str, std::vector< uint32_t > &keypath)
Parse an HD keypaths like "m/7/0'/2000".
std::string WriteHDKeypath(const std::vector< uint32_t > &keypath, bool apostrophe=false)
Write HD keypaths as strings.
std::string FormatHDKeypath(const std::vector< uint32_t > &path, bool apostrophe=false)
static constexpr uint32_t BIP32_HARDENED_FLAG
BIP32 hardened derivation flag (2^31)
static constexpr uint32_t BIP32_UNHARDENED_FLAG
BIP32 unhardened derivation index (no high bit set)
util::Expected< KeyPathElement, std::string > ParseKeyPathElement(std::span< const char > elem)
Parse a single key path element like "0", "0'", or "0h".
bool HasHardenedDerivation(std::span< const uint32_t > keypath)
Whether a parsed HD keypath contains at least one hardened derivation step.
The util::Expected class provides a standard way for low-level functions to return either error value...
uint32_t ChildNumber() const
Derivation index with the hardened flag applied.
uint32_t index
Derivation index, without the hardened flag.