> For the complete documentation index, see [llms.txt](https://docs.zetrix.com/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zetrix.com/en/architecture/consensus-mechanism/dpos/heartbeat-accumulation-reward-eligibility-flow.md).

# Heartbeat Accumulation → Reward Eligibility Flow

The following diagram shows how heartbeat signals become reward eligibility input.

```mermaid
flowchart LR
    subgraph SG_NODE["Zetrix Node (Monitor Connection)"]
        PING["Node sends WebSocket PING every ~15s"]
        SYS["Node responds with system status<br/>(cpu · memory · disk)"]
    end

    subgraph SG_DC["BaaS Data Center"]
        PONG["Receive PING<br/>Every 3 PINGs (~45s)<br/>Request system status"]
        RCV["Parse system status response"]
        HBCNT["Increment heartbeat counter in cache<br/>key = validator address"]
    end

    subgraph SG_HR["Every 1 Hour"]
        STAT["ValidatorsHeartStatisticJob"]
        FILTER{"Count >= 47?"}
        ONLINE["Add to onlineList"]
        SKIP["Exclude from onlineList"]
        PUSH["Call pushStatus(onlineList, onlineTimestamp)<br/>on Heartbeat Contract<br/>via operator key"]
        DBINS["Insert heartbeat statistic record"]
        RESET["Reset cache counters"]
    end

    subgraph SG_HB["Heartbeat Contract"]
        HB_STORE["Stores per-timestamp validator sets<br/>Each hourly push appended to contract storage"]
    end

    subgraph SG_DAY["Daily 18:00"]
        EXTRACT["DPOS extract()<br/>getNodeList(rate = 80%)<br/>Keep validators in >= 80% of hourly slots<br/>clearRecord() wipes all records<br/>calculate() distributes reward"]
        TRANSFER["DPOS extractTransfer()<br/>Transfer rewards to fund addresses"]
    end

    PING --> PONG --> SYS --> RCV --> HBCNT
    HBCNT --> STAT
    STAT --> FILTER
    FILTER -->|Yes| ONLINE --> PUSH
    FILTER -->|No| SKIP
    PUSH --> HB_STORE
    PUSH --> DBINS --> RESET
    HB_STORE -.->|"daily contractQuery"| EXTRACT
    EXTRACT --> TRANSFER
```

#### Eligibility model explained

Eligibility is determined in two stages.

**Stage 1: hourly inclusion**

A validator must accumulate at least 47 heartbeat hits within the hour to appear in that hour's online list.

**Stage 2: cross-hour qualification**

During extract(), the Heartbeat contract checks how often each validator appeared across the stored hourly snapshots. A validator must appear in at least 80% of those slots to qualify for daily reward.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zetrix.com/en/architecture/consensus-mechanism/dpos/heartbeat-accumulation-reward-eligibility-flow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
