[#Coin-04]
= Coin
:mrdocs:

A UTXO entry&period;

== Synopsis

Declared in `&lt;coins&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Coin;
----

== Description

Serialized format&colon;

* VARINT((height &lt;&lt; 1) &verbar; (coinbase ? 1 &colon; 0))
* the non&hyphen;spent CTxOut (via TxOutCompression)

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:Coin-04/2constructor-03.adoc[`Coin`]         [.small]#[constructor]#
| Constructors
| xref:Coin-04/Clear.adoc[`Clear`] 
| Reset the coin to the null, spent state&period;
| xref:Coin-04/DynamicMemoryUsage.adoc[`DynamicMemoryUsage`] 
| Report the heap memory used by this coin beyond its own size&period;
| xref:Coin-04/IsCoinBase.adoc[`IsCoinBase`] 
| Report whether the containing transaction was a coinbase&period;
| xref:Coin-04/IsSpent.adoc[`IsSpent`] 
| Either this coin never existed (see e&period;g&period; coinEmpty in coins&period;cpp), or it did exist and has been spent&period;
| xref:Coin-04/Serialize.adoc[`Serialize`] 
| Serialize the coin to the given stream&period;
| xref:Coin-04/Unserialize.adoc[`Unserialize`] 
| Read the coin from the given stream&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:Coin-04/fCoinBase.adoc[`fCoinBase`] 
| whether containing transaction was a coinbase
| xref:Coin-04/nHeight.adoc[`nHeight`] 
| at which height this containing transaction was included in the active block chain
| xref:Coin-04/out.adoc[`out`] 
| unspent transaction output
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:AccessByTxid.adoc[`AccessByTxid`]
| Utility function to find any unspent output with a given txid&period; This function can be quite expensive because in the event of a transaction which is not found in the cache, it can cause up to MAX&lowbar;OUTPUTS&lowbar;PER&lowbar;BLOCK lookups to database, so it should be used with care&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
