What is a smart-trigger?
A smart-trigger is essentially a smart-contract deployed into the PARSIQ environment:
- Provably triggered from external blockchain (signatures are passed from the original blockchain).
- Has updatable storage. Partially backtrackable.
- Expressed in functional style (without recursion).
- Inspired by rx/observables and their operators (powerful abstraction over event streams) thus supports map, reduce etc.
- Exports its results via message queue (consumed by the client).
How it works?
The PARSIQ platform constitutes a distributed solution for reverse-engineering of other blockchains. The system listens all the activity in corresponding blockchains and builds fully indexed representation of what happens in particular blockchain. This process generates much more data than can be found in any single blockchain, for managing such an amount of data PARSIQ introduces separate distributed data management layer. To do so, the system uses blockchain-specific feature extraction.
PARSIQ introduces instrumented virtual machines for replaying all the existing transactions, while capturing some crucial data that could not be easily obtained from the artefacts persisted in a blockchain, e.g. “internal” transactions in Ethereum, cross-contract calls and internal asset movements within transactions. The platform provides both pull queries and push queries through the concept of smart-triggers. While providing traditional query-response interfaces, PARSIQ allows users to upload a definition of a smart-trigger with its own private data storage that could be populated by the smart-trigger owner (e.g. list of addresses under investigation). Events received from the data acquisition layer are fed to an activation engine, which causes user-defined smart-triggers to be executed. Triggers are stored together with relevant data in PARSIQ-hosted user databases.
Triggers execute pre-defined functionality in the PARSIQ VM, which are accessed by two means:
· A REST API for standard HTTP messaging
· A Web Socket interface, allowing synchronous streaming services with push functionality
On top of these APIs different user interfaces are implemented. The PARSIQ platform itself provides a user-friendly web interface, which allows non-expert users to deploy simple smart-triggers. Further interfaces can be implemented by developers using the APIs directly.
Smart-triggers are one of the most powerful features of the PARSIQ platform. While the PARSIQ VM provides the primitives to implement very sophisticated triggers through a domain specific language, it is entirely possible to expose a significant subset of these primitives at the graphical user interface layer, in order to allow non-expert users to easily set up their own triggers.
At the logic level, smart-triggers consist of the following parts:
- An expression defined by the user in a domain specific language. These expressions follow a reactive paradigm and are usually in the “if-this-than-that” format.
- Atomic inputs from the event layer. These inputs are in the form of classified events being passed up to the activation engine from the data acquisition layer.
- A user database containing descriptions of assets being monitored, for example a list of addresses to be watched for transfers. The user database is hosted by PARSIQ but allows user to upload their relevant data.
Smart-triggers can be used for a number of things and allow creative combinations of the classified events that can be detected by replaying transactions through the PARSIQ’s instrumented virtual machine.
In simple words:
· Assets being withdrawn from a certain address.
· Assets being sent to a certain address.
· Asset transfers above a certain threshold.
· High-frequency transactions monitoring to and from exchanges/other service providers.
· Interactions with a certain smart-contract.
· Invocation of a specific smart-contract function.
· High gas transactions that may indicate front-running attempts.
· Failed transactions.
It should be obvious from the range of possibilities that the applications of smart-triggers are far reaching.
Currently, PARSIQ has onboarding clients with the needs for the following more elaborate use cases:
Unauthorized funds movement with earliest possible notifications.
One basic but very useful feature is allowing users of exchanges to detect unauthorized asset movements. Cryptocurrency exchanges may make use of this to implement automatic transfer blocking/freezing and instant tracing of the assets that were stolen from the user. They will use smart-triggers themselves and integrate them with blacklists of fraudulent addresses. The prevention and tracing of unauthorized asset transfers extends, of course, beyond the scope of exchanges and is of equal benefit to both enterprise users and end-users. Smart-triggers in the above mentioned structure allow exchanges and other businesses to react more quickly to questionable transactions when time is of the essence.
Smart and fine-grained notifications on user deposits for money-receiving applications (e.g. exchanges, web-wallets).
Exchanges, cryptocurrency payment solutions and other service providers who have large amounts of wallets to monitor can use smart-triggers for real-time monitoring and notifications of deposits, withdrawals and balances of their users’ wallets which drastically decreases the load of their infrastructure and manpower while allowing exponential user base growth.
Implementing additional logic for already deployed smart-contracts that are under load.
A good example for the use of smart-triggers is reacting to smart-contract events. Let’s consider a deployed smart-contract is missing a certain feature. In particular, an action may have been left out or needs to be added to a smart-contract event. Due to the immutability of the blockchain, upgrading the smart-contract is not possible and re-deployment is not always an option. This could be the case of a token sale contract to which a bonus feature needs to be added. A smart-trigger could be set up to detect relevant incoming transfers and invoke a separate bonus payment to correct the mistake.
Another valuable case is that businesses are able to set up monitoring for their smart-contracts, such as ICO/STO contracts. For example, PARSIQ can monitor if there is a change in token supply, due to an exploit in the smart-contract’s code (as it happened with the MORPH token contract case). The system can alert the contract owner, follow newly generated tokens and alert the exchange to which tokens are transferred to even before the transfer is confirmed.
Naturally, the monitoring of smart-contracts can be used for many things beyond the above given examples, ranging from simple interactions that may cause interest from different standpoints to attack attempts that are intended to exploit a vulnerability.