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

Use the `claim` API #2

Closed
pipermerriam opened this Issue Dec 24, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@pipermerriam
Owner

pipermerriam commented Dec 24, 2015

This script should use the claim API to guarantee the exclusive right to call. This logic should probably do some semi-intelligent calculation using the call's basePayment and the expected gas expenditure to decide when to claim the call. First implementation should probably just claim the call as soon as it enters the last 15 blocks of the claim window.

@whatisgravity

This comment has been minimized.

Show comment
Hide comment
@whatisgravity

whatisgravity Jan 17, 2016

Does this make the client unusable? Could you potentially do work without being compensated if you are unable to claim?

whatisgravity commented Jan 17, 2016

Does this make the client unusable? Could you potentially do work without being compensated if you are unable to claim?

@pipermerriam

This comment has been minimized.

Show comment
Hide comment
@pipermerriam

pipermerriam Jan 17, 2016

Owner

This is actually already implemented in the client.

It waits to claim until either the payment from the call is sufficient to cover the cost of the claiming transaction or the last 15 blocks in the claim window. Then on each block it does a random roll to decide whether it should claim the call.

  • Let the first block in the claim window be 0
  • Let the last block in the claim window be 255
  • Let N be the index of the current block within this 0-255 claim window.
  • Roll a random number between [0, 255]
  • Claim if the number is less than N.

This is just a simple way to use probability to try and ensure that multiple clients aren't competing for the same calls.

Owner

pipermerriam commented Jan 17, 2016

This is actually already implemented in the client.

It waits to claim until either the payment from the call is sufficient to cover the cost of the claiming transaction or the last 15 blocks in the claim window. Then on each block it does a random roll to decide whether it should claim the call.

  • Let the first block in the claim window be 0
  • Let the last block in the claim window be 255
  • Let N be the index of the current block within this 0-255 claim window.
  • Roll a random number between [0, 255]
  • Claim if the number is less than N.

This is just a simple way to use probability to try and ensure that multiple clients aren't competing for the same calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment