EarthBucks Block Header: Independently Adjustable CPU and GPU Mining and Other Parameters

2024-07-22 · Ryan X. Charles

The EarthBucks block header is reminiscent of the block header from Bitcoin, but with significant changes.

Technical Overview

The fields in the first EarthBucks block header are:

  • version: 8-bit value specifying the version of the block header, starting at 0.
  • prev_block_id: 256-bit double blake3 hash of the previous block header.
  • merkle_root: 256-bit double blake3 hash constituting the root of the Merkle tree of transactions in the block.
  • n_transactions: 64-bit value specifying the number of transactions in the block.
  • timestamp: 64-bit value specifying the time of the block in milliseconds since the Unix epoch.
  • block_num: 64-bit value specifying the block number, starting at 0.
  • target: 256-bit unsigned integer specifying the target for the proof-of-work algorithm. The ID of the block must be less than this value.
  • nonce: A 256-bit value that can be adjusted to make the block ID less than the target.
  • work_ser_algo: A 16-bit value specifying a serial proof-of-work algorithm.
  • work_ser_hash: A 256-bit hash of the serial work (CPU).
  • work_par_algo: A 16-bit value specifying a parallel proof-of-work algorithm.
  • work_par_hash: A 256-bit hash of the parallel work (GPU).

CPU and GPU Mining

The very first EarthBucks blog post talked about GPU mining because that is central to the thesis of EarthBucks: Everybody should be able to mine EarthBucks on their consumer device competitively with professionals.

By designing a GPU mining algorithm specifically for consumer devices, I am discouraging the development of custom ASICs (application-specific integrated circuits), which are designed and developed by professionals only. Part of the plan is to constantly adjust the algorithm with time to make sure that the algorithm continues to match consumer hardware. The best mining experience should always be with off-the-shelf (albeit premium) consumer devices.

To best adjust the algorithm regularly and to minimize disruption to the ecosystem every time the algorithm is changed, I have included two new fields in the EarthBucks block header, one for “parallel work” (on a GPU) and one for “serial work” (on a CPU). The purpose of including both parameters is to make each of them independently adjustable. With time, the proof-of-work algorithms can be independently adjusted as needed to match a typical (top-shelf) consumer device.

The fields in the block header for proof-of-work (PoW) are:

  • work_ser_algo: A 16-bit value specifying a serial PoW algorithm (such as repeated hashes).
  • work_ser_hash: A 256-bit hash of the serial work.
  • work_par_algo: A 16-bit value specifying a parallel PoW algorithm (such as matrix multiplication).
  • work_par_hash: A 256-bit hash of the parallel work.

Mining can be incentivized to be performed on a CPU by performing a hash of a hash of a hash and so on, which must be done in serial because each step depends on the previous step. Meanwhile, mining can be incentivized on the GPU by performing a matrix multiplication, which can be done in parallel.

The first CPU algorithm is blake3_3, which means running blake3 on the block header, and then blake3 on that, and then blake3 on that. This is a simple proof-of-concept (PoC) of a CPU-bound PoW algorithm. There isn’t much reason to put this on a GPU, because it is done in serial and does not benefit from the massive parallelization of a GPU.

Meanwhile, the first GPU algorithm is algo1627, which is basically a large integer matrix multiplication of size 1627 based on pseudorandom block header data. It also includes the addition of deterministic floating point operations. It is designed to perform very well on a typical consumer GPU, which can perform all the matrix operations in parallel. In a sense, modern GPUs are already ASICs for this kind of operation, so no one should have a reason to build a custom ASIC for this algorithm.

Because both algorithms are specified in the block header, they can change with time. The idea is that as consumer devices change, we can update both algorithms independently as needed. If it is discovered that anyone is designing an ASIC, we can simply update the algorithms to make any ASICs obsolete.

The Mining Algorithm

The mining algorithm differs from Bitcoin in that extra work is included in every header. The way mining on EarthBucks works is as follows:

  • The serial and parallel hash work fields are initially blank (all zeros) and the nonce is random.
  • Iterate the nonce and calculate the serial hash work and the parallel hash work.
  • Include the hash of the serial work and the hash of the parallel work in the block header.
  • The ID of the block is calculated by hashing the block header. If the ID is less than the target, the block is valid.
  • Repeat until the ID is less than the target.

Bitcoin only has a nonce and has no notion of “serial work” or “parallel work”.

Upgrading the Mining Algorithm

It is intended that the work algorithms can be upgraded with time by putting new algorithms into the block header at a specified block number. For instance, early on, we may choose block number 10,000 to upgrade the serial work algorithm to blake3_4 and the parallel work algorithm to algo1637. This would be done by including the new algorithms in the block header at block number 10,000. The new algorithms would be used for mining starting at block number 10,000. Future algorithms have yet to be decided. They will be intentionally undecided and unannounced until the time comes to upgrade the algorithms.

Other Fields

The remainder of the fields should be self-explanatory to anyone involved in Bitcoin. There are a few differences:

  • The transaction count is included in the header directly. Bitcoin does not include this value. It is my opinion that including this value is useful for non-mining nodes.
  • The timestamp is in milliseconds instead of seconds, which may matter in the future for accurate timestamping. EarthBucks incentivizes accurate timestamps by changing the target continuously and invalidating any block with a future timestamp.
  • The block number is included in the header. It is my opinion that including this value is useful for non-mining nodes.
  • The nonce is 256 bits instead of 32 bits. On Bitcoin, miners have to re-order transactions in a block to get more entropy because the 32-bit nonce is too small. EarthBucks has a 256-bit nonce to avoid this problem.

Conclusion

The EarthBucks block header is designed to change with time to accommodate new CPU and GPU mining algorithms independently to maximize the utility of consumer devices and discourage the development of custom ASICs. The block header also includes a few other fields that are not included in the Bitcoin block header, which I believe are useful for non-mining nodes. The EarthBucks block header is designed to be a flexible and useful data structure for the future of EarthBucks.


Earlier Blog Posts


Back to Blog

Home · About · Blog · Privacy · Terms
X · Telegram · Discord · reddit · GitHub
Copyright © 2024 Ryan X. Charles LLC