Anoncoin  0.9.4
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
libzerocoin::CoinSpend Class Reference

The complete proof needed to spend a zerocoin. More...

#include <CoinSpend.h>

Collaboration diagram for libzerocoin::CoinSpend:
[legend]

Public Member Functions

template<typename Stream >
 CoinSpend (const Params *p, Stream &strm)
 
 CoinSpend (const Params *p, const PrivateCoin &coin, Accumulator &a, const AccumulatorWitness &witness, const SpendMetaData &m)
 Generates a proof spending a zerocoin. More...
 
Bignum getCoinSerialNumber () const
 Returns the serial number of the coin spend by this proof. More...
 
CoinDenomination getDenomination () const
 Gets the denomination of the coin spent in this proof. More...
 
bool Verify (const Accumulator &a, const SpendMetaData &metaData) const
 

Public Attributes

CoinDenomination denomination
 
Bignum accCommitmentToCoinValue
 
Bignum serialCommitmentToCoinValue
 
Bignum coinSerialNumber
 
AccumulatorProofOfKnowledge accumulatorPoK
 
SerialNumberSignatureOfKnowledge serialNumberSoK
 
CommitmentProofOfKnowledge commitmentPoK
 

Detailed Description

The complete proof needed to spend a zerocoin.

Composes together a proof that a coin is accumulated and that it has a given serial number.

Definition at line 32 of file CoinSpend.h.

Constructor & Destructor Documentation

template<typename Stream >
libzerocoin::CoinSpend::CoinSpend ( const Params p,
Stream &  strm 
)
inline

Definition at line 35 of file CoinSpend.h.

libzerocoin::CoinSpend::CoinSpend ( const Params p,
const PrivateCoin coin,
Accumulator a,
const AccumulatorWitness witness,
const SpendMetaData m 
)

Generates a proof spending a zerocoin.

To use this, provide an unspent PrivateCoin, the latest Accumulator (e.g from the most recent Anoncoin block) containing the public part of the coin, a witness to that, and the transaction hash.

Once constructed, this proof can be serialized and sent. It is validated simply by calling validate.

Warning
Validation only checks that the proof is correct
for the specified values in this class. These values must be validated Clients ought to check that 1) params is the right params 2) the accumulator actually is in some block 3) that the serial number is unspent 4) that the transaction outputs sum to at most the sum of the inputs
Parameters
pcryptographic parameters
coinThe coin to be spend
aThe current accumulator containing the coin
witnessThe witness showing that the accumulator contains the coin
mthe transaction hash as described in docs/zerocoin.md; this is "signed" by the ZC spend (specifically the snSoK).
Exceptions
ZerocoinExceptionif the process fails

Definition at line 18 of file CoinSpend.cpp.

Here is the call graph for this function:

Member Function Documentation

Bignum libzerocoin::CoinSpend::getCoinSerialNumber ( ) const

Returns the serial number of the coin spend by this proof.

Returns
the coin's serial number

Definition at line 62 of file CoinSpend.cpp.

Here is the caller graph for this function:

CoinDenomination libzerocoin::CoinSpend::getDenomination ( ) const

Gets the denomination of the coin spent in this proof.

Returns
the denomination

Definition at line 67 of file CoinSpend.cpp.

bool libzerocoin::CoinSpend::Verify ( const Accumulator a,
const SpendMetaData metaData 
) const

Definition at line 72 of file CoinSpend.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Bignum libzerocoin::CoinSpend::accCommitmentToCoinValue

Definition at line 96 of file CoinSpend.h.

AccumulatorProofOfKnowledge libzerocoin::CoinSpend::accumulatorPoK

Definition at line 99 of file CoinSpend.h.

Bignum libzerocoin::CoinSpend::coinSerialNumber

Definition at line 98 of file CoinSpend.h.

CommitmentProofOfKnowledge libzerocoin::CoinSpend::commitmentPoK

Definition at line 101 of file CoinSpend.h.

CoinDenomination libzerocoin::CoinSpend::denomination

Definition at line 95 of file CoinSpend.h.

Bignum libzerocoin::CoinSpend::serialCommitmentToCoinValue

Definition at line 97 of file CoinSpend.h.

SerialNumberSignatureOfKnowledge libzerocoin::CoinSpend::serialNumberSoK

Definition at line 100 of file CoinSpend.h.


The documentation for this class was generated from the following files: