| | | 1 | | namespace EF.Blockchain.Domain; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents the metadata required to create or mine the next block in the blockchain. |
| | | 5 | | /// </summary> |
| | | 6 | | public class BlockInfo |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Index of the next block to be mined. |
| | | 10 | | /// </summary> |
| | 672 | 11 | | public int Index { get; private set; } |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Hash of the last confirmed block in the chain. |
| | | 15 | | /// </summary> |
| | 992 | 16 | | public string PreviousHash { get; private set; } = string.Empty; |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Current difficulty level for mining. |
| | | 20 | | /// </summary> |
| | 648 | 21 | | public int Difficulty { get; private set; } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Maximum allowed difficulty in the network. |
| | | 25 | | /// </summary> |
| | 344 | 26 | | public int MaxDifficulty { get; private set; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Fee applied per transaction included in the block. |
| | | 30 | | /// </summary> |
| | 648 | 31 | | public int FeePerTx { get; private set; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Transactions selected from the mempool for inclusion in the block. |
| | | 35 | | /// </summary> |
| | 688 | 36 | | public List<Transaction> Transactions { get; private set; } = new(); |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Initializes a new instance of the <see cref="BlockInfo"/> class. |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="index">Index of the block.</param> |
| | | 42 | | /// <param name="previousHash">Hash of the previous block.</param> |
| | | 43 | | /// <param name="difficulty">Current mining difficulty.</param> |
| | | 44 | | /// <param name="maxDifficulty">Maximum difficulty allowed.</param> |
| | | 45 | | /// <param name="feePerTx">Fee per transaction.</param> |
| | | 46 | | /// <param name="transactions">Transactions included in the block.</param> |
| | 336 | 47 | | public BlockInfo(int index, string previousHash, int difficulty, int maxDifficulty, int feePerTx, List<Transaction> |
| | 336 | 48 | | { |
| | 336 | 49 | | Index = index; |
| | 336 | 50 | | PreviousHash = previousHash; |
| | 336 | 51 | | Difficulty = difficulty; |
| | 336 | 52 | | MaxDifficulty = maxDifficulty; |
| | 336 | 53 | | FeePerTx = feePerTx; |
| | 336 | 54 | | Transactions = transactions; |
| | 336 | 55 | | } |
| | | 56 | | } |