# Macha Infrastructure

Macha infrastructure's foundation is built on leveraging data nodes that indexes data from multiple protocols. Macha has built a&#x20;

### **How does it happen?**

<figure><img src="https://191116438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlTDEtUtTk9Q3ped9b8P%2Fuploads%2FsYejhyTYGshyL0WOEcax%2FFlow%20Diagram%20-%20New%20(1).png?alt=media&#x26;token=02c27118-7c33-4d9d-b2d9-d479f7b3d78d" alt=""><figcaption></figcaption></figure>

[From a high level, the process takes place in many steps:](#user-content-fn-1)[^1]

* **Indexing data** - Macha’s indexer nodes fetch the successful transactions of smart contracts that are broadcasted in multiple blockchain networks. Only certain selected transactions of a contract are indexed based on its relevance. The decentralized network of nodes fetches the on-chain data in real time and then makes it available on the platform explorer and for developers via our GraphQL APIs.
* **Abstracting data** - The raw indexed data from the indexer nodes are taken up by Macha’s abstractor nodes and are processed in the nodes to return all of the data points in a unified schema making it searchable for users on our platform and accessible to developers to integrate all of these data using Macha’s SDK.
* **Vectorizing data** - Macha uses machine learning models to generate vector representation of the data indexed as plain text, images, audio, video and content. This technique uses query matching to the nearest neighbour in vector space.
* **Relaying data** - Our P2P Relay Protocol built on top of libp2p to facilitate a peer network state for relaying indexed data b/w participants.&#x20;

## Data Nodes

<figure><img src="https://191116438-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlTDEtUtTk9Q3ped9b8P%2Fuploads%2FMlGdyOGZOcCJEcfmrAyz%2F10-Pitch%20Deck_2023.png?alt=media&#x26;token=e27afa6c-cf9c-4c14-b181-80cb2980b453" alt=""><figcaption></figcaption></figure>

Data nodes in Macha Federated Network query data from blockchains and make it available to Macha participants. Macha Engineering has built this indexing service to make data available from most widely used protocols like LENS, ENS, POAP.&#x20;

At the core of Data Nodes is a rust infrastructure that monitors live and historical transactions on EVM chains. The Macha Nodes abtract callData from txns and add that to data layer.  At Genesis, our program connects with an `Ethereum Node` using an `Alchemy`endpoint. Following this, an ingestion service is run to fetch events that are logged on-chain. This implies that new transactions will be fetched in real-time as soon as they are verified on the blockchain.

Once formatted to a convenient structure, the data is put into a database for easier querying and searching.

## Unified Metadata

Every Meta indexed from decentralized network is formated into a Unified Metadata Format.

```json
// Some code

{
    id: String,
    document: {
        slug: String,
        raw: ,
        modified: ,
    }
    action: {}
}
```

###

[^1]:
