Raven Core  3.0.0
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, CScriptIDCTxDestination
 A txout script template with a specific destination. More...
 

Enumerations

enum  txnouttype {
  TX_NONSTANDARD = 0, TX_PUBKEY = 1, TX_PUBKEYHASH = 2, TX_SCRIPTHASH = 3,
  TX_MULTISIG = 4, TX_NULL_DATA = 5, TX_WITNESS_V0_SCRIPTHASH = 6, TX_WITNESS_V0_KEYHASH = 7,
  TX_NEW_ASSET = 8, TX_REISSUE_ASSET = 9, TX_TRANSFER_ASSET = 10, TX_RESTRICTED_ASSET_DATA = 11
}
 

Functions

bool IsValidDestination (const CTxDestination &dest)
 Check whether a CTxDestination is a CNoDestination. More...
 
const char * GetTxnOutputType (txnouttype t)
 Get the name of a txnouttype as a C string, or nullptr if unknown. More...
 
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)
 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 Raven 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 GetScriptForNullAssetDataDestination (const CTxDestination &dest)
 Generate a script that contains an address used for qualifier, and restricted assets data transactions. More...
 
CScript GetScriptForWitness (const CScript &redeemscript)
 Generate a pay-to-witness script for the given redeem script. More...
 

Variables

bool fAcceptDatacarrier
 A data carrying output is an unspendable output containing data. More...
 
unsigned nMaxDatacarrierBytes
 Maximum size of TX_NULL_DATA scripts that this node considers standard. More...
 

Typedef Documentation

◆ CTxDestination

typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination

A txout script template with a specific destination.

It is either:

  • CNoDestination: no destination set
  • CKeyID: TX_PUBKEYHASH destination
  • CScriptID: TX_SCRIPTHASH destination A CTxDestination is the internal data type encoded in a ravencoin address

Definition at line 89 of file standard.h.

Enumeration Type Documentation

◆ txnouttype

enum txnouttype
Enumerator
TX_NONSTANDARD 
TX_PUBKEY 
TX_PUBKEYHASH 
TX_SCRIPTHASH 
TX_MULTISIG 
TX_NULL_DATA 

unspendable OP_RETURN script that carries data

TX_WITNESS_V0_SCRIPTHASH 
TX_WITNESS_V0_KEYHASH 
TX_NEW_ASSET 

RVN START.

TX_REISSUE_ASSET 
TX_TRANSFER_ASSET 
TX_RESTRICTED_ASSET_DATA 

unspendable OP_RAVEN_ASSET script that carries data

Definition at line 57 of file standard.h.

Function Documentation

◆ ExtractDestination()

bool ExtractDestination ( const CScript scriptPubKey,
CTxDestination addressRet 
)

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, and P2SH scripts.

RVN START

RVN END

Definition at line 210 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 other destinations, addressRet is populated with a single value and nRequiredRet is set to 1. Returns true if successful. Currently does not extract address from pay-to-witness scripts.

Definition at line 251 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 Raven 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 347 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 368 of file standard.cpp.

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

◆ GetScriptForNullAssetDataDestination()

CScript GetScriptForNullAssetDataDestination ( const CTxDestination dest)

Generate a script that contains an address used for qualifier, and restricted assets data transactions.

Definition at line 355 of file standard.cpp.

Here is the caller graph for this function:

◆ GetScriptForRawPubKey()

CScript GetScriptForRawPubKey ( const CPubKey pubkey)

Generate a P2PK script for the given pubkey.

Definition at line 363 of file standard.cpp.

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

◆ GetScriptForWitness()

CScript GetScriptForWitness ( const CScript redeemscript)

Generate a pay-to-witness script for the given redeem script.

If the redeem script is P2PK or P2PKH, this returns a P2WPKH script, otherwise it returns a P2WSH script.

Definition at line 379 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)

Get the name of a txnouttype as a C string, or nullptr if unknown.

RVN START

RVN END

Definition at line 24 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 402 of file standard.cpp.

Here is the caller graph for this function:

◆ 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

RVN START

RVN END

Definition at line 47 of file standard.cpp.

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

Variable Documentation

◆ fAcceptDatacarrier

bool fAcceptDatacarrier

A data carrying output is an unspendable output containing data.

The script type is designated as TX_NULL_DATA.

Definition at line 19 of file standard.cpp.

◆ nMaxDatacarrierBytes

unsigned nMaxDatacarrierBytes

Maximum size of TX_NULL_DATA scripts that this node considers standard.

Definition at line 20 of file standard.cpp.