> For the complete documentation index, see [llms.txt](https://docs.energyweb.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/worker-nodes/worker-node-network-architecture.md).

# Worker Node Process Diagrams

## Reaching Consensus

{% @mermaid/diagram content="sequenceDiagram
participant A as External event data
participant B as DDHub
participant G as Client GW (DDHub)
participant C as Worker Node 1
participant D as Worker Node ...n
Participant E as Voting Contract
Participant H as Event Listener Node
Participant F as Energy Web Chain
Note over G: Every x minutes
G->>A: Receives data and encrypts
G->>B: Pushes encrypted data
C->>B: Authenticates using DID
D->>B: Authenticates using DID
C->>B: Fetches encrypted input data
D->>B: Fetches encrypted input data
C->>C: Decrypts data using DID
D->>D: Decrypts data using DID
C->>C: Executes business logic & derives root hash
D->>D: Executes business logic & derives root hash
C->>E: Submits merkle tree root hash result
D->>E: Submits merkle tree root hash result
E->>E: Reaches consensus
E->>F: Notarize root hash on-chain
H->>F: Listens for Events
H->>B: Passes notarized root hash" %}

## Voting Manager

{% @mermaid/diagram content="sequenceDiagram
participant VotingManager
participant Worker
participant Overseer
participant VotingContract
participant Data Storage

VotingManager ->> VotingContract: add workers
loop Business Logic
Worker->>Data Storage: get input data
Data Storage-->>Worker:

Worker->>Worker: Logic Execution

Worker->>VotingContract: send vote
end

loop VotingResults
Overseer->>VotingContract: get Result events
VotingContract-->>Overseer:
Overseer->>Data Storage: save voting results
end" %}

## Caching Results

{% @mermaid/diagram content="sequenceDiagram
participant A as DDHub
participant G as Worker Node
Participant E as Cache
Participant D as Energy Web Chain
Participant F as Reporting Backend
E->>D: Listens for Events
D->>E: Passes notarized root hash
G->>G: Encrypts result data with root hash subject
G->>A: Sends encrypted result data
E->>A: Authenticates using DID/key
E->>A: Fetches encrypted result data
E->>E: Decrypts result data using DID
F->>E: Fetches decrypted result data" %}


---

# 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.energyweb.org/legacy-documentation/ew-dos-technology-components-2023/worker-nodes/worker-node-network-architecture.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.
