Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
ExternalSigner Class Reference

Enables interaction with an external signing device or service, such as a hardware wallet. More...

#include <external_signer.h>

Public Member Functions

 ExternalSigner (const std::string &command, const std::string chain, const std::string &fingerprint, const std::string name)
 
UniValue DisplayAddress (const std::string &descriptor) const
 Display address on the device. More...
 
UniValue GetDescriptors (const int account)
 Get receive and change Descriptor(s) from device for a given account. More...
 
bool SignTransaction (PartiallySignedTransaction &psbt, std::string &error)
 Sign PartiallySignedTransaction on the device. More...
 

Static Public Member Functions

static bool Enumerate (const std::string &command, std::vector< ExternalSigner > &signers, const std::string chain)
 Obtain a list of signers. More...
 

Public Attributes

std::string m_fingerprint
 Master key fingerprint of the signer. More...
 
std::string m_name
 Name of signer. More...
 

Private Member Functions

std::string NetworkArg () const
 

Private Attributes

std::string m_command
 The command which handles interaction with the external signer. More...
 
std::string m_chain
 Bitcoin mainnet, testnet, etc. More...
 

Detailed Description

Enables interaction with an external signing device or service, such as a hardware wallet.

See doc/external-signer.md

Definition at line 18 of file external_signer.h.

Constructor & Destructor Documentation

◆ ExternalSigner()

ExternalSigner::ExternalSigner ( const std::string &  command,
const std::string  chain,
const std::string &  fingerprint,
const std::string  name 
)
Parameters
[in]commandthe command which handles interaction with the external signer
[in]fingerprintmaster key fingerprint of the signer
[in]chain"main", "test", "regtest" or "signet"
[in]namedevice name

Definition at line 18 of file external_signer.cpp.

Member Function Documentation

◆ DisplayAddress()

UniValue ExternalSigner::DisplayAddress ( const std::string &  descriptor) const

Display address on the device.

Calls <command> displayaddress --desc <descriptor>.

Parameters
[in]descriptorDescriptor specifying which address to display. Must include a public key or xpub, as well as key origin.

Definition at line 63 of file external_signer.cpp.

Here is the call graph for this function:

◆ Enumerate()

bool ExternalSigner::Enumerate ( const std::string &  command,
std::vector< ExternalSigner > &  signers,
const std::string  chain 
)
static

Obtain a list of signers.

Calls <command> enumerate.

Parameters
[in]commandthe command which handles interaction with the external signer
[in,out]signersvector to which new signers (with a unique master key fingerprint) are added
chain"main", "test", "regtest" or "signet"
Returns
success

Definition at line 25 of file external_signer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDescriptors()

UniValue ExternalSigner::GetDescriptors ( const int  account)

Get receive and change Descriptor(s) from device for a given account.

Calls <command> getdescriptors --account <account>

Parameters
[in]accountwhich BIP32 account to use (e.g. ‘m/44’/0'/account'`)
Returns
see doc/external-signer.md

Definition at line 68 of file external_signer.cpp.

Here is the call graph for this function:

◆ NetworkArg()

std::string ExternalSigner::NetworkArg ( ) const
private

Definition at line 20 of file external_signer.cpp.

Here is the caller graph for this function:

◆ SignTransaction()

bool ExternalSigner::SignTransaction ( PartiallySignedTransaction psbt,
std::string &  error 
)

Sign PartiallySignedTransaction on the device.

Calls <command> signtransaction and passes the PSBT via stdin.

Parameters
[in,out]psbtPartiallySignedTransaction to be signed

Definition at line 73 of file external_signer.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_chain

std::string ExternalSigner::m_chain
private

Bitcoin mainnet, testnet, etc.

Definition at line 25 of file external_signer.h.

◆ m_command

std::string ExternalSigner::m_command
private

The command which handles interaction with the external signer.

Definition at line 22 of file external_signer.h.

◆ m_fingerprint

std::string ExternalSigner::m_fingerprint

Master key fingerprint of the signer.

Definition at line 37 of file external_signer.h.

◆ m_name

std::string ExternalSigner::m_name

Name of signer.

Definition at line 40 of file external_signer.h.


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