Bitcoin ABC 0.34.2
P2P Digital Currency
Classes | Typedefs | Functions | Variables
sign.h File Reference
#include <attributes.h>
#include <coins.h>
#include <hash.h>
#include <pubkey.h>
#include <script/interpreter.h>
#include <script/keyorigin.h>
#include <script/sighashtype.h>
#include <streams.h>
Include dependency graph for sign.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  BaseSignatureCreator
 Interface for signature creators. More...
 
class  MutableTransactionSignatureCreator
 A signature creator for transactions. More...
 
struct  SignatureData
 

Typedefs

typedef std::pair< CPubKey, std::vector< uint8_t > > SigPair
 

Functions

template<typename Stream , typename... X>
void SerializeToVector (Stream &s, const X &...args)
 
template<typename Stream , typename... X>
void UnserializeFromVector (Stream &s, X &...args)
 
template<typename Stream >
void DeserializeHDKeypaths (Stream &s, const std::vector< uint8_t > &key, std::map< CPubKey, KeyOriginInfo > &hd_keypaths)
 
template<typename Stream >
void SerializeHDKeypaths (Stream &s, const std::map< CPubKey, KeyOriginInfo > &hd_keypaths, uint8_t type)
 
bool ProduceSignature (const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &scriptPubKey, SignatureData &sigdata)
 Produce a script signature using a generic signature creator. More...
 
bool SignSignature (const SigningProvider &provider, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, const Amount amount, SigHashType sigHashType)
 Produce a script signature for a transaction. More...
 
bool SignSignature (const SigningProvider &provider, const CTransaction &txFrom, CMutableTransaction &txTo, unsigned int nIn, SigHashType sigHashType)
 
SignatureData DataFromTransaction (const CMutableTransaction &tx, unsigned int nIn, const CTxOut &txout)
 Extract signature data from a transaction input, and insert it. More...
 
void UpdateInput (CTxIn &input, const SignatureData &data)
 
bool IsSolvable (const SigningProvider &provider, const CScript &script)
 Check whether we know how to sign for an output like this, assuming we have all private keys. More...
 
bool SignTransaction (CMutableTransaction &mtx, const SigningProvider *provider, const std::map< COutPoint, Coin > &coins, SigHashType sigHashType, std::map< int, std::string > &input_errors)
 Sign the CMutableTransaction. More...
 

Variables

const BaseSignatureCreator & DUMMY_SIGNATURE_CREATOR
 A signature creator that just produces 71-byte empty signatures. More...
 
const BaseSignatureCreator & DUMMY_MAXIMUM_SIGNATURE_CREATOR
 A signature creator that just produces 72-byte empty signatures. More...
 

Typedef Documentation

◆ SigPair

typedef std::pair<CPubKey, std::vector<uint8_t> > SigPair

Definition at line 61 of file sign.h.

Function Documentation

◆ DataFromTransaction()

SignatureData DataFromTransaction ( const CMutableTransaction &  tx,
unsigned int  nIn,
const CTxOut &  txout 
)

Extract signature data from a transaction input, and insert it.

Definition at line 287 of file sign.cpp.

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

◆ DeserializeHDKeypaths()

template<typename Stream >
void DeserializeHDKeypaths ( Stream &  s,
const std::vector< uint8_t > &  key,
std::map< CPubKey, KeyOriginInfo > &  hd_keypaths 
)

Definition at line 118 of file sign.h.

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

◆ IsSolvable()

bool IsSolvable ( const SigningProvider &  provider,
const CScript &  script 
)

Check whether we know how to sign for an output like this, assuming we have all private keys.

While this function does not need private keys, the passed keystore is used to look up public keys and redeemscripts by hash. Solvability is unrelated to whether we consider this output to be ours.

Definition at line 436 of file sign.cpp.

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

◆ ProduceSignature()

bool ProduceSignature ( const SigningProvider &  provider,
const BaseSignatureCreator &  creator,
const CScript &  scriptPubKey,
SignatureData &  sigdata 
)

Produce a script signature using a generic signature creator.

Definition at line 210 of file sign.cpp.

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

◆ SerializeHDKeypaths()

template<typename Stream >
void SerializeHDKeypaths ( Stream &  s,
const std::map< CPubKey, KeyOriginInfo > &  hd_keypaths,
uint8_t  type 
)

Definition at line 156 of file sign.h.

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

◆ SerializeToVector()

template<typename Stream , typename... X>
void SerializeToVector ( Stream &  s,
const X &...  args 
)

Definition at line 96 of file sign.h.

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

◆ SignSignature() [1/2]

bool SignSignature ( const SigningProvider &  provider,
const CScript &  fromPubKey,
CMutableTransaction &  txTo,
unsigned int  nIn,
const Amount  amount,
SigHashType  sigHashType 
)

Produce a script signature for a transaction.

Definition at line 362 of file sign.cpp.

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

◆ SignSignature() [2/2]

bool SignSignature ( const SigningProvider &  provider,
const CTransaction &  txFrom,
CMutableTransaction &  txTo,
unsigned int  nIn,
SigHashType  sigHashType 
)

Definition at line 375 of file sign.cpp.

Here is the call graph for this function:

◆ SignTransaction()

bool SignTransaction ( CMutableTransaction &  mtx,
const SigningProvider *  provider,
const std::map< COutPoint, Coin > &  coins,
SigHashType  sigHashType,
std::map< int, std::string > &  input_errors 
)

Sign the CMutableTransaction.

Definition at line 453 of file sign.cpp.

Here is the call graph for this function:

◆ UnserializeFromVector()

template<typename Stream , typename... X>
void UnserializeFromVector ( Stream &  s,
X &...  args 
)

Definition at line 106 of file sign.h.

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

◆ UpdateInput()

void UpdateInput ( CTxIn &  input,
const SignatureData &  data 
)

Definition at line 343 of file sign.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ DUMMY_MAXIMUM_SIGNATURE_CREATOR

const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR
extern

A signature creator that just produces 72-byte empty signatures.

Definition at line 433 of file sign.cpp.

◆ DUMMY_SIGNATURE_CREATOR

const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR
extern

A signature creator that just produces 71-byte empty signatures.

Definition at line 431 of file sign.cpp.