Bitcoin Core  21.99.0
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Public Attributes | 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 &fingerprint, std::string chain, std::string name)
 
const std::string NetworkArg () const
 
UniValue DisplayAddress (const std::string &descriptor) const
 Display address on the device. More...
 
UniValue GetDescriptors (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, std::string chain, bool ignore_errors=false)
 Obtain a list of signers. More...
 

Public Attributes

std::string m_fingerprint
 Master key fingerprint of the signer. More...
 
std::string m_chain
 Bitcoin mainnet, testnet, etc. More...
 
std::string m_name
 Name of signer. More...
 

Private Attributes

std::string m_command
 The command which handles interaction with the external signer. 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 22 of file external_signer.h.

Constructor & Destructor Documentation

◆ ExternalSigner()

ExternalSigner::ExternalSigner ( const std::string &  command,
const std::string &  fingerprint,
std::string  chain,
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 12 of file external_signer.cpp.

Here is the caller graph for this function:

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 62 of file external_signer.cpp.

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

◆ Enumerate()

bool ExternalSigner::Enumerate ( const std::string &  command,
std::vector< ExternalSigner > &  signers,
std::string  chain,
bool  ignore_errors = false 
)
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"
[out]successBoolean

Definition at line 21 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 ( 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'`)
[out]UniValuesee doc/external-signer.md

Definition at line 67 of file external_signer.cpp.

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

◆ NetworkArg()

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

Definition at line 14 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 72 of file external_signer.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_chain

std::string ExternalSigner::m_chain

Bitcoin mainnet, testnet, etc.

Definition at line 39 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 26 of file external_signer.h.

◆ m_fingerprint

std::string ExternalSigner::m_fingerprint

Master key fingerprint of the signer.

Definition at line 36 of file external_signer.h.

◆ m_name

std::string ExternalSigner::m_name

Name of signer.

Definition at line 42 of file external_signer.h.


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