# Difficulty accumulator and the next epoch's difficulty

`GET /forwards/accumulator` · Lithos client API · Difficulty Forwards

Source: https://lithosprotocol.org/docs/api/get-df-accumulator

The chain's current epoch and difficulty, the next epoch's difficulty computed from block timestamps, the accumulator's recorded epochs and balance, and the limits an offer must meet right now. Answers on every network; `deployed` is false where no accumulator exists, and then nothing can be offered, filled or settled.

## Responses

### 200: The accumulator and the chain around it

`DFAccumulatorInfo`

- `deployed` (boolean, required): Whether this network has an accumulator. Without one, nothing can be offered, filled or settled.
- `height` (integer · int32, required): The newest block.
- `currentEpoch` (integer · int32, required): The newest block's epoch, `(height - 1) / 128`.
- `blocksLeftInEpoch` (integer · int32, required): Blocks after the newest one before the epoch ends.
- `currentDifficulty` (string, required): The newest block's difficulty, which the whole epoch keeps.
- `nextDifficulty` (DFNextDifficulty): The next epoch's difficulty, computed with Ergo's retarget rule from the last 9 epochs' final block timestamps.
  - `epoch` (integer · int32, required): The epoch it applies to, the one after the current epoch.
  - `difficulty` (string, required)
  - `exact` (boolean, required): True once the current epoch has ended, so this is the value the next blocks carry. Otherwise the current epoch's end is projected at its pace so far, which is close only late in the epoch.
  - `fromHeight` (integer · int32, required): The newest block it was computed from.
  - `change` (number · double, required): Move from the current difficulty, as a fraction.
- `nextDifficultyUnavailable` (string): Why `nextDifficulty` is absent, such as the difficulty table still loading.
- `accumulatorNFT` (string)
- `boxId` (string): The accumulator box, its newest one including unconfirmed spends.
- `lastEpoch` (integer · int32): The newest epoch the accumulator has recorded.
- `balance` (string): LIT base units left to pay 5 LIT for each recorded epoch.
- `recent` (DFEpochDifficulty[], required): The 128 epochs the accumulator holds, oldest first. Empty without an accumulator.
  - `epoch` (integer · int32, required)
  - `difficulty` (string, required)
- `accumulatorUnavailable` (string): Why the accumulator could not be read, when one is deployed.
- `limits` (DFOfferLimits, required): What an offer must satisfy to be created or filled by this client now.
  - `minWindowStart` (integer · int32, required): Earliest window start a fill in the next block accepts, 2 epochs after the current one.
  - `maxWindowStart` (integer · int32, required): Latest, 120 epochs after the current one.
  - `maxWindowLength` (integer · int32, required)
  - `defaultExpiry` (integer · int32, required): The expiry an offer takes when none is given, the last block of the current epoch.
  - `shortWindowEpochs` (integer · int32, required): Windows shorter than this are size-limited (`forwards.offers.shortWindowEpochs`).
  - `shortWindowMaxNotional` (string, required): Largest notional for such a window, in LIT base units (`forwards.offers.shortWindowMaxNotionalLit`).

### 503: Node unavailable. Retry.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### default: Error

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X GET "http://localhost:9000/forwards/accumulator"
```

## Example response

```json
{
  "deployed": true,
  "height": 0,
  "currentEpoch": 0,
  "blocksLeftInEpoch": 0,
  "currentDifficulty": "64267743133696",
  "nextDifficulty": {
    "epoch": 0,
    "difficulty": "63980371640320",
    "exact": true,
    "fromHeight": 0,
    "change": -0.0045
  },
  "nextDifficultyUnavailable": "string",
  "accumulatorNFT": "string",
  "boxId": "string",
  "lastEpoch": 0,
  "balance": "string",
  "recent": [
    {
      "epoch": 0,
      "difficulty": "64267743133696"
    }
  ],
  "accumulatorUnavailable": "string",
  "limits": {
    "minWindowStart": 0,
    "maxWindowStart": 0,
    "maxWindowLength": 120,
    "defaultExpiry": 0,
    "shortWindowEpochs": 8,
    "shortWindowMaxNotional": "1000000000000"
  }
}
```
