Files
papers/lux-gchain-graphql/sections/05-horizontal-scaling-architecture.tex
zeekay 4a753bb639 papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

75 lines
1.9 KiB
TeX

\section{Horizontal Scaling Architecture}
\subsection{Node Types}
G-Chain supports three node deployment models:
\begin{enumerate}
\item \textbf{Full Sync Nodes}: Complete network state across all 8 chains
\item \textbf{Chain Sync Nodes}: Specific chains only (e.g., C-Chain + X-Chain for DEX)
\item \textbf{App Sync Nodes}: Application-specific subgraphs (e.g., DeFi protocols only)
\end{enumerate}
\begin{algorithm}[H]
\caption{Selective Synchronization}
\begin{algorithmic}[1]
\Function{SyncNode}{$config$}
\State $syncMode \gets config.syncMode$
\State $chainFilter \gets config.chainFilter$
\If{$syncMode = \text{FULL}$}
\State Subscribe to all chain events
\ElsIf{$syncMode = \text{CHAIN}$}
\For{each $chain$ in $chainFilter$}
\State Subscribe to $chain$ events
\EndFor
\ElsIf{$syncMode = \text{APP}$}
\State $subgraph \gets$ Load application subgraph definition
\State Subscribe to events matching $subgraph$ filters
\EndIf
\State Process incoming blocks and update GraphDB
\State Commit Verkle trie state
\State Publish state root to consensus
\EndFunction
\end{algorithmic}
\end{algorithm}
\subsection{Custom Indexing}
Applications can define custom indexes for optimized queries:
\begin{lstlisting}[language=YAML, basicstyle=\small\ttfamily]
# config.yaml
customIndexes:
- name: "token_transfers"
chains: [C, X]
nodeType: "Transfer"
fields:
- name: "from"
type: "address"
indexed: true
- name: "to"
type: "address"
indexed: true
- name: "amount"
type: "uint256"
indexed: false
- name: "defi_positions"
chains: [C]
nodeType: "Position"
fields:
- name: "user"
type: "address"
indexed: true
- name: "protocol"
type: "string"
indexed: true
- name: "collateral"
type: "uint256"
indexed: false
\end{lstlisting}