OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
cbdc::transaction Namespace Reference

Namespaces

namespace  validation
 

Data Structures

struct  compact_tx
 A condensed, hash-only transaction representation. More...
 
struct  compact_tx_hasher
 
struct  full_tx
 A complete transaction. More...
 
struct  input
 An input for a new transaction. More...
 
struct  out_point
 The unique identifier of a specific output from a transaction. More...
 
struct  output
 An output of a transaction. More...
 
class  wallet
 Cryptographic wallet for digital currency assets and secrets. More...
 

Typedefs

using sentinel_attestation = std::pair<pubkey_t, signature_t>
 Sentinel attestation type.
 

Functions

auto tx_id (const full_tx &tx) noexcept -> hash_t
 Calculates the unique hash of a full transaction.
 
auto input_from_output (const full_tx &tx, size_t i, const hash_t &txid) -> std::optional< input >
 Converts the output at the specified index to an input.
 
auto input_from_output (const full_tx &tx, size_t i) -> std::optional< input >
 Calls input_from_output after calculating the TXID.
 
auto uhs_id_from_output (const hash_t &entropy, uint64_t i, const output &output) -> hash_t
 

Typedef Documentation

◆ sentinel_attestation

Sentinel attestation type.

Public key of the sentinel and signature of a compact transaction hash.

Definition at line 111 of file transaction.hpp.

Function Documentation

◆ input_from_output() [1/2]

auto cbdc::transaction::input_from_output ( const full_tx & tx,
size_t i ) -> std::optional< input >

Calls input_from_output after calculating the TXID.

Parameters
txthe transaction from which to read outputs
iindex of the target output
Returns
result of input_from_output(tx, i, tx_id(tx))

Definition at line 99 of file transaction.cpp.

References input_from_output(), and tx_id().

Here is the call graph for this function:

◆ input_from_output() [2/2]

auto cbdc::transaction::input_from_output ( const full_tx & tx,
size_t i,
const hash_t & txid ) -> std::optional< input >

Converts the output at the specified index to an input.

Parameters
txthe transaction from which to read outputs
iindex of the target output
txidthe txid of the transaction
Returns
resultant input, or std::nullopt if i is invalid.

Definition at line 87 of file transaction.cpp.

References cbdc::transaction::out_point::m_index, cbdc::transaction::input::m_prevout, cbdc::transaction::input::m_prevout_data, and cbdc::transaction::out_point::m_tx_id.

Referenced by cbdc::transaction::wallet::confirm_transaction(), cbdc::transaction::wallet::export_send_inputs(), and input_from_output().

◆ tx_id()

auto cbdc::transaction::tx_id ( const full_tx & tx) -> hash_t
nodiscardnoexcept

Calculates the unique hash of a full transaction.

Returns a cryptographic hash of the inputs concatenated with the outputs (which are first transformed into inputs). Because output owners cannot reuse outputs across different transactions, this method will always generate a unique identifier for valid transactions.

Parameters
txthe full_tx to hash
Returns
the resultant hash of the transaction

Definition at line 72 of file transaction.cpp.

References cbdc::make_buffer().

Referenced by cbdc::transaction::validation::check_p2pk_witness_signature(), cbdc::transaction::compact_tx::compact_tx(), cbdc::transaction::wallet::confirm_transaction(), cbdc::sentinel::controller::execute_transaction(), cbdc::sentinel_2pc::controller::execute_transaction(), input_from_output(), mint_command(), print_tx_result(), cbdc::client::send_transaction(), and cbdc::transaction::wallet::sign().

Here is the call graph for this function:

◆ uhs_id_from_output()

auto cbdc::transaction::uhs_id_from_output ( const hash_t & entropy,
uint64_t i,
const output & output ) -> hash_t

Definition at line 105 of file transaction.cpp.

References cbdc::make_buffer().

Referenced by cbdc::transaction::compact_tx::compact_tx().

Here is the call graph for this function: