lbryio / lbryio/lbry-sdk

Add takeover_estimate to `resolve` response

Open
#1,031 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: jsonrpc level: 2 Tom's Wishlist type: improvement
Dominant language
Python
Stars
7.2k
Forks
493
PR merge metrics
No merged PRs in 30d

Description

## The Issue
To support the app in showing users how long they need to wait for their vanity claim resolution (https://github.com/lbryio/lbry-app/issues/633#issuecomment-345821486), the daemon should return the estimated takeover time with the resolve call.

Keep in mind that effective amount is only valid once the claim is active...so we have the original claim amounts, but no information for supports...but supports will play a large role in the bidding process. So unless we identify and count up supports to show a "pending takeover amount", this can only show the original bid, which doesn't paint the entire story...works for now until https://github.com/lbryio/lbrycrd/issues/203 is solved though.

Grin's old code for takeover time:
```
// the following is based on https://lbry.io/faq/claimtrie-implementation
const lastTakeoverHeight = claimsForName['nLastTakeoverHeight'],
maxDelay = 4032, // 7 days of blocks at 2.5min per block
activationDelay = Math.min(maxDelay, Math.floor((claimBlockHeight - lastTakeoverHeight) / 32)),
takeoverHeight = claimBlockHeight + activationDelay,
secondsPerBlock = 161, // in theory this should be 150, but in practice its closer to 161
takeoverTime = Date.now() + ((takeoverHeight - currentHeight) * secondsPerBlock * 1000);
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the daemon's `resolve` call and trace the claim and takeover-height data used to build its response. Compare the requested estimate with the supplied takeover formula and verify that the response exposes it using the available original claim amount; support handling remains deferred as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, blockchain
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.