Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for a LXR PoW function #72

Open
PaulSnow opened this issue May 5, 2020 · 1 comment
Open

Support for a LXR PoW function #72

PaulSnow opened this issue May 5, 2020 · 1 comment

Comments

@PaulSnow
Copy link
Collaborator

PaulSnow commented May 5, 2020

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.

@WhoSoup
Copy link
Contributor

WhoSoup commented May 10, 2020

To paraphrase, instead of calculating LXRHash(data), you want to calculate LXRPoW(__X__(data)) where __X__ is a hash like SHA256?

This would preempt an attack on LXRHash based on carefully formed data, I presume, since you would not be able to reverse engineer X. Is an attack like that known or is this just expanding the ability of the package?

I like the approach, it's an interesting way to harden LXR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants