paint-brush
PARSIQ Vs The Graph: Pull and Push Queriesby@parsiq
1,392 reads
1,392 reads

PARSIQ Vs The Graph: Pull and Push Queries

by PARSIQFebruary 8th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Comparing PARSIQ and the Graph projects: querying the blockchain. Pull and push queries. Domain-Specific Query Languages.

Company Mentioned

Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - PARSIQ Vs The Graph: Pull and Push Queries
PARSIQ HackerNoon profile picture

Making sense of what is going on in a blockchain network is mainly about making sense of large amounts of data. The main purpose of a blockchain is to maintain a distributed database that contains structured data, organized in a number of nested abstractions, ranging from blocks and transactions to complex data-structures in smart contracts. Understanding the blockchain, tracing transactions, and keeping track of assets is, therefore, a data analytics problem. 

The PARSIQ platform is a blockchain monitoring tool that is aimed at protecting assets in real-time and tracing transaction flows through the complex, intertwined data-structures that make up blockchain transaction histories. 

ParsiQL is one of the tools available to PARSIQ users to interact with blockchain data. The domain-specific language has been specifically designed to manipulate streams, PARSIQ’s principal abstraction for data originating from the blockchain. PARSIQ’s main feature, smart triggers, are best programmed using ParsiQL. 

Querying the Blockchain

Anyone who's ever tried to build distributed applications (dApps) on the (Ethereum) blockchain would concur: Although blockchains are conceptually quite close to databases, querying databases feels like a different world entirely compared to querying blockchains.

Performance is only part of the issue with retrieving data from blockchains. It gets worse: Blockchains have no query language to speak of. Imagine a database with no query language! How would you ever get what you need out of it? How do people build dApps, really? With a lot of effort, and brittle, ad-hoc code. 

Whatever the underlying model employed by a blockchain, there are some communalities and PARSIQ provides a convenient abstraction to the data that can be obtained from monitoring a blockchain. ParsiQL is the domain-specific language optimized to interact with this type of data.    

Domain-Specific Query Languages

Programming languages have come a long way, since the early days of computing. The days of having to deal with low-level issues, such as calculating data offsets, making sure all memory is accounted for, and properly allocated and freed are long gone.

High-level languages, such as JavaScript, Rust, or Python are amazing works of engineering, and being general-purpose languages can be used for any type of computation imaginable. That’s the point of general-purpose languages, they are general enough to cover any potential use case. 

However, engineering is full of trade-offs, and one common trade-off is that of specificity versus generality. In brief, tools that can be used for anything might struggle with some specialized tasks. This is where domain-specific languages come in.

Domain-specific languages focus, as the name suggests, on one specific domain. In other words, instead of trying to do everything, such a language tries to do one particular thing extremely well. 

Querying data is a good example where domain-specific languages come into their own. One of the oldest and best-known domain-specific languages, the Structured Query Language (SQL), has been around for almost 50 years now. Its only purpose is to interact with relational databases.

This interaction could, of course, also be performed with a general-purpose language, but this process would be rather cumbersome. Data in relational databases is structured in tables and SQL makes it easy to query the databases on this underlying structure. 

More recently, it became apparent that data that is accessed over a web-based API is usually structured in a certain way that makes repeated calls over REST endpoints rather cumbersome and inefficient. As a result, GraphQL has been invented to focus on this particular data query domain.

The Graph and GraphQL

The Graph is a decentralized protocol for indexing and querying blockchain data. But it's more than just a protocol: The Graph also has an implementation, which is open source and uses GraphQL.  

GraphQL is a query language for APIs, developed and open-sourced by Facebook. GraphQL has taken a life of its own, it's gaining in popularity and being used to access databases, too.

The Graph have open-sourced all their main components including Graph Node (an implementation of an indexing node built in Rust), Graph TS (AssemblyScript helpers for building mappings), and Graph CLI (Command line tools for speeding up development).

PARSIQ and ParsiQL

PARSIQ is the first blockchain automation platform that allows users to set up “smart triggers” to react to events on the blockchain using its advanced blockchain stream manipulation language, ParsiQL

PARSIQ, through Smart-Triggers underpinned by its advanced language, ParsiQL, allows insights, alerts, and advanced blockchain monitoring to run on its platform in real-time.

ParsiQL is not a query language, it's a language that allows transforming reactions and streams of events. Most components of ParsiQL will be open-sourced.

PARSIQ has entered a number of partnership agreements with third parties, such as crypto-specific risk score data providers. These integrations are accessible directly from ParsiQL in the form of libraries that invoke the APIs of our partner services.

Key differences

This paragraph must be started with the general point: PARSIQ and The Graph are not competitors. 

The Graph is providing an interface for the historical events that already happened in blockchain, in a queryable way. PARSIQ works with the current moment, allowing transforming this infinite stream of real-time data. 

The Graph is a pull-based service, where you need to pull the query from the history. PARSIQ is push-based, as it is sending notifications. You just need to define what you need to monitor and PARSIQ will push the requested information as soon as your Smart-Trigger is triggered.

💡 PARSIQ is for those who need actionable information real-time, to make decisions, whether it will be for trading decisions, possible theft of assets, monitoring liquidity pools or datasets to optimize your ROI from staking mechanics or as a business receiving funds from clients making sure the funds aren’t coming from blacklisted wallets and keeping in line with AML and KYT procedures.

Implementing something complex that evolves and reacts to events between smart contracts, you need to have a bridge that will collect this information from the various blockchains and present the data in an understandable way so you can decide whether or not to take action on your received notifications.

PARSIQ simply decided that the blockchain deserves a standard way of how to react to events. When you are programming in PARSIQ, you are defining the logic of what to do when something happens in the blockchain.

PARSIQ introduced Smart Triggers to the crypto world, allowing real-time on-chain events to trigger off-chain actions, giving developers the possibility to automate workflows, creating endless ways to interact with real world applications, maximizing possibilities while focusing on being cost effective.

"Even though it appears like the Graph project does the same thing at first glance, we are very different. These differences make us more likely to collaborate with the Graph than be competitors."

- Anatoly Ressin, Chief Architect at PARSIQ

It takes you $0 and a few seconds to set up an individual solution with PARSIQ Quick Monitoring Wizard. Start with a free plan today to begin discovering all the PARSIQ capabilities.