bitcoin::BitcoinKeyGenerator¶
Creates a pair of ECDSA keys and a Bitcoin address from a compressed key.
#include <BitcoinKeyGenerator.hpp>
Public Types¶
| Name | |
|---|---|
| using std::pair< std::vector< std::uint8_t >, std::vector< std::uint8_t > > | PubKeyPair_t |
Public Functions¶
| Name | |
|---|---|
| BitcoinKeyGenerator() Constructs a new randomly generated Bitcoin key and address. |
|
| BitcoinKeyGenerator(std::string_view private_key) Import private key string data to construct Bitcoin key and address. |
|
| BitcoinKeyGenerator(const scalar_field_value_type & private_key) Import a private key scalar value to construct Bitcoin key and address. |
|
| const pubkey::ext_private_key< policy_type > & | get_private_key() const Returns the private key reference. |
| const pubkey::public_key< policy_type > & | get_public_key() const Returns the public key reference. |
| const std::string & | get_address() const Returns the bitcoin base58 address. |
| const std::string | GetUsedPubKeyValue() const Get the public key value used for bitcoin address derivation. |
| const std::string | GetEntirePubValue() const Get entire key value of the public key. |
| template <typename T > T |
ExtractPubKeyFromField(const pubkey::public_key< policy_type > & pub_key) Extract the key vector data from the ECDSA public key. |
| std::string | DeriveAddress(const std::vector< std::uint8_t > & pub_key_vect) Derive the bitcoin address from de X coordinate of the public key. |
| std::shared_ptr< pubkey::ext_private_key< policy_type > > | CreateKeys() Create the ECDSA key pair. |
Public Types Documentation¶
using PubKeyPair_t¶
using bitcoin::BitcoinKeyGenerator::PubKeyPair_t = std::pair<std::vector<std::uint8_t>, std::vector<std::uint8_t>>;
Public Functions Documentation¶
function BitcoinKeyGenerator¶
Constructs a new randomly generated Bitcoin key and address.
function BitcoinKeyGenerator¶
Import private key string data to construct Bitcoin key and address.
Parameters:
- private_key Private key in string form
function BitcoinKeyGenerator¶
Import a private key scalar value to construct Bitcoin key and address.
Parameters:
- private_key Private key scalar value
function get_private_key¶
Returns the private key reference.
Return: Reference to the private key
function get_public_key¶
Returns the public key reference.
Return: Reference to the public key
function get_address¶
Returns the bitcoin base58 address.
Return: Bitcoin base58 address in string form
function GetUsedPubKeyValue¶
Get the public key value used for bitcoin address derivation.
Return: The compressed X coordinate in string form
function GetEntirePubValue¶
Get entire key value of the public key.
Return: The concatenated X+Y key values in string form
function ExtractPubKeyFromField¶
template <typename T >
static T ExtractPubKeyFromField(
const pubkey::public_key< policy_type > & pub_key
)
Extract the key vector data from the ECDSA public key.
Parameters:
- pub_key Public ECDSA key
Return:
function DeriveAddress¶
Derive the bitcoin address from de X coordinate of the public key.
Parameters:
- pub_key_vect The vector representation of the X coordinate of public key
Return: Bitcoin base58 address
Warning: The LSB is the 0 index and the MSB is the 31th.
function CreateKeys¶
Create the ECDSA key pair.
Return: Private key pointer
Updated on 2026-03-04 at 13:10:43 -0800