Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

standard.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_SCRIPT_STANDARD_H
7 #define BITCOIN_SCRIPT_STANDARD_H
8 
9 #include <script/interpreter.h>
10 #include <uint256.h>
11 
12 #include <boost/variant.hpp>
13 
14 #include <stdint.h>
15 
16 static const bool DEFAULT_ACCEPT_DATACARRIER = true;
17 
18 class CKeyID;
19 class CScript;
20 
22 class CScriptID : public uint160
23 {
24 public:
25  CScriptID() : uint160() {}
26  CScriptID(const CScript& in);
27  CScriptID(const uint160& in) : uint160(in) {}
28 };
29 
34 static const unsigned int MAX_OP_RETURN_RELAY = 83;
35 
40 extern bool fAcceptDatacarrier;
41 
43 extern unsigned nMaxDatacarrierBytes;
44 
55 
57 {
59  // 'standard' transaction types:
65 };
66 
68 public:
69  friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; }
70  friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
71 };
72 
80 typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
81 
83 bool IsValidDestination(const CTxDestination& dest);
84 
86 const char* GetTxnOutputType(txnouttype t);
87 
99 bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet);
100 
107 bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet);
108 
116 bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
117 
124 
126 CScript GetScriptForRawPubKey(const CPubKey& pubkey);
127 
129 CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
130 
131 #endif // BITCOIN_SCRIPT_STANDARD_H
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
Definition: standard.cpp:281
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
unspendable OP_RETURN script that carries data
Definition: standard.h:64
CScript GetScriptForRawPubKey(const CPubKey &pubkey)
Generate a P2PK script for the given pubkey.
Definition: standard.cpp:264
static const unsigned int MAX_OP_RETURN_RELAY
Default setting for nMaxDatacarrierBytes.
Definition: standard.h:34
static const bool DEFAULT_ACCEPT_DATACARRIER
Definition: standard.h:16
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
Definition: standard.cpp:35
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:158
friend bool operator==(const CNoDestination &a, const CNoDestination &b)
Definition: standard.h:69
CScriptID()
Definition: standard.h:25
friend bool operator<(const CNoDestination &a, const CNoDestination &b)
Definition: standard.h:70
An encapsulated public key.
Definition: pubkey.h:30
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
Definition: standard.cpp:269
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
Definition: standard.cpp:16
CScriptID(const uint160 &in)
Definition: standard.h:27
txnouttype
Definition: standard.h:56
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:256
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:389
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:20
160-bit opaque blob.
Definition: uint256.h:112
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:22
const char * GetTxnOutputType(txnouttype t)
Get the name of a txnouttype as a C string, or nullptr if unknown.
Definition: standard.cpp:21
unsigned nMaxDatacarrierBytes
Maximum size of TX_NULL_DATA scripts that this node considers standard.
Definition: standard.cpp:17
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
Definition: standard.cpp:188
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS
Mandatory script verification flags that all new blocks must comply with for them to be valid...
Definition: standard.h:54
Released under the MIT license