-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTx.h
More file actions
48 lines (39 loc) · 1.24 KB
/
Copy pathTx.h
File metadata and controls
48 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by ryousuke kaga on 2023/12/05.
//
#ifndef BITCOIN_IN_CPP_TX_H
#define BITCOIN_IN_CPP_TX_H
#include <vector>
#include <cstring>
#include <boost/multiprecision/integer.hpp>
struct TxIn {
boost::multiprecision::int1024_t prev_tx;
unsigned long prev_tx_id;
std::vector<unsigned char> script_raw;
unsigned long sequence;
TxIn();
TxIn(boost::multiprecision::int1024_t prev_tx, unsigned long prev_tx_id);
static TxIn parse(unsigned char* bytes, int* bytes_read);
std::vector<unsigned char> serialize();
};
struct TxOut {
boost::multiprecision::int1024_t amount;
std::vector<unsigned char> script_pubkey_raw;
TxOut();
TxOut(boost::multiprecision::int1024_t amount, std::vector<unsigned char> script_raw);
static TxOut parse(unsigned char* bytes, int* bytes_read);
std::vector<unsigned char> serialize();
};
class Tx {
public:
static Tx parse(unsigned char* bytes);
std::vector<unsigned char> serialize();
Tx();
Tx(long version, std::vector<TxIn> inputs, std::vector<TxOut> outputs, unsigned long locktime, bool testnet);
long version;
std::vector<TxIn> inputs;
std::vector<TxOut> outputs;
unsigned long locktime;
bool testnet;
};
#endif //BITCOIN_IN_CPP_TX_H