---
# System prepended metadata

title: Hash oracle node

---

# Hash oracle node

### Architecture

![](https://hackmd.io/_uploads/HJJ5eK2pn.png)

The node architecture consists of 3 main parts:
 - indexing
 - routing
 - execution

### Indexing

Indexing consists of 2 parts:
 - listener that indexes the blocks one by one
 - event handler that parses the events from the blocks and sends a message to the router


Each chain should have a configurable listener and event handlers and should have a configuration of the:
 - block delay used (wait enough blocks until we are sure the block won't be reverted)
 - starting block from which the indexing begins (the node should use the latest stored block if it exists)
 - RPC url of the chain
 - addresses of the contracts that the event handlers fetch the events from

The listener should have the logic to index the blocks (that are old enough to satisfy the block delay) and call the event handlers configured for that chain with the current block. After all the events are handled, the listener should store the latest block number indexed in a local database so it can continue on restart from the latest indexed block.

The event handlers should be per event they handle (e.g. DepositEventHandler, FraudEventHandler...) and do arbitrary logic needed to handle that event and/or send a message to the destination via the router.

### Routing

Router should be able to receive the messages from the event handlers (or message handlers) and route them to the correct destination message handlers. 

### Execution

Execution handles parsing and handling of the messages received by the router with message handlers. Message handlers should be able to do arbitrary logic on the message they receive (messages should be for the action the node is required to take e.g. fraud dispute message, block header submission message...) and pass to the executor module a `Proposal` if something is needed to be sent on-chain.


Executor module is the transaction subsmission module which parses the `Proposal` and creates and submits the transaction on-chain via the private key specified in the configuration for that chain.