How Spectral Uses The Graph
Talking to Simon Emanuel Schmid, Edge & Node's Developer Experience manager about The Graph, a decentralized indexing protocol Spectral Finance uses to speed its access times and organize its data.
We spoke to developer experience manager Simon Emanuel Schmid at Edge & Node, working on The Graph, about how subgraphs help enable Spectral’s super swift retrieval times.
Blockchain data is difficult to parse quickly. A simple search, such as the one required for pursuing a MACRO Score would normally mean going through each block on the Ethereum chain, one after another. On the internet, apps usually rely on indexers like Google to pre-sort information into indices like a table of contents in a book.
Decentralized applications, including Spectral, also use indexes of presorted data for fast retrievals. Blockchain data is sorted and organized by The Graph, an indexing protocol that supports a decentralized ecosystem of open APIs called Subgraphs.
“We use a number of Subgraphs that power all of the DeFi data we ingest,” says Spectral machine learning engineer Zane Peycke. ”Nearly all of the AAVE, Compound, and Uniswap data we ingest to create risk and recommendation models come from subgraphs. This includes subgraphs maintained by Uniswap and AAVE and our customized subgraphs deployed on The Graph's decentralized network. This has enabled considerably faster indexing when deploying new subgraphs and minimized the response time for each query we send.”
Developer experience manager Simon Emanuel Schmid explained further:
“The problem that Spectral and risk assessment of blockchain data based on on-chain events faces generally is that you need to source the data from somewhere, and, from the Ethereum blockchain for example, and this is a compressed set of three terabytes of data, so to get that information out, especially if you’re doing what Spectral does and making machine learning calculations on top of it, you have to get the data out.”
Spectral has to answer a lot of questions to provide a risk assessment score. “What did address A already do on the blockchain? What contracts did they interact with? What kinds of contracts were they? That takes a lot of source data from the blockchain and that’s where The Graph helps,” says Schmid.
As dapps like Spectral have begun to use information from other blockchains, The Graph has begun enabling subgraphs that allow queries across multiple chains. The MACRO Score’s latest version uses subgraphs that encompass Ethereum, Polygon, and Avalanche data.
Spectral is also planning to make use of The Graph’s Substreams. This is a parallel processing technology that uses fast indexing to more efficiently extract and interpret data. The parallelization and composability made possible by Substreams further increase the access and scalability of blockchain data processing and open up new applications that are not possible with subgraphs alone.
Spectral’s Wallet Signals
Have you taken a look at Spectral’s new Wallet Signals? Reveal risk assessment insights about any Ethereum address (currently limited to wallets that have AAVE or Compound loans during Beta testing).