PIVX Core  5.6.99
P2P Digital Currency
Typedefs | Functions | Variables
standard.cpp File Reference
#include "script/standard.h"
#include "pubkey.h"
#include "script/script.h"
Include dependency graph for standard.cpp:

Go to the source code of this file.

Typedefs

typedef std::vector< unsigned char > valtype
 

Functions

const char * GetTxnOutputType (txnouttype t)
 
bool Solver (const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet)
 Parse a scriptPubKey and identify script type for standard scripts. More...
 
bool ExtractDestination (const CScript &scriptPubKey, CTxDestination &addressRet, bool fColdStake)
 Parse a standard scriptPubKey for the destination address. More...
 
bool ExtractDestinations (const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
 Parse a standard scriptPubKey with one or more destination addresses. More...
 
CScript GetScriptForDestination (const CTxDestination &dest)
 Generate a PIVX scriptPubKey for the given CTxDestination. More...
 
CScript GetScriptForRawPubKey (const CPubKey &pubKey)
 Generate a P2PK script for the given pubkey. More...
 
CScript GetScriptForStakeDelegation (const CKeyID &stakingKey, const CKeyID &spendingKey)
 Generate a P2CS script for the given staker and owner keys. More...
 
CScript GetScriptForStakeDelegationLOF (const CKeyID &stakingKey, const CKeyID &spendingKey)
 
CScript GetScriptForMultisig (int nRequired, const std::vector< CPubKey > &keys)
 Generate a multisig script. More...
 
CScript GetScriptForOpReturn (const uint256 &message)
 Generate an OP_RETURN output script with the given data. More...
 
bool IsValidDestination (const CTxDestination &dest)
 Check whether a CTxDestination is a CNoDestination. More...
 

Variables

unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY
 

Typedef Documentation

◆ valtype

typedef std::vector<unsigned char> valtype

Definition at line 12 of file standard.cpp.

Function Documentation

◆ ExtractDestination()

bool ExtractDestination ( const CScript scriptPubKey,
CTxDestination addressRet,
bool  fColdStake = false 
)

Parse a standard scriptPubKey for the destination address.

Assigns result to the addressRet parameter and returns true if successful. For multisig scripts, instead use ExtractDestinations. Currently only works for P2PK, P2PKH, P2SH and P2CS scripts.

Definition at line 162 of file standard.cpp.

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

◆ ExtractDestinations()

bool ExtractDestinations ( const CScript scriptPubKey,
txnouttype typeRet,
std::vector< CTxDestination > &  addressRet,
int &  nRequiredRet 
)

Parse a standard scriptPubKey with one or more destination addresses.

For multisig scripts, this populates the addressRet vector with the pubkey IDs and nRequiredRet with the n required to spend. For P2CS addressRet is populated with the staker and owner IDs and nRequiredRet is set to 2. For other destinations, addressRet is populated with a single value and nRequiredRet is set to 1. Returns true if successful.

Definition at line 195 of file standard.cpp.

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

◆ GetScriptForDestination()

CScript GetScriptForDestination ( const CTxDestination dest)

Generate a PIVX scriptPubKey for the given CTxDestination.

Returns a P2PKH script for a CKeyID destination, a P2SH script for a CScriptID, and an empty script for CNoDestination.

Definition at line 278 of file standard.cpp.

Here is the caller graph for this function:

◆ GetScriptForMultisig()

CScript GetScriptForMultisig ( int  nRequired,
const std::vector< CPubKey > &  keys 
)

Generate a multisig script.

Definition at line 311 of file standard.cpp.

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

◆ GetScriptForOpReturn()

CScript GetScriptForOpReturn ( const uint256 message)

Generate an OP_RETURN output script with the given data.

Definition at line 322 of file standard.cpp.

Here is the call graph for this function:

◆ GetScriptForRawPubKey()

CScript GetScriptForRawPubKey ( const CPubKey pubKey)

Generate a P2PK script for the given pubkey.

Definition at line 286 of file standard.cpp.

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

◆ GetScriptForStakeDelegation()

CScript GetScriptForStakeDelegation ( const CKeyID stakingKey,
const CKeyID spendingKey 
)

Generate a P2CS script for the given staker and owner keys.

Definition at line 291 of file standard.cpp.

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

◆ GetScriptForStakeDelegationLOF()

CScript GetScriptForStakeDelegationLOF ( const CKeyID stakingKey,
const CKeyID spendingKey 
)

Definition at line 301 of file standard.cpp.

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

◆ GetTxnOutputType()

const char* GetTxnOutputType ( txnouttype  t)

Definition at line 18 of file standard.cpp.

Here is the caller graph for this function:

◆ IsValidDestination()

bool IsValidDestination ( const CTxDestination dest)

Check whether a CTxDestination is a CNoDestination.

Definition at line 329 of file standard.cpp.

◆ Solver()

bool Solver ( const CScript scriptPubKey,
txnouttype typeRet,
std::vector< std::vector< unsigned char > > &  vSolutionsRet 
)

Parse a scriptPubKey and identify script type for standard scripts.

If successful, returns script type and parsed pubkeys or hashes, depending on the type. For example, for a P2SH script, vSolutionsRet will contain the script hash, for P2PKH it will contain the key hash, etc.

Parameters
[in]scriptPubKeyScript to parse
[out]typeRetThe script type
[out]vSolutionsRetVector of parsed pubkeys and hashes
Returns
True if script matches standard template

Definition at line 90 of file standard.cpp.

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

Variable Documentation

◆ nMaxDatacarrierBytes

unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY

Definition at line 14 of file standard.cpp.