【发布时间】:2018-02-26 00:02:35
【问题描述】:
我正在尝试创建自己的区块链,以了解它们的工作原理。我想知道nonce 应该有多大(例如 8 位或类似的数字)。我在我的区块链中使用PoW(工作证明)算法。该区块链使用SHA256 哈希算法。
我正在使用 C 编程语言来实现这个区块链。
下面是代码块的样子:
struct Block
{
/*Block structure*/
char* hash;
char* prev_hash;
char* from;
char* to;
long long int nonce;
double amount;
time_t timestamp;
};
【问题讨论】:
-
使用
uint64_t nonce;足够大以防止重复。
标签: c blockchain cryptocurrency