OlinCoin
Test
base_tx.h
1#pragma once
2#include <stdlib.h>
3#include "constants.h"
4#include "mbedtls/ecdsa.h"
5
6typedef struct Output{
7 unsigned long amt;
8 unsigned char public_key_hash[PUB_KEY_HASH_LEN];
9} Output;
10
11typedef struct Input{
12 mbedtls_ecp_point *pub_key;
13 size_t sig_len;
14 unsigned char signature[SIGNATURE_LEN];
15 unsigned char prev_tx_id[TX_HASH_LEN];
16 unsigned int prev_utxo_output;
17} Input;
18
19typedef struct Transaction{
20 unsigned int num_inputs;
21 unsigned int num_outputs;
22 Input *inputs;
23 Output *outputs;
25
26typedef struct UTXO{
27 unsigned long amt;
28 unsigned char public_key_hash[PUB_KEY_HASH_LEN];
29} UTXO;
30
31/* Hashes passed transaction
32 *
33 * dest: Buffer to write hash to, expected to be of size TX_HASH_LEN
34 * tx: Transaction to hash
35 */
36void hash_tx(unsigned char *dest, Transaction *tx);
37
43void free_tx(Transaction *tx);
44
53Transaction *copy_tx(Transaction *tx);
54
55void print_input(Input *input, char *prefix);
56void print_output(Output *output, char *prefix);
57void print_tx(Transaction *tx, char *prefix);
58
59void pretty_print_tx(Transaction *tx, char *prefix);
Definition: base_tx.h:11
Definition: base_tx.h:6
Definition: base_tx.h:19
Definition: base_tx.h:26