> ## Documentation Index
> Fetch the complete documentation index at: https://www.diadata.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Spectra (Cross-chain Messaging Layer)

DIA Lumina achieves full interoperability, delivering oracle data to any blockchain with minimal friction through the Spectra protocol, a message passing layer powering both the push and pull oracle models.

## **Data Delivery Methods**

Spectra is an interchain message passing protocol formed by a network of nodes, running a custom instance of Hyperlane, an open interoperability framework. It facilitates secure and rapid transmission of oracle data to any blockchain, without the need for chain-specific integrations.

The Spectra validators observe messages on the mailboxes of the destination and origin chains. The messages are then checked through the ISM (Interchain Security Module) and delivered to these components:

* RequestOracle (Pull oracle)

* PushOracleReceiver (Push oracle)

The gas for processing messages are funded by imposing a fee for calling `request()` on *RequestOracle*, or `handle()` on the *PushOracleReceiver* contracts. The fees are transferred to the ProtocolFeeHook – an instance of Hyperlane's [Post-Dispatch](https://docs.hyperlane.xyz/docs/protocol/core/post-dispatch-hooks-overview#post-dispatch-hooks-overview) hooks - that are then withdrawn manually to the Spectra gas wallet.

Let's explore how Spectra contributes to the flow of messages in the Push and Pull oracle models and how that translates to the data you receive on the destination chain.

### Pull Model

<Frame>
  <img src="https://mintcdn.com/diadata/qIgjiltsbRJuXYkF/images/reference/architecture/image-3.png?fit=max&auto=format&n=qIgjiltsbRJuXYkF&q=85&s=9a2c4e4f4dd3787d44f40804f3b0ac65" width="2304" height="1051" data-path="images/reference/architecture/image-3.png" />
</Frame>

* User initiates a request to the RequestOracle contract and pays a fee.

* RequestOracle processes the request on the origin chain (e.g. Ethereum), creates a message containing the request details (destination chain id, OracleRequestRecipient address, exchange pair, ...etc), then dispatches it through the Mailbox.

* The validators observes the mailbox and picks up the request. once it verifies its validity through the ISM and signs it, the relayer carries out the message delivery to the mailbox of the destination chain (DIA lasernet).

* OracleRequestRecipient receives and validates the message through the ISM, and passes it forward to OracleTrigger that fetches the values from the [Aggregator](/dia-stack/architecture/core-components/lasernet/overview#aggregator) or meta-contract. It then creates a message with the latest price, and dispatches it back to Lasernet's mailbox.

* Message is picked up by Spectra protocol and sent back to the RequestOracle which then checks for data freshness and adds the value to the `updates`mapping.

### Push Model

<Frame>
  <img src="https://mintcdn.com/diadata/qIgjiltsbRJuXYkF/images/reference/architecture/image-4.png?fit=max&auto=format&n=qIgjiltsbRJuXYkF&q=85&s=6cce7c79663e86f38a4fde04828566d1" width="2304" height="1051" data-path="images/reference/architecture/image-4.png" />
</Frame>

* Go feeder service initiates a price update based on certain parameters (such as deviation, heartbeat, & refresh frequency) on the origin chain (DIA's lasernet).

* OracleTrigger processes the update request, reads the latest price from the meta-contract, creates a message, & dispatches it through the Mailbox.

* The validators observes the mailbox and picks up the update request. once it verifies its validity through the ISM and signs it, the relayer carries out the message delivery to the mailbox of the destination chain.

* PushOracleReceiver receives the update, validates the message through the ISM, checks for the data freshness, the adds the value to the `updates`mapping.

### Fees

Cost of updating data on the destination chain is calculated as follows:

```bash theme={"system"}
uint256 gasUsedPerTx = 97440; // Fixed gas amount
uint256 gasPrice = tx.gasprice; // Current network gas price
uint256 cost = gasUsedPerTx * gasPrice; // Total fee
```

## Key Benefits:

<CardGroup>
  <Card title="Deploy Anywhere, Fast" icon="square-check" iconType="solid">
    Cross-chain data delivery is made simple through Spectra, dramatically
    reducing time to market for developers, and allowing data to be transmitted
    across blockchains with minimal friction and no chain-specific setup.
  </Card>
</CardGroup>
