BigInts, save/load, will make a calculation for block rewards soon
This commit is contained in:
@@ -10,13 +10,14 @@
|
||||
#include <randomx/librx_wrapper.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t version;
|
||||
uint32_t blockNumber;
|
||||
uint64_t blockNumber;
|
||||
uint64_t timestamp;
|
||||
uint64_t nonce;
|
||||
uint8_t prevHash[32];
|
||||
uint8_t merkleRoot[32];
|
||||
uint64_t timestamp;
|
||||
uint32_t difficultyTarget; // Encoding: [1 byte exponent][3 byte coefficient]; Target = coefficient * 256^(exponent-3)
|
||||
uint64_t nonce; // Higher nonce for RandomX
|
||||
uint8_t version;
|
||||
uint8_t reserved[3]; // 3 bytes (Explicit padding for 8-byte alignment)
|
||||
} block_header_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include <block/block.h>
|
||||
#include <dynarr.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
DynArr* blocks;
|
||||
@@ -16,5 +19,10 @@ bool Chain_AddBlock(blockchain_t* chain, block_t* block);
|
||||
block_t* Chain_GetBlock(blockchain_t* chain, size_t index);
|
||||
size_t Chain_Size(blockchain_t* chain);
|
||||
bool Chain_IsValid(blockchain_t* chain);
|
||||
void Chain_Wipe(blockchain_t* chain);
|
||||
|
||||
// I/O
|
||||
bool Chain_SaveToFile(blockchain_t* chain, const char* dirpath);
|
||||
bool Chain_LoadFromFile(blockchain_t* chain, const char* dirpath);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user