PRCYCoin  2.0.0.7rc1
P2P Digital Currency
transaction.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Copyright (c) 2015-2018 The PIVX developers
4 // Copyright (c) 2018-2020 The DAPS Project developers
5 // Distributed under the MIT software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #ifndef BITCOIN_PRIMITIVES_TRANSACTION_H
9 #define BITCOIN_PRIMITIVES_TRANSACTION_H
10 
11 #include "amount.h"
12 #include "script/script.h"
13 #include "serialize.h"
14 #include "uint256.h"
15 #include "../bip38.h"
16 #include <iostream>
17 #include "key.h"
18 
19 #include <list>
20 
21 //Elliptic Curve Diffie Helman: encodes and decodes the amount b and mask a
22 // where C= aG + bH
23 void ecdhEncode(uint256& unmasked, uint256& amount, const unsigned char * sharedSec, int size);
24 void ecdhDecode(uint256& masked, uint256& amount, const unsigned char * sharedSec, int size);
25 
26 class ECDHInfo {
27 public:
28  static void ComputeSharedSec(const CKey& priv, const CPubKey& pubKey, CPubKey& sharedSec);
29  static void Encode(const CKey& mask, const CAmount& amount, const CPubKey& sharedSec, uint256& encodedMask, uint256& encodedAmount);
30  static void Decode(unsigned char* encodedMask, unsigned char* encodedAmount, const CPubKey& sharedSec, CKey& decodedMask, CAmount& decodedAmount);
31 };
32 
33 class CTransaction;
34 
36 class COutPoint
37 {
38 public:
40  uint32_t n;
41 
42  COutPoint() { SetNull(); }
43  COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; }
44 
46 
47  template <typename Stream, typename Operation>
48  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
49  READWRITE(hash);
50  READWRITE(n);
51  }
52 
53  void SetNull() { hash.SetNull(); n = (uint32_t) -1; }
54  bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); }
55  bool IsMasternodeReward(const CTransaction* tx) const;
56 
57  friend bool operator<(const COutPoint& a, const COutPoint& b)
58  {
59  return (a.hash < b.hash || (a.hash == b.hash && a.n < b.n));
60  }
61 
62  friend bool operator==(const COutPoint& a, const COutPoint& b)
63  {
64  return (a.hash == b.hash && a.n == b.n);
65  }
66 
67  friend bool operator!=(const COutPoint& a, const COutPoint& b)
68  {
69  return !(a == b);
70  }
71 
72  std::string ToString() const;
73  std::string ToStringShort() const;
74 
75  uint256 GetHash();
76 
77 };
78 
83 class CTxIn
84 {
85 public:
88  uint32_t nSequence;
90  std::vector<unsigned char> s; //used for shnor sig
91  std::vector<unsigned char> R; //used for shnor sig
92 
93  //ECDH key used for encrypting/decrypting the transaction amount
94  //it is only not NULL when the prevout is used for staking to prove the transaction amount
95  //the prevout has the hash of encryptionKey to ensure that the staking node is not cheating
96  std::vector<unsigned char> encryptionKey; //33bytes
97  CKeyImage keyImage; //have the same number element as vin
98  std::vector<COutPoint> decoys;
99  std::vector<unsigned char> masternodeStealthAddress;
100 
102  {
103  nSequence = std::numeric_limits<unsigned int>::max();
104  }
105 
106  explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max());
107  CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<uint32_t>::max());
108 
110 
111  template <typename Stream, typename Operation>
112  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
118  READWRITE(decoys);
120  READWRITE(this->s);
121  READWRITE(R);
122  }
123 
124  bool IsFinal() const
125  {
126  return (nSequence == std::numeric_limits<uint32_t>::max());
127  }
128 
129  friend bool operator==(const CTxIn& a, const CTxIn& b)
130  {
131  return (a.prevout == b.prevout &&
132  a.scriptSig == b.scriptSig &&
133  a.nSequence == b.nSequence &&
134  a.encryptionKey == b.encryptionKey &&
135  a.keyImage == b.keyImage &&
136  a.decoys == b.decoys);
137  }
138 
139  friend bool operator!=(const CTxIn& a, const CTxIn& b)
140  {
141  return !(a == b);
142  }
143 
144  std::string ToString() const;
145 };
146 
147 typedef struct MaskValue {
148  CPubKey sharedSec; //secret is computed based on the transaction pubkey, using diffie hellman
149  //sharedSec = txPub * viewPrivateKey of receiver = txPriv * viewPublicKey of receiver
151  uint256 mask; //blinding factor, this is encoded throug ECDH before sending to the receiver
153  uint256 hashOfKey; //hash of encrypting key
155  amount.SetNull();
156  mask.SetNull();
157  hashOfKey.SetNull();
158  }
159 } MaskValue;
160 
164 class CTxOut
165 {
166 public:
167  CAmount nValue; //should always be 0
169  int nRounds;
170  //txPriv is optional and will be used for PoS blocks to incentivize masternodes
171  //and fullnodes will use it to verify whether the reward is really sent to the registered address of masternodes
172  std::vector<unsigned char> txPriv;
173  std::vector<unsigned char> txPub;
174  //ECDH encoded value for the amount: the idea is the use the shared secret and a key derivation function to
175  //encode the value and the mask so that only the sender and the receiver of the tx output can decode the encoded amount
177  std::vector<unsigned char> masternodeStealthAddress; //will be clone from the tx having 1000000 prcy output
178  std::vector<unsigned char> commitment; //Commitment C = mask * G + amount * H, H = Hp(G), Hp = toHashPoint
179 
181  {
182  SetNull();
183  }
184 
185  CTxOut(const CAmount& nValueIn, CScript scriptPubKeyIn);
186 
188 
189  template <typename Stream, typename Operation>
190  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
191  READWRITE(nValue);
193  READWRITE(txPriv);
194  READWRITE(txPub);
200  }
201 
202  void SetNull()
203  {
204  nValue = -1;
206  nRounds = -10; // an initial value, should be no way to get this by calculations
207  }
208 
209  bool IsNull() const
210  {
211  return (nValue == -1);
212  }
213 
214  void SetEmpty()
215  {
216  nValue = 0;
218  }
219 
220  bool IsEmpty() const
221  {
222  return (nValue == 0 && scriptPubKey.empty());
223  }
224 
225  uint256 GetHash() const;
226 
228  {
229  // "Dust" is defined in terms of CTransaction::minRelayTxFee, which has units duffs-per-kilobyte.
230  // If you'd pay more than 1/3 in fees to spend something, then we consider it dust.
231  // A typical txout is 34 bytes big, and will need a CTxIn of at least 148 bytes to spend
232  // i.e. total is 148 + 32 = 182 bytes. Default -minrelaytxfee is 10000 duffs per kB
233  // and that means that fee per txout is 182 * 10000 / 1000 = 1820 duffs.
234  // So dust is a txout less than 1820 *3 = 5460 duffs
235  // with default -minrelaytxfee = minRelayTxFee = 10000 duffs per kB.
236  size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
237  return (nValue < 3*minRelayTxFee.GetFee(nSize));
238  }
239 
240  friend bool operator==(const CTxOut& a, const CTxOut& b)
241  {
242  return (a.nValue == b.nValue &&
243  a.scriptPubKey == b.scriptPubKey &&
244  a.nRounds == b.nRounds);
245  }
246 
247  friend bool operator!=(const CTxOut& a, const CTxOut& b)
248  {
249  return !(a == b);
250  }
251 
252  std::string ToString() const;
253 };
254 
255 struct CMutableTransaction;
256 
257 enum {
258  TX_TYPE_FULL = 0, //used for any normal transaction
259  //transaction with no hidden amount (used for collateral transaction, rewarding transaction
260  // (for masternode and staking node), and PoA mining rew)
262  TX_TYPE_REVEAL_SENDER, //transaction with no ring signature (used for decollateral transaction + reward transaction
263  TX_TYPE_REVEAL_BOTH //this is a staking transaction that consumes a staking coin and rewards the staking node and masternode
264 };
265 
270 {
271 private:
273  const uint256 hash;
274  void UpdateHash() const;
275 
276 public:
277  static const int32_t CURRENT_VERSION=1;
278 
279  // The local variables are made const to prevent unintended modification
280  // without updating the cached hash value. However, CTransaction is not
281  // actually immutable; deserialization and assignment are implemented,
282  // and bypass the constness. This is safe, as they update the entire
283  // structure, including the hash.
284  const int32_t nVersion;
285  std::vector<CTxIn> vin;
286  std::vector<CTxOut> vout;
287  const uint32_t nLockTime;
288 
289  //For stealth transactions
290  CKey txPrivM; //only in-memory
292  uint64_t paymentID;
293  //const unsigned int nTime;
294  uint32_t txType;
295 
296  std::vector<unsigned char> bulletproofs;
297 
299 
301  std::vector<std::vector<uint256>> S;
302 
303  //additional key image for transaction fee
305 
307  CTransaction();
308 
311 
312  CTransaction& operator=(const CTransaction& tx);
313 
315 
316  template <typename Stream, typename Operation>
317  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
318  READWRITE(*const_cast<int32_t*>(&this->nVersion));
319  nVersion = this->nVersion;
320  READWRITE(*const_cast<std::vector<CTxIn>*>(&vin));
321  READWRITE(*const_cast<std::vector<CTxOut>*>(&vout));
322  READWRITE(*const_cast<uint32_t*>(&nLockTime));
324  if (hasPaymentID != 0) {
326  }
327  READWRITE(txType);
329  READWRITE(nTxFee);
330 
331  READWRITE(c);
332  READWRITE(S);
334  if (ser_action.ForRead())
335  UpdateHash();
336  }
337 
338  bool IsNull() const {
339  return vin.empty() && vout.empty();
340  }
341 
342  const uint256& GetHash() const {
343  UpdateHash();
344  return hash;
345  }
346 
347  // Return sum of txouts.
348  CAmount GetValueOut() const;
349 
350  // Compute priority, given priority of inputs and (optionally) tx size
351  double ComputePriority(double dPriorityInputs, unsigned int nTxSize=0) const;
352 
353  // Compute modified tx size for priority calculation (optionally given tx size)
354  unsigned int CalculateModifiedSize(unsigned int nTxSize=0) const;
355 
356  bool UsesUTXO(const COutPoint out);
357  std::list<COutPoint> GetOutPoints() const;
358 
359  bool IsCoinBase() const
360  {
361  return (vin.size() == 1 && vin[0].prevout.IsNull());
362  }
363 
364  bool IsCoinAudit() const
365  {
366  return (vin.size() == 1 && vin[0].prevout.IsNull());
367  }
368 
369  bool IsCoinStake() const;
370 
371  friend bool operator==(const CTransaction& a, const CTransaction& b)
372  {
373  return a.hash == b.hash;
374  }
375 
376  friend bool operator!=(const CTransaction& a, const CTransaction& b)
377  {
378  return a.hash != b.hash;
379  }
380  std::string ToString() const;
381 };
382 
385 {
386  int32_t nVersion;
387  std::vector<CTxIn> vin;
388  std::vector<CTxOut> vout;
389  uint32_t nLockTime;
390  //For stealth transactions
393  uint64_t paymentID;
394  uint32_t txType;
395  std::vector<unsigned char> bulletproofs;
396 
399  std::vector<std::vector<uint256>> S;
401 
404 
406 
407  template <typename Stream, typename Operation>
408  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
409  READWRITE(this->nVersion);
410  nVersion = this->nVersion;
411  READWRITE(vin);
412  READWRITE(vout);
415  if (hasPaymentID != 0) {
417  }
418  READWRITE(txType);
419 
421 
422  READWRITE(nTxFee);
423  READWRITE(c);
424  READWRITE(S);
426  }
427 
431  uint256 GetHash() const;
432 
433  std::string ToString() const;
434 };
435 
437 {
438  int32_t nVersion;
439  std::vector<CTxIn> vin;
440  std::vector<CTxOut> vout;
441  uint32_t nLockTime;
442  //For stealth transactions
445  uint64_t paymentID;
446  uint32_t txType;
447 
449 
451  *const_cast<int*>(&nVersion) = tx.nVersion;
452  *const_cast<std::vector<CTxIn>*>(&vin) = tx.vin;
453  *const_cast<std::vector<CTxOut>*>(&vout) = tx.vout;
454  *const_cast<unsigned int*>(&nLockTime) = tx.nLockTime;
456  *const_cast<uint64_t*>(&paymentID) = tx.paymentID;
457  *const_cast<uint32_t*>(&txType) = tx.txType;
458  nTxFee = tx.nTxFee;
459 
460  //set transaction output amounts as 0
461  for (size_t i = 0; i < vout.size(); i++) {
462  vout[i].nValue = 0;
463  }
464  }
465 
467 
468  template <typename Stream, typename Operation>
469  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
470  READWRITE(this->nVersion);
471  nVersion = this->nVersion;
472  READWRITE(vin);
473  READWRITE(vout);
476  if (hasPaymentID != 0) {
478  }
479  READWRITE(txType);
480 
481  READWRITE(nTxFee);
482  }
483 
485  return SerializeHash(*this);
486  }
487 };
488 
490 {
491 public:
494  uint32_t nSequence;
495 
496  std::vector<unsigned char> encryptionKey; //33bytes
497  CKeyImage keyImage; //have the same number element as vin
498  std::vector<unsigned char> masternodeStealthAddress;
499 
501  {
502  prevout = in.prevout;
503  scriptSig = in.scriptSig;
504  nSequence = in.nSequence;
506  keyImage = in.keyImage;
508  }
509 
511 
512  template <typename Stream, typename Operation>
513  inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
520  }
521 
523  return SerializeHash(*this);
524  }
525 };
526 
527 #endif // BITCOIN_PRIMITIVES_TRANSACTION_H
CTransaction::IsCoinAudit
bool IsCoinAudit() const
Definition: transaction.h:364
TX_TYPE_REVEAL_BOTH
@ TX_TYPE_REVEAL_BOTH
Definition: transaction.h:263
CTransaction::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:314
CTxIn
An input of a transaction.
Definition: transaction.h:83
COutPoint::operator<
friend bool operator<(const COutPoint &a, const COutPoint &b)
Definition: transaction.h:57
CMutableTransaction::vin
std::vector< CTxIn > vin
Definition: transaction.h:387
CTransactionSignature::txType
uint32_t txType
Definition: transaction.h:446
SerializeHash
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
Definition: hash.h:295
TX_TYPE_REVEAL_SENDER
@ TX_TYPE_REVEAL_SENDER
Definition: transaction.h:262
CTransactionSignature::txPrivM
CKey txPrivM
Definition: transaction.h:443
CTxIn::encryptionKey
std::vector< unsigned char > encryptionKey
Definition: transaction.h:96
minRelayTxFee
CFeeRate minRelayTxFee
Fees smaller than this (in duffs) are considered zero fee (for relaying and mining) We are ~100 times...
Definition: main.cpp:100
CTransactionSignature::vin
std::vector< CTxIn > vin
Definition: transaction.h:439
ECDHInfo::Encode
static void Encode(const CKey &mask, const CAmount &amount, const CPubKey &sharedSec, uint256 &encodedMask, uint256 &encodedAmount)
Definition: wallet.cpp:119
COutPoint::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:48
CMutableTransaction::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:405
b
void const uint64_t * b
Definition: field_5x52_asm_impl.h:10
CTxOut::operator!=
friend bool operator!=(const CTxOut &a, const CTxOut &b)
Definition: transaction.h:247
COutPoint::SetNull
void SetNull()
Definition: transaction.h:53
CTxOut::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:187
COutPoint::operator==
friend bool operator==(const COutPoint &a, const COutPoint &b)
Definition: transaction.h:62
CTransaction::S
std::vector< std::vector< uint256 > > S
Definition: transaction.h:301
CTxInShortDigest::nSequence
uint32_t nSequence
Definition: transaction.h:494
CTransaction::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:317
COutPoint::hash
uint256 hash
Definition: transaction.h:39
CMutableTransaction::c
uint256 c
Definition: transaction.h:398
CMutableTransaction::nVersion
int32_t nVersion
Definition: transaction.h:386
CTransactionSignature
Definition: transaction.h:436
uint256.h
CMutableTransaction::nTxFee
CAmount nTxFee
Definition: transaction.h:397
CTransaction::nLockTime
const uint32_t nLockTime
Definition: transaction.h:287
CTransactionSignature::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:469
CTxOut::IsEmpty
bool IsEmpty() const
Definition: transaction.h:220
COutPoint::ToStringShort
std::string ToStringShort() const
Definition: transaction.cpp:26
CTransaction::operator!=
friend bool operator!=(const CTransaction &a, const CTransaction &b)
Definition: transaction.h:376
CTransaction::UpdateHash
void UpdateHash() const
Definition: transaction.cpp:113
CTxOut::IsDust
bool IsDust(CFeeRate minRelayTxFee) const
Definition: transaction.h:227
GetSerializeSize
unsigned int GetSerializeSize(char a, int, int=0)
Definition: serialize.h:194
CTransaction::GetValueOut
CAmount GetValueOut() const
Definition: transaction.cpp:155
CMutableTransaction::txType
uint32_t txType
Definition: transaction.h:394
CScript::clear
void clear()
Definition: script.h:634
MaskValue::hashOfKey
uint256 hashOfKey
Definition: transaction.h:153
MaskValue::sharedSec
CPubKey sharedSec
Definition: transaction.h:148
CFeeRate
Fee rate in PRCY per kilobyte: CAmount / kB.
Definition: amount.h:39
CTxInShortDigest::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:510
COutPoint::IsMasternodeReward
bool IsMasternodeReward(const CTransaction *tx) const
Definition: transaction.cpp:72
CTxInShortDigest::encryptionKey
std::vector< unsigned char > encryptionKey
Definition: transaction.h:496
CTxIn::masternodeStealthAddress
std::vector< unsigned char > masternodeStealthAddress
Definition: transaction.h:99
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:269
CMutableTransaction::bulletproofs
std::vector< unsigned char > bulletproofs
Definition: transaction.h:395
CTransaction::txType
uint32_t txType
Definition: transaction.h:294
MaskValue::mask
uint256 mask
Definition: transaction.h:151
COutPoint::IsNull
bool IsNull() const
Definition: transaction.h:54
CTxInShortDigest
Definition: transaction.h:489
CTxIn::nSequence
uint32_t nSequence
Definition: transaction.h:88
CTxInShortDigest::GetHash
uint256 GetHash()
Definition: transaction.h:522
CTxOut::nValue
CAmount nValue
Definition: transaction.h:167
CTransaction::UsesUTXO
bool UsesUTXO(const COutPoint out)
Definition: transaction.cpp:172
CTxIn::operator!=
friend bool operator!=(const CTxIn &a, const CTxIn &b)
Definition: transaction.h:139
CMutableTransaction::ntxFeeKeyImage
CKeyImage ntxFeeKeyImage
Definition: transaction.h:400
CTransaction::IsCoinBase
bool IsCoinBase() const
Definition: transaction.h:359
CTxOut::IsNull
bool IsNull() const
Definition: transaction.h:209
CMutableTransaction::nLockTime
uint32_t nLockTime
Definition: transaction.h:389
CTransaction::GetOutPoints
std::list< COutPoint > GetOutPoints() const
Definition: transaction.cpp:182
COutPoint::COutPoint
COutPoint(uint256 hashIn, uint32_t nIn)
Definition: transaction.h:43
CTransactionSignature::GetHash
uint256 GetHash()
Definition: transaction.h:484
CTxOut::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:190
CTxOut
An output of a transaction.
Definition: transaction.h:164
CMutableTransaction::paymentID
uint64_t paymentID
Definition: transaction.h:393
CMutableTransaction::hasPaymentID
char hasPaymentID
Definition: transaction.h:392
CTransactionSignature::nVersion
int32_t nVersion
Definition: transaction.h:438
CTxOut::CTxOut
CTxOut()
Definition: transaction.h:180
CTransaction::vout
std::vector< CTxOut > vout
Definition: transaction.h:286
ecdhDecode
void ecdhDecode(uint256 &masked, uint256 &amount, const unsigned char *sharedSec, int size)
CTxOut::scriptPubKey
CScript scriptPubKey
Definition: transaction.h:168
CTxInShortDigest::masternodeStealthAddress
std::vector< unsigned char > masternodeStealthAddress
Definition: transaction.h:498
CTxOut::txPriv
std::vector< unsigned char > txPriv
Definition: transaction.h:172
CTransactionSignature::CTransactionSignature
CTransactionSignature(const CTransaction &tx)
Definition: transaction.h:450
CTransaction::ntxFeeKeyImage
CKeyImage ntxFeeKeyImage
Definition: transaction.h:304
CTxIn::operator==
friend bool operator==(const CTxIn &a, const CTxIn &b)
Definition: transaction.h:129
CTxIn::IsFinal
bool IsFinal() const
Definition: transaction.h:124
CTransactionSignature::vout
std::vector< CTxOut > vout
Definition: transaction.h:440
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
CTxIn::R
std::vector< unsigned char > R
Definition: transaction.h:91
COutPoint::operator!=
friend bool operator!=(const COutPoint &a, const COutPoint &b)
Definition: transaction.h:67
CTransaction::nTxFee
CAmount nTxFee
Definition: transaction.h:298
CTxIn::CTxIn
CTxIn()
Definition: transaction.h:101
SER_DISK
@ SER_DISK
Definition: serialize.h:160
CTransactionSignature::paymentID
uint64_t paymentID
Definition: transaction.h:445
CTxIn::decoys
std::vector< COutPoint > decoys
Definition: transaction.h:98
CTxOut::masternodeStealthAddress
std::vector< unsigned char > masternodeStealthAddress
Definition: transaction.h:177
MaskValue
struct MaskValue MaskValue
COutPoint::COutPoint
COutPoint()
Definition: transaction.h:42
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
CTransaction::CTransaction
CTransaction()
Construct a CTransaction that qualifies as IsNull()
Definition: transaction.cpp:118
MaskValue::amount
uint256 amount
Definition: transaction.h:150
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:363
TX_TYPE_FULL
@ TX_TYPE_FULL
Definition: transaction.h:258
base_uint::IsNull
bool IsNull() const
Definition: arith_uint256.h:312
CMutableTransaction::txPrivM
CKey txPrivM
Definition: transaction.h:391
ECDHInfo
Definition: transaction.h:26
CMutableTransaction::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:408
CTransactionSignature::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:466
ECDHInfo::ComputeSharedSec
static void ComputeSharedSec(const CKey &priv, const CPubKey &pubKey, CPubKey &sharedSec)
Definition: wallet.cpp:109
CTxInShortDigest::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:513
base_uint::SetNull
void SetNull()
Definition: arith_uint256.h:308
CTransaction::CURRENT_VERSION
static const int32_t CURRENT_VERSION
Definition: transaction.h:277
MaskValue::inMemoryRawBind
CKey inMemoryRawBind
Definition: transaction.h:152
prevector
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
Definition: prevector.h:36
CMutableTransaction::vout
std::vector< CTxOut > vout
Definition: transaction.h:388
CTransaction::operator==
friend bool operator==(const CTransaction &a, const CTransaction &b)
Definition: transaction.h:371
key.h
CTxIn::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:109
CPubKey
An encapsulated public key.
Definition: pubkey.h:37
CTransaction::ToString
std::string ToString() const
Definition: transaction.cpp:217
READWRITE
#define READWRITE(obj)
Definition: serialize.h:164
CTransaction::bulletproofs
std::vector< unsigned char > bulletproofs
Definition: transaction.h:296
CKey
An encapsulated private key.
Definition: key.h:39
CTxOut::maskValue
MaskValue maskValue
Definition: transaction.h:176
CTransactionSignature::nLockTime
uint32_t nLockTime
Definition: transaction.h:441
CTxIn::ToString
std::string ToString() const
Definition: transaction.cpp:50
COutPoint::n
uint32_t n
Definition: transaction.h:40
CTransaction::vin
std::vector< CTxIn > vin
Definition: transaction.h:285
CTransaction::txPrivM
CKey txPrivM
Definition: transaction.h:290
CTxIn::s
std::vector< unsigned char > s
Definition: transaction.h:90
CTxOut::operator==
friend bool operator==(const CTxOut &a, const CTxOut &b)
Definition: transaction.h:240
CTxIn::SerializationOp
void SerializationOp(Stream &s, Operation ser_action, int nType, int nVersion)
Definition: transaction.h:112
CMutableTransaction::ToString
std::string ToString() const
Definition: transaction.cpp:98
MaskValue
Definition: transaction.h:147
CTxIn::prevout
COutPoint prevout
Definition: transaction.h:86
CTransaction::paymentID
uint64_t paymentID
Definition: transaction.h:292
CTxInShortDigest::keyImage
CKeyImage keyImage
Definition: transaction.h:497
CTxIn::scriptSig
CScript scriptSig
Definition: transaction.h:87
CTransaction::CalculateModifiedSize
unsigned int CalculateModifiedSize(unsigned int nTxSize=0) const
Definition: transaction.cpp:199
CTxOut::ToString
std::string ToString() const
Definition: transaction.cpp:85
CTransaction::IsNull
bool IsNull() const
Definition: transaction.h:338
serialize.h
CTxIn::prevPubKey
CScript prevPubKey
Definition: transaction.h:89
prevector::empty
bool empty() const
Definition: prevector.h:286
CTxOut::GetHash
uint256 GetHash() const
Definition: transaction.cpp:80
script.h
CTransactionSignature::hasPaymentID
char hasPaymentID
Definition: transaction.h:444
CTxOut::commitment
std::vector< unsigned char > commitment
Definition: transaction.h:178
COutPoint::ToString
std::string ToString() const
Definition: transaction.cpp:21
CTransaction::GetHash
const uint256 & GetHash() const
Definition: transaction.h:342
COutPoint::GetHash
uint256 GetHash()
Definition: transaction.cpp:31
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:36
CTransaction::operator=
CTransaction & operator=(const CTransaction &tx)
Definition: transaction.cpp:124
CMutableTransaction::GetHash
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
Definition: transaction.cpp:93
CTransaction::nVersion
const int32_t nVersion
Definition: transaction.h:284
MaskValue::MaskValue
MaskValue()
Definition: transaction.h:154
CTransaction::hasPaymentID
char hasPaymentID
Definition: transaction.h:291
CMutableTransaction::CMutableTransaction
CMutableTransaction()
Definition: transaction.cpp:90
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:384
CFeeRate::GetFee
CAmount GetFee(size_t size) const
Definition: amount.cpp:20
CTransaction::ComputePriority
double ComputePriority(double dPriorityInputs, unsigned int nTxSize=0) const
Definition: transaction.cpp:191
CTxIn::keyImage
CKeyImage keyImage
Definition: transaction.h:97
CTxInShortDigest::scriptSig
CScript scriptSig
Definition: transaction.h:493
CTxInShortDigest::CTxInShortDigest
CTxInShortDigest(const CTxIn &in)
Definition: transaction.h:500
amount.h
CTransaction::c
uint256 c
Definition: transaction.h:300
CTransactionSignature::nTxFee
CAmount nTxFee
Definition: transaction.h:448
CTxInShortDigest::prevout
COutPoint prevout
Definition: transaction.h:492
CTxOut::SetNull
void SetNull()
Definition: transaction.h:202
COutPoint::ADD_SERIALIZE_METHODS
ADD_SERIALIZE_METHODS
Definition: transaction.h:45
CTransaction::hash
const uint256 hash
Memory only.
Definition: transaction.h:273
CTxOut::SetEmpty
void SetEmpty()
Definition: transaction.h:214
TX_TYPE_REVEAL_AMOUNT
@ TX_TYPE_REVEAL_AMOUNT
Definition: transaction.h:261
CTxOut::txPub
std::vector< unsigned char > txPub
Definition: transaction.h:173
CMutableTransaction::S
std::vector< std::vector< uint256 > > S
Definition: transaction.h:399
ecdhEncode
void ecdhEncode(uint256 &unmasked, uint256 &amount, const unsigned char *sharedSec, int size)
CTxOut::nRounds
int nRounds
Definition: transaction.h:169
ECDHInfo::Decode
static void Decode(unsigned char *encodedMask, unsigned char *encodedAmount, const CPubKey &sharedSec, CKey &decodedMask, CAmount &decodedAmount)
Definition: wallet.cpp:126
CTransaction::IsCoinStake
bool IsCoinStake() const
Definition: transaction.cpp:143