Elixium Core v0.6.3 Elixium.Transaction View Source

Contains all the functions that pertain to creating valid transactions

Link to this section Summary

Functions

Each transaction consists of multiple inputs and outputs. Inputs to any particular transaction are just outputs from other transactions. This is called the UTXO model. In order to efficiently represent the UTXOs within the transaction, we can calculate the merkle root of the inputs of the transaction

Takes in a list of maps that match %{addr: addr, amount: amount} and creates a valid transaction

Creates a signature list based on unique addresses in the inputs. One signature is needed for each address

In order for a block to be considered valid, it must have a coinbase as the FIRST transaction in the block. This coinbase has a single output, designated to the address of the miner, and the output amount is the block reward plus any transaction fees from within the transaction

Takes in a transaction received from a peer which may have malicious or extra attributes attached. Removes all extra parameters which are not defined explicitly by the transaction struct

Returns the data that a signer of the transaction needs to sign

Take the correct amount of Utxo’s to send the alloted amount in a transaction

Link to this section Functions

Link to this function calculate_fee(transaction) View Source
calculate_fee(Elixium.Transaction) :: integer()
Link to this function calculate_hash(transaction) View Source
calculate_hash(Elixium.Transaction) :: String.t()

Each transaction consists of multiple inputs and outputs. Inputs to any particular transaction are just outputs from other transactions. This is called the UTXO model. In order to efficiently represent the UTXOs within the transaction, we can calculate the merkle root of the inputs of the transaction.

Link to this function calculate_outputs(transaction, designations) View Source
calculate_outputs(Elixium.Transaction, Map) :: %{
  outputs: list(),
  fee: integer()
}
Link to this function create(designations, fee) View Source
create(list(), integer()) :: Elixium.Transaction

Takes in a list of maps that match %{addr: addr, amount: amount} and creates a valid transaction.

Link to this function create_sig_list(inputs, transaction) View Source
create_sig_list(List, Map) :: List

Creates a signature list based on unique addresses in the inputs. One signature is needed for each address.

Link to this function generate_coinbase(amount, miner_address) View Source
generate_coinbase(integer(), String.t()) :: Elixium.Transaction

In order for a block to be considered valid, it must have a coinbase as the FIRST transaction in the block. This coinbase has a single output, designated to the address of the miner, and the output amount is the block reward plus any transaction fees from within the transaction

Link to this function sanitize(unsanitized_transaction) View Source
sanitize(Elixium.Transaction) :: Elixium.Transaction

Takes in a transaction received from a peer which may have malicious or extra attributes attached. Removes all extra parameters which are not defined explicitly by the transaction struct.

Link to this function signing_digest(map) View Source
signing_digest(Elixium.Transaction) :: binary()

Returns the data that a signer of the transaction needs to sign

Link to this function sum_inputs(inputs) View Source
sum_inputs(list()) :: integer()
Link to this function take_necessary_utxos(utxos, amount) View Source
take_necessary_utxos(List, integer()) :: List | :not_enough_balance

Take the correct amount of Utxo’s to send the alloted amount in a transaction.

Link to this function take_necessary_utxos(arg1, chosen, amount) View Source
take_necessary_utxos(List, List, integer()) :: List | :not_enough_balance