forked from cryptonotefoundation/cryptonote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCryptoNote.h
90 lines (70 loc) · 1.85 KB
/
CryptoNote.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (c) 2011-2015 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include <vector>
#include <boost/variant.hpp>
#include "CryptoTypes.h"
namespace CryptoNote {
struct BaseInput {
uint32_t blockIndex;
};
struct KeyInput {
uint64_t amount;
std::vector<uint32_t> outputIndexes;
Crypto::KeyImage keyImage;
};
struct MultisignatureInput {
uint64_t amount;
uint8_t signatureCount;
uint32_t outputIndex;
};
struct KeyOutput {
Crypto::PublicKey key;
};
struct MultisignatureOutput {
std::vector<Crypto::PublicKey> keys;
uint8_t requiredSignatureCount;
};
typedef boost::variant<BaseInput, KeyInput, MultisignatureInput> TransactionInput;
typedef boost::variant<KeyOutput, MultisignatureOutput> TransactionOutputTarget;
struct TransactionOutput {
uint64_t amount;
TransactionOutputTarget target;
};
struct TransactionPrefix {
uint8_t version;
uint64_t unlockTime;
std::vector<TransactionInput> inputs;
std::vector<TransactionOutput> outputs;
std::vector<uint8_t> extra;
};
struct Transaction : public TransactionPrefix {
std::vector<std::vector<Crypto::Signature>> signatures;
};
struct BlockHeader {
uint8_t majorVersion;
uint8_t minorVersion;
uint32_t nonce;
uint64_t timestamp;
Crypto::Hash previousBlockHash;
};
struct Block : public BlockHeader {
Transaction baseTransaction;
std::vector<Crypto::Hash> transactionHashes;
};
struct AccountPublicAddress {
Crypto::PublicKey spendPublicKey;
Crypto::PublicKey viewPublicKey;
};
struct AccountKeys {
AccountPublicAddress address;
Crypto::SecretKey spendSecretKey;
Crypto::SecretKey viewSecretKey;
};
struct KeyPair {
Crypto::PublicKey publicKey;
Crypto::SecretKey secretKey;
};
using BinaryArray = std::vector<uint8_t>;
}