Raven Core  3.0.0
P2P Digital Currency
standard.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Copyright (c) 2017-2019 The Raven Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef RAVEN_SCRIPT_STANDARD_H
8 #define RAVEN_SCRIPT_STANDARD_H
9 
10 #include "script/interpreter.h"
11 #include "uint256.h"
12 
13 #include <boost/variant.hpp>
14 
15 #include <stdint.h>
16 
17 static const bool DEFAULT_ACCEPT_DATACARRIER = true;
18 
19 class CKeyID;
20 class CScript;
21 
23 class CScriptID : public uint160
24 {
25 public:
26  CScriptID() : uint160() {}
27  CScriptID(const CScript& in);
28  CScriptID(const uint160& in) : uint160(in) {}
29 };
30 
35 static const unsigned int MAX_OP_RETURN_RELAY = 83;
36 
41 extern bool fAcceptDatacarrier;
42 
44 extern unsigned nMaxDatacarrierBytes;
45 
55 static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH;
56 
58 {
60  // 'standard' transaction types:
61  TX_PUBKEY = 1,
73 
74 };
75 
77 public:
78  friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; }
79  friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
80 };
81 
89 typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
90 
92 bool IsValidDestination(const CTxDestination& dest);
93 
95 const char* GetTxnOutputType(txnouttype t);
96 
108 bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet);
109 
116 bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet);
117 
126 bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
127 
134 
136 CScript GetScriptForRawPubKey(const CPubKey& pubkey);
137 
139 CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
140 
143 
149 CScript GetScriptForWitness(const CScript& redeemscript);
150 
151 #endif // RAVEN_SCRIPT_STANDARD_H
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
Definition: standard.cpp:402
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:89
unspendable OP_RETURN script that carries data
Definition: standard.h:65
CScript GetScriptForRawPubKey(const CPubKey &pubkey)
Generate a P2PK script for the given pubkey.
Definition: standard.cpp:363
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:47
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:210
friend bool operator==(const CNoDestination &a, const CNoDestination &b)
Definition: standard.h:78
CScriptID()
Definition: standard.h:26
CScript GetScriptForNullAssetDataDestination(const CTxDestination &dest)
Generate a script that contains an address used for qualifier, and restricted assets data transaction...
Definition: standard.cpp:355
friend bool operator<(const CNoDestination &a, const CNoDestination &b)
Definition: standard.h:79
CScript GetScriptForWitness(const CScript &redeemscript)
Generate a pay-to-witness script for the given redeem script.
Definition: standard.cpp:379
An encapsulated public key.
Definition: pubkey.h:40
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
Definition: standard.cpp:368
bool fAcceptDatacarrier
A data carrying output is an unspendable output containing data.
Definition: standard.cpp:19
CScriptID(const uint160 &in)
Definition: standard.h:28
txnouttype
Definition: standard.h:57
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Raven scriptPubKey for the given CTxDestination.
Definition: standard.cpp:347
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:396
RVN START.
Definition: standard.h:69
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:30
160-bit opaque blob.
Definition: uint256.h:112
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:23
const char * GetTxnOutputType(txnouttype t)
Get the name of a txnouttype as a C string, or nullptr if unknown.
Definition: standard.cpp:24
unsigned nMaxDatacarrierBytes
Maximum size of TX_NULL_DATA scripts that this node considers standard.
Definition: standard.cpp:20
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:251
unspendable OP_RAVEN_ASSET script that carries data
Definition: standard.h:72