ledger-core
Public Member Functions | List of all members
ledger::core::api::BitcoinLikeAddress Class Referenceabstract

#include <BitcoinLikeAddress.hpp>

+ Inheritance diagram for ledger::core::api::BitcoinLikeAddress:

Public Member Functions

virtual std::vector< uint8_t > getVersion ()=0
 
virtual std::vector< uint8_t > getHash160 ()=0
 
virtual BitcoinLikeNetworkParameters getNetworkParameters ()=0
 
virtual std::string toBase58 ()=0
 
virtual std::string toBech32 ()=0
 
virtual bool isP2SH ()=0
 
virtual bool isP2PKH ()=0
 
virtual bool isP2WSH ()=0
 
virtual bool isP2WPKH ()=0
 

Detailed Description

Helper class for manipulating Bitcoin like addresses

Member Function Documentation

◆ getHash160()

virtual std::vector<uint8_t> ledger::core::api::BitcoinLikeAddress::getHash160 ( )
pure virtual

Gets the raw hash160 of the public key

Returns
The 20 bytes of the public key hash160

Implemented in ledger::core::BitcoinLikeAddress.

◆ getNetworkParameters()

virtual BitcoinLikeNetworkParameters ledger::core::api::BitcoinLikeAddress::getNetworkParameters ( )
pure virtual

Gets the network parameters used for serializing the address

Returns
The network parameters of the address

Implemented in ledger::core::BitcoinLikeAddress.

◆ getVersion()

virtual std::vector<uint8_t> ledger::core::api::BitcoinLikeAddress::getVersion ( )
pure virtual

Gets the version of the address (P2SH or P2PKH)

Returns
The version of the address

Implemented in ledger::core::BitcoinLikeAddress.

◆ isP2PKH()

virtual bool ledger::core::api::BitcoinLikeAddress::isP2PKH ( )
pure virtual

Checks if the given address is a P2PKH address

Returns
if the keychain engine is P2PKH

Implemented in ledger::core::BitcoinLikeAddress.

◆ isP2SH()

virtual bool ledger::core::api::BitcoinLikeAddress::isP2SH ( )
pure virtual

Serializes the hash160 to a payment uri (i.e bitcoin:16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM)

Returns
A payment uri to this address toPaymentUri(): string; Checks if the given address is a P2SH address
True if the keychain engine is P2SH

Implemented in ledger::core::BitcoinLikeAddress.

◆ isP2WPKH()

virtual bool ledger::core::api::BitcoinLikeAddress::isP2WPKH ( )
pure virtual

Checks if the given address is a P2WPKH address

Returns
True if the keychain engine is P2WPKH

Implemented in ledger::core::BitcoinLikeAddress.

◆ isP2WSH()

virtual bool ledger::core::api::BitcoinLikeAddress::isP2WSH ( )
pure virtual

Checks if the given address is a P2WSH address

Returns
True if the keychain engine is P2WSH

Implemented in ledger::core::BitcoinLikeAddress.

◆ toBase58()

virtual std::string ledger::core::api::BitcoinLikeAddress::toBase58 ( )
pure virtual

Serializes the hash160 into a Base58 encoded address (with checksum)

Returns
The Base58 serialization

Implemented in ledger::core::BitcoinLikeAddress.

◆ toBech32()

virtual std::string ledger::core::api::BitcoinLikeAddress::toBech32 ( )
pure virtual

Get the Bech32 encoded address (with respect to BIP173)

Returns
The Bech32 encoded address

Implemented in ledger::core::BitcoinLikeAddress.


The documentation for this class was generated from the following file: