Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2018-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_EXTERNAL_SIGNER_H6#define BITCOIN_EXTERNAL_SIGNER_H8#include <common/system.h>9#include <univalue.h>11#include <string>12#include <vector>14class PartiallySignedTransaction;16//! Enables interaction with an external signing device or service, such as17//! a hardware wallet. See doc/external-signer.md18class ExternalSigner19{20private:21//! The command which handles interaction with the external signer.22std::vector<std::string> m_command;24//! Bitcoin mainnet, testnet, etc25std::string m_chain;27std::vector<std::string> NetworkArg() const;29public:30//! @param[in] command the command which handles interaction with the external signer31//! @param[in] fingerprint master key fingerprint of the signer32//! @param[in] chain "main", "test", "signet", "regtest" or "testnet4"33//! @param[in] name device name34ExternalSigner(std::vector<std::string> command, std::string chain, std::string fingerprint, std::string name);36//! Master key fingerprint of the signer37std::string m_fingerprint;39//! Name of signer40std::string m_name;42//! Obtain a list of signers. Calls `<command> enumerate`.43//! @param[in] command the command which handles interaction with the external signer44//! @param[in,out] signers vector to which new signers (with a unique master key fingerprint) are added45//! @param chain "main", "test", "signet", "regtest" or "testnet4"46//! @returns success47static bool Enumerate(const std::string& command, std::vector<ExternalSigner>& signers, const std::string& chain);49//! Display address on the device. Calls `<command> --fingerprint <fingerprint> --chain <chain>50//! displayaddress --desc <descriptor>`.51//! @param[in] descriptor Descriptor specifying which address to display.52//! Must include a public key or xpub, as well as key origin.53UniValue DisplayAddress(const std::string& descriptor) const;55//! Get receive and change Descriptor(s) from device for a given account.56//! Calls `<command> --fingerprint <fingerprint> --chain <chain> getdescriptors57//! --account <account>`.58//! @param[in] account which BIP32 account to use (e.g. `m/44'/0'/account'`)59//! @returns see doc/external-signer.md60UniValue GetDescriptors(int account);62//! Sign PartiallySignedTransaction on the device.63//! Calls `<command> --stdin --fingerprint <fingerprint> --chain <chain>` and passes the64//! `signtx` command and PSBT via stdin.65//! @param[in,out] psbt PartiallySignedTransaction to be signed66bool SignTransaction(PartiallySignedTransaction& psbt, std::string& error);67};69#endif // BITCOIN_EXTERNAL_SIGNER_H