PIVX Core  5.6.99
P2P Digital Currency
Classes | Typedefs | Enumerations | Functions | Variables
standard.h File Reference
#include "script/interpreter.h"
#include "uint256.h"
#include <boost/variant.hpp>
#include <stdint.h>
Include dependency graph for standard.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CScriptID
 A reference to a CScript: the Hash160 of its serialization (see script.h) More...
 
class  CNoDestination
 

Typedefs

typedef boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyIDCTxDestination
 A txout script template with a specific destination. More...
 

Enumerations

enum  txnouttype {
  TX_NONSTANDARD , TX_PUBKEY , TX_PUBKEYHASH , TX_SCRIPTHASH ,
  TX_MULTISIG , TX_NULL_DATA , TX_COLDSTAKE , TX_EXCHANGEADDR
}
 

Functions

bool IsValidDestination (const CTxDestination &dest)
 Check whether a CTxDestination is a CNoDestination. More...
 
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=false)
 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 GetScriptForMultisig (int nRequired, const std::vector< CPubKey > &keys)
 Generate a multisig script. 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 GetScriptForOpReturn (const uint256 &message)
 Generate an OP_RETURN output script with the given data. More...
 

Variables

unsigned nMaxDatacarrierBytes
 

Typedef Documentation

◆ CTxDestination

A txout script template with a specific destination.

It is either:

Definition at line 72 of file standard.h.

Enumeration Type Documentation

◆ txnouttype

enum txnouttype
Enumerator
TX_NONSTANDARD 
TX_PUBKEY 
TX_PUBKEYHASH 
TX_SCRIPTHASH 
TX_MULTISIG 
TX_NULL_DATA 
TX_COLDSTAKE 
TX_EXCHANGEADDR 

Definition at line 45 of file standard.h.

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
extern

Definition at line 14 of file standard.cpp.