Introduction to PARSIQ

ETHDenver2022 | Guide for Developers

PARSIQ
PARSIQ
5 min readFeb 17, 2022

--

PARSIQ is a Web3 data platform that helps build functionality on top of blockchain data. With Smart Triggers, you can create “if-this-then-that’’ workflows — watch for a specific on-chain event and initiate downstream actions when they occur.

How does it work (a very high-level overview)

We run nodes for every supported blockchain. Some blockchains require more than 1 node just to keep our monitoring up to date and in case of failure, the neighboring node will take the lead.

Then, the Block Trackers and Tracers look inside every block. In case of shutdown between nodes and Block Trackers, they also keep in mind what block they looked at last and when connection is back, the Block trackers will continue working from the point of shutdown.

That means that our Monitoring Platform never misses a block, so you will be notified of every transfer or event in an instant or at least with minimal delay.

You get read a bit more about our platform at https://docs.parsiq.net/parsiq-platform.

After the Block Trackers, our platform does three actions: Activation, Execution and Delivery.

Activation.

When the new block has arrived, we trace everything inside it: Events, transactions, actions, transfers etc. And the Activation part is looking at these events and it compares with the Smart Triggers on our platform. If a Smart Trigger is interested in an address that happens to be in this block the Execution part starts up.

Execution.

It is a custom program you can make: “If this then that” and many more things. For example, you are interested in incoming transfers of over 1 ETH or other details that you might want to get. When those conditions are met, execution starts the next step — delivery.

Delivery.

When your Smart Trigger has configured Delivery Channels (such as Telegram, Discord, Google Sheets or Webhook), our platform sends you your desired data from the Smart Trigger. After that, you have spent one action of your PARSIQ account.

Main Concepts to go over.

You can use our Trigger Wizard to create simple Smart Triggers, but to enhance the functionality, one should use ParsiQL to create custom Smart Triggers.

Smart Triggers are written in our domain-specific language ParsiQL. You can set your Smart Trigger to monitor more than one address and have many different execution conditions. (Information about ParsiQL and code samples can be found here)

Transports are responsible for how your data is delivered through your Smart Trigger’s Delivery Channels (Telegram, webhooks, etc.) More on them here.

When producing an event, the data about it can be delivered to your Telegram as a notification, and at the same time, for example, it can be delivered to your Google Sheets for analyzing the data through graphs and stats.

Datasets — in short, are variables that you define in your project. Every Smart Trigger inside that project can refer to that User Data. There are several types of User Data, from simple primitives to tables (more info on them here). With them you can make a more streamlined ParsiQL code for your Smart Trigger.

User Streams — you can upload a smart contract’s ABI and react to different on-chain events. It can be used for transactions, events produced by a Smart Contract and for the external function calls to your Smart Contract. (More info with code samples here)

API

We have several functionalities for our API. One of the features of using the API is to change the values of your Datasets externally. Instead of using the web interface to modify it, our API gives you a way to dynamically modify Dataset entries, e.g., for adding new monitoring addresses programmatically. (You can read on that more here)

The other function right now is what we call a Transaction Lifecycle Service, or TLS for short. It allows the user to monitor if the transaction of interest is mined or if it is reached the certain number of confirmation (on how to use it: here)

From where PARSIQ Monitoring can get the Data

Right now, we support Ethereum, Binance Smart Chain, Solana, Bitcoin, Algorand, DASH, Huobi Eco Chain, Polygon and recently we’ve added Casper Deploys support.

Besides Native Streams, we also support Chainlink Price Feed (like ETH/USD, BTC/ETH, etc.) and we have the External Data Providers: Crystal Blockchain and Uppsala Sentinel Protocol for risk scoring, Cryptorank and Chainlink for price feeds and we also have OpenSea API Wrapper for additional data on NFTs.

(more info on native and special streams here)

By combining everything you can create really powerful monitoring tools or enhance your own tools with the data acquired via PARSIQ

Sample code for simple use case.

For more sample codes, check this page. Also, you can find blockchain specific sample codes on our documentation (like here for Ethereum)

But now, we will look at a simpler Smart Trigger code. This one makes it possible to get notifications for the withdrawals of more than 0,01ETH from one particular address

#Activation part of you Smart Triggerstream _from Transferswhere @from == ETH.address("0xMyAddress")#Execution part of you Smart Trigger with conditionsprocessif @value > 10000000000000000 then    #0,01ETH#What to send through your Delivery Channelsemit { @from, @to, @value, message: "A transfer of more than 0,01ETH" }endend

When the withdrawal happens, you will receive everything that you emitted as a string of data. For almost every Delivery Channel (except webhook) you can beautify the messages you receive via formatting (You can find the documentation on that here)

But you can emit every single piece of data about the event by writing emit { … }

--

--