Bitcoin Core  27.99.0
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/signingprovider.h>
#include <uint256.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< unsigned char > > SigPair
 

Functions

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 CAmount &amount, int nHashType, SignatureData &sig_data)
 Produce a satisfying script (scriptSig or witness). More...
 
bool SignSignature (const SigningProvider &provider, const CTransaction &txFrom, CMutableTransaction &txTo, unsigned int nIn, int nHashType, SignatureData &sig_data)
 
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 IsSegWitOutput (const SigningProvider &provider, const CScript &script)
 Check whether a scriptPubKey is known to be segwit. More...
 
bool SignTransaction (CMutableTransaction &mtx, const SigningProvider *provider, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors)
 Sign the CMutableTransaction. More...
 

Variables

const BaseSignatureCheckerDUMMY_CHECKER
 A signature checker that accepts all signatures. More...
 
const BaseSignatureCreatorDUMMY_SIGNATURE_CREATOR
 A signature creator that just produces 71-byte empty signatures. More...
 
const BaseSignatureCreatorDUMMY_MAXIMUM_SIGNATURE_CREATOR
 A signature creator that just produces 72-byte empty signatures. More...
 

Typedef Documentation

◆ SigPair

typedef std::pair<CPubKey, std::vector<unsigned char> > SigPair

Definition at line 63 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 607 of file sign.cpp.

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

◆ IsSegWitOutput()

bool IsSegWitOutput ( const SigningProvider provider,
const CScript script 
)

Check whether a scriptPubKey is known to be segwit.

Definition at line 765 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 499 of file sign.cpp.

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 CAmount amount,
int  nHashType,
SignatureData sig_data 
)

Produce a satisfying script (scriptSig or witness).

Parameters
providerUtility containing the information necessary to solve a script.
fromPubKeyThe script to produce a satisfaction for.
txToThe spending transaction.
nInThe index of the input in txTo referring the output being spent.
amountThe value of the output being spent.
nHashTypeSignature hash type.
sig_dataAdditional data provided to solve a script. Filled with the resulting satisfying script and whether the satisfaction is complete.
Returns
True if the produced script is entirely satisfying fromPubKey.

Definition at line 694 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,
int  nHashType,
SignatureData sig_data 
)

Definition at line 705 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,
int  sighash,
std::map< int, bilingual_str > &  input_errors 
)

Sign the CMutableTransaction.

Definition at line 784 of file sign.cpp.

Here is the call graph for this function:

◆ UpdateInput()

void UpdateInput ( CTxIn input,
const SignatureData data 
)

Definition at line 672 of file sign.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ DUMMY_CHECKER

const BaseSignatureChecker& DUMMY_CHECKER
extern

A signature checker that accepts all signatures.

Definition at line 728 of file sign.cpp.

◆ DUMMY_MAXIMUM_SIGNATURE_CREATOR

const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR
extern

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

Definition at line 763 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 762 of file sign.cpp.