7405b0d4de741345c6e38e95429ad3b400a34213
[NovacoinLibrary.git] / Novacoin / DatabaseInterfaces.cs
1 \feffusing System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 using SQLite.Net;
8 using SQLite.Net.Attributes;
9 using SQLite.Net.Interop;
10 using SQLite.Net.Platform.Generic;
11 using SQLiteNetExtensions.Attributes;
12 using System.Collections.Generic;
13 using System.Diagnostics.Contracts;
14
15 namespace Novacoin
16 {
17     /// <summary>
18     /// Block headers table
19     /// </summary>
20     public interface IBlockStorageItem
21     {
22         /// <summary>
23         /// Item ID in the database
24         /// </summary>
25         long ItemID { get; set; }
26
27         /// <summary>
28         /// PBKDF2+Salsa20 of block hash
29         /// </summary>
30         byte[] Hash { get; set; }
31
32         /// <summary>
33         /// Version of block schema
34         /// </summary>
35         uint nVersion { get; set; }
36
37         /// <summary>
38         /// Previous block hash.
39         /// </summary>
40         byte[] prevHash { get; set; }
41
42         /// <summary>
43         /// Merkle root hash.
44         /// </summary>
45         byte[] merkleRoot { get; set; }
46
47         /// <summary>
48         /// Block timestamp.
49         /// </summary>
50         uint nTime { get; set; }
51
52         /// <summary>
53         /// Compressed difficulty representation.
54         /// </summary>
55         uint nBits { get; set; }
56
57         /// <summary>
58         /// Nonce counter.
59         /// </summary>
60         uint nNonce { get; set; }
61
62         /// <summary>
63         /// Next block hash.
64         /// </summary>
65         byte[] nextHash { get; set; }
66
67         /// <summary>
68         /// Block type flags
69         /// </summary>
70         BlockType BlockTypeFlag { get; set; }
71
72         /// <summary>
73         /// Stake modifier
74         /// </summary>
75         long nStakeModifier { get; set; }
76
77         /// <summary>
78         /// Proof-of-Stake hash
79         /// </summary>
80         byte[] hashProofOfStake { get; set; }
81
82         /// <summary>
83         /// Stake generation outpoint.
84         /// </summary>
85         byte[] prevoutStake { get; set; }
86
87         /// <summary>
88         /// Stake generation time.
89         /// </summary>
90         uint nStakeTime { get; set; }
91
92         /// <summary>
93         /// Block height
94         /// </summary>
95         byte[] Height { get; set; }
96
97         /// <summary>
98         /// Block position in file
99         /// </summary>
100         byte[] BlockPos { get; set; }
101
102         /// <summary>
103         /// Block size in bytes
104         /// </summary>
105         byte[] BlockSize { get; set; }
106     };
107
108     public interface IMerkleNode
109     {
110         /// <summary>
111         /// Node identifier
112         /// </summary>
113         long nMerkleNodeID { get; set; }
114
115         /// <summary>
116         /// Reference to parent block database item.
117         /// </summary>
118         long nParentBlockID { get; set; }
119
120         /// <summary>
121         /// Transaction type flag
122         /// </summary>
123         TxFlags TransactionFlags { get; set; }
124
125         /// <summary>
126         /// Transaction hash
127         /// </summary>
128         byte[] TransactionHash { get; set; }
129
130         /// <summary>
131         /// Transaction offset from the beginning of block header, encoded in VarInt format.
132         /// </summary>
133         byte[] TxOffset { get; set; }
134
135         /// <summary>
136         /// Transaction size, encoded in VarInt format.
137         /// </summary>
138         byte[] TxSize { get; set; }
139     }
140
141     public interface ITxOutItem
142     {
143         /// <summary>
144         /// Reference to transaction item.
145         /// </summary>
146         long nMerkleNodeID { get; set; }
147
148         /// <summary>
149         /// Output flags
150         /// </summary>
151         OutputFlags outputFlags { get; set; }
152
153         /// <summary>
154         /// Output number in VarInt format.
155         /// </summary>
156         byte[] OutputNumber { get; set; }
157
158         /// <summary>
159         /// Output value in VarInt format.
160         /// </summary>
161         byte[] OutputValue { get; set; }
162
163         /// <summary>
164         /// Second half of script which contains spending instructions.
165         /// </summary>
166         byte[] scriptPubKey { get; set; }
167
168         /// <summary>
169         /// Getter for output number.
170         /// </summary>
171         uint nOut { get; }
172
173         /// <summary>
174         /// Getter for output value.
175         /// </summary>
176         ulong nValue { get; }
177
178         /// <summary>
179         /// Getter ans setter for IsSpent flag.
180         /// </summary>
181         bool IsSpent { get; set; }
182     }
183
184 }