Skip to content

Support for a LXR PoW function #72

@PaulSnow

Description

@PaulSnow

The goal here is to be able to use any cryptographic hash for a blockchain, but only replace how PoW is measured.

In traditional blockchains, PoW is generally calculated by taking the leading bits of the hash and considering the smaller integer value of those bits as being a higher difficulty. PegNet considers the higher integer value of those bits as being a higher difficulty, but this isn't too different.

By adding two functions, LxrPoW() and PoW(), the LXRHash can be used with any Hash function to do a more complex PoW calculation that makes PoW most reasonable for CPU mining.

LxrPoW() makes computation of PoW CPU hard
PoW() takes a hash of a higher integer value can compresses it to a uniform 8 bytes.

The compression of PoW() first counts how many of the leading bytes have a value of 0xFF. If the difficulty is defined where the leading bit is 0 and the last bit is 63, then:

Bits 0-3 is the count of leading 0xFF
Bits 4-63 are the following bits of the hash

This allows Difficulty to be represented by 60 to 180 bits of a hash in 64 bits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions