IOTA Common Libraries¶
The common libraries are including Crypto, Helpers, Models, and Trinary components.
Crypto¶
TODO
Helpers¶
TODO
Models¶
Unnamed Group
-
MAX_IOTA_SUPPLY¶
-
BUNDLE_FOREACH(txs, tx)¶ The bundle iterator.
-
bundle_status_e¶ bundle validation status.
Values:
-
0¶
-
BUNDLE_VALID¶
-
BUNDLE_EMPTY¶
-
BUNDLE_INCOMPLETE¶
-
BUNDLE_INVALID_TX¶
-
BUNDLE_INVALID_INPUT_ADDRESS¶
-
BUNDLE_INVALID_VALUE¶
-
BUNDLE_INVALID_HASH¶
-
BUNDLE_INVALID_SIGNATURE¶
-
-
typedef enum bundle_status_e
bundle_status_t¶ bundle validation status.
-
typedef UT_array
bundle_transactions_t¶
-
typedef UT_array
bundle_hashes_t¶
-
void
bundle_transactions_new(bundle_transactions_t **const bundle)¶ Allocates a bundle object.
- Parameters
[in] bundle: A bundle object.
-
void
bundle_transactions_free(bundle_transactions_t **const bundle)¶ Frees a bundle object.
- Parameters
[in] bundle: A bundle object.
-
void
bundle_transactions_add(bundle_transactions_t *const bundle, iota_transaction_t const *const transaction)¶ Adds a transaction to the bundle.
- Parameters
[in] bundle: The bundle object.[in] transaction: A transaction object.
-
iota_transaction_t*
bundle_at(bundle_transactions_t *const bundle, size_t index)¶ Gets a transaction from the bundle by index.
- Return
- #iota_transaction_t
- Parameters
[in] bundle: The bundle object.[in] index: The index of a transaction.
-
static size_t
bundle_transactions_size(bundle_transactions_t const *const bundle)¶ Gets the number of transactions in the bundle.
- Return
- An number of transactions.
- Parameters
[in] bundle: The bundle object.
-
static flex_trit_t const*
bundle_transactions_bundle_hash(bundle_transactions_t const *const bundle)¶ Get bundle hash from a bundle transaction object.
- Return
- The bundle hash
- Parameters
[in] bundle: The bundle transaction object
-
void
bundle_calculate_hash(bundle_transactions_t * bundle, Kerl *const kerl, flex_trit_t * out)¶ Calculates bundle hash using Kerl.
- Parameters
[in] bundle: A bundle object.[in] kerl: A Kerl object.[out] out: The bundle hash.
-
void
bundle_finalize(bundle_transactions_t * bundle, Kerl *const kerl)¶ Finalizes a bundle by calculating the bundle hash.
- Parameters
[in] bundle: A bundle object.[in] kerl: A Kerl object.
-
retcode_t
bundle_validate(bundle_transactions_t *const bundle, bundle_status_t *const status)¶ Validates a bundle.
- Return
- retcode_t
- Parameters
[in] bundle: A bundle object.[out] status: The status of the bundle.
-
void
bundle_reset_indexes(bundle_transactions_t *const bundle)¶ Re-calculates the current and last index of the bundle.
- Parameters
[in] bundle: A bundle object.
-
void
bundle_set_messages(bundle_transactions_t * bundle, signature_fragments_t * messages)¶ Sets bundle message.
- Parameters
[in] bundle: A bundle object.[in] messages: A message for the bundle.
-
retcode_t
bundle_sign(bundle_transactions_t *const bundle, flex_trit_t const *const seed, inputs_t const *const inputs, Kerl *const kerl)¶ Adds signature to transactions in a bundle.
- Return
- retcode_t
- Parameters
[in] bundle: A bundle object.[in] seed: The seed of inputs.[in] inputs: The inputs for the bundle.[in] kerl: A Kerl object.
Unnamed Group
-
INPUTS_FOREACH(inputs, elm)¶ loop over an input list
-
typedef UT_array
input_array_t¶
-
UT_icd const input_array_icd = {sizeof(input_t), NULL, NULL, NULL}
-
static retcode_t
inputs_append(inputs_t * inputs, input_t * input)¶ append an input object to the input list
- Return
- retcode_t
- Parameters
inputs: the input listinput: an input object for appending
-
static int64_t
inputs_balance(inputs_t * inputs)¶ total balance in this input list
- Return
- int64_t
- Parameters
inputs:
-
struct
input_t¶ - #include <inputs.h>
input object
-
struct
inputs_t¶ - #include <inputs.h>
a list of input object
Trinary¶
-
typedef int8_t
flex_trit_t¶
-
static trit_t
flex_trits_at(flex_trit_t const *const flex_trits, size_t const len, size_t index)¶ Returns the trit at a given index in an array of flex_trits
- Return
- trit_t - the trit at the given index
- Parameters
[in] flex_trits: - an array of flex_trits[in] len: - the number of trits encoded in the flex_trit array[in] index: - the index of the trit to access
-
static uint8_t
flex_trits_set_at(flex_trit_t *const flex_trits, size_t const len, size_t index, trit_t trit)¶ Set the trit at a given index in an array of trits to the given value
- Parameters
[in] flex_trits: - an array of flex_trits[in] len: - the number of trits encoded in the flex_trit array[in] index: - the index of the trit to access[in] trit: - the trit value to set
-
static bool
flex_trits_are_null(flex_trit_t const *const flex_trits, size_t const len)¶
-
size_t
flex_trits_slice(flex_trit_t *const to_flex_trits, size_t const to_len, flex_trit_t const *const flex_trits, size_t const len, size_t const start, size_t const num_trits)¶ Returns a portion of length num_trits of an array into a new array from start. The original array will not be modified.
- Return
- size_t - the number of trits extracted
- Parameters
[in] to_flex_trits: - the array that will contain the slice[in] to_len: - the number of trits encoded in the to_flex_trits array[in] flex_trits: - the original array[in] len: - the number of trits the flex_trits array stores[in] start: - the start index in the original array[in] num_trits: - the number of trits to extract
-
size_t
flex_trits_insert(flex_trit_t *const to_flex_trits, size_t const to_len, flex_trit_t const *const flex_trits, size_t const len, size_t const start, size_t const num_trits)¶ Inserts the contents of an array into another array starting at a given index.
- Return
- size_t - the number of trits copied over
- Parameters
[in] to_flex_trits: - the array to insert into[in] to_len: - the number of trits encoded in the to_flex_trits array[in] flex_trits: - the array containing the trits to copy over[in] len: - the number of trits the flex_trits array stores[in] start: - the start index in the destination array[in] num_trits: - the number of trits to copy over
-
size_t
flex_trits_to_trits(trit_t *const trits, size_t const to_len, flex_trit_t const *const flex_trits, size_t const len, size_t const num_trits)¶ Returns an array of trits regardless of the current memory storage scheme
- Return
- size_t - the number of trits encoded
- Parameters
[in] trits: - an array of individual trits[in] to_len: - the number of trits the trits array contains[in] flex_trits: - the array of packed trits[in] len: - the number of trits the flex_trits array stores[in] num_trits: - the number of trits to extract
-
size_t
flex_trits_from_trits(flex_trit_t *const to_flex_trits, size_t const to_len, trit_t const *const trits, size_t const len, size_t const num_trits)¶ Returns an array of trits packed in the current memory storage scheme
- Return
- size_t - the number of trits decoded
- Parameters
[in] to_flex_trits: - an array of flex_trits[in] to_len: - the number of trits encoded in the to_flex_trits array[in] trits: - an array of individual trits[in] len: - the number of trits the trits array contains[in] num_trits: - the number of trits to pack
-
size_t
flex_trits_from_trytes(flex_trit_t * to_flex_trits, size_t to_len, const tryte_t * trytes, size_t len, size_t num_trytes)¶ Returns an array of flex_trits.
- Return
- size_t - the number of trytes decoded
- Parameters
[in] to_flex_trits: - the array of packed trits[in] to_len: - the number of trits in the to_flex_trits array[in] trytes: - an array of trytes[in] len: - the number of trytes in the trytes array[in] num_trytes: - the size of trytes to unpack
-
size_t
flex_trits_to_bytes(byte_t * bytes, size_t to_len, const flex_trit_t * flex_trits, size_t len, size_t num_trits)¶ Returns an array of bytes.
- Return
- size_t - the number of trits encoded
- Parameters
[in] bytes: - an array to store bytes[in] to_len: - the number of trits the bytes array contains[in] flex_trits: - the array of packed trits[in] len: - the number of trits the flex_trits array contains[in] num_trits: - the number of trits to pack
-
size_t
flex_trits_from_bytes(flex_trit_t * to_flex_trits, size_t to_len, const byte_t * bytes, size_t len, size_t num_trits)¶ Returns an array of flex_trits.
- Return
- size_t - the number of trits decoded
- Parameters
[in] to_flex_trits: - the array of packed trits[in] to_len: - the number of trits in the to_flex_trits array[in] bytes: - an array of bytes[in] len: - the number of trits in the bytes array[in] num_trits: - the number of trits to unpack
-
void
flex_trit_print(flex_trit_t const * trits, size_t trits_len)¶ Print flex trits through stdout.
- Parameters
trits: A pointer to flex tritstrits_len: Number of trit