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

Work value in RPC work_validate response #1943

Merged

Conversation

@guilhermelawless
Copy link
Contributor

commented Apr 27, 2019

Especially useful now with dynamic PoW.

Needs a documentation update if merged.

@cryptocode
Copy link
Collaborator

left a comment

LGTM. @guilhermelawless Could you attach Wiki markup?

@guilhermelawless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 29, 2019

@cryptocode

Work validate

Check whether work is valid for a block. The response also includes the work value in hexadecimal format, and a multiplier from the base difficulty (not from the optionally given difficulty).

Request:

{  
    "action": "work_validate",  
    "work": "2bf29ef00786a6bc",  
    "hash": "718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2"  
}

Response:

{  
    "valid": "1",
    "value": "ffffffd21c3933f4",
    "multiplier": "1.394647"
}

Optional "difficulty"

version 19.0+
Difficulty value (16 hexadecimal digits string, 64 bit). Uses difficulty value to validate work.

@guilhermelawless guilhermelawless referenced this pull request Apr 29, 2019

Merged

Support difficulty #3

@guilhermelawless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 30, 2019

Idea from arranHarty to also output the value as a multiplier using float((1 << 64) - base_difficulty) / float((1 << 64) - difficulty) , what do you think?

@cryptocode

This comment has been minimized.

Copy link
Collaborator

commented May 1, 2019

A multiplier seems useful (note that the use of 1 << 64 is from Python, which has arbitrary precision integers and 64-bit floats, so the expression won't map directly to C++)

@guilhermelawless

This comment has been minimized.

Copy link
Contributor Author

commented May 2, 2019

Added the multiplier, wiki markup in the previous comment updated.

@guilhermelawless

This comment has been minimized.

Copy link
Contributor Author

commented May 6, 2019

@cryptocode might make more sense for multiplier to be relative to the given difficulty, what do you think?

@cryptocode

This comment has been minimized.

Copy link
Collaborator

commented May 6, 2019

@zhyatt docs added to wiki

@cryptocode cryptocode merged commit f47e858 into nanocurrency:master May 6, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

argakiig added a commit that referenced this pull request May 6, 2019

Work value in RPC work_validate response (#1943)
* Add value output to RPC work_validate

* Cleanup test

* Include a human-readable multiplier from network.publish_threshold in the response.

@zhyatt zhyatt moved this from During RC to RC2 (2019-05-06) in V19 May 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.