Waves Protocol
Published in

Waves Protocol

Blockchain Trigger: a tool for automatic smart contract invocation

Note: this article is a suggestion of a trigger tool, which is not implemented yet. You can participate in improving the idea by sharing your feedback on its GitHub page.

The ecosystem of blockchain tools for creating decentralized applications is extensive and diverse. In this article, I will describe Blockchain Trigger, a service that could be integrated into Waves or any other blockchain protocol.

Blockchain Trigger is a tool that could resolve the issue of high entry barriers for users who want to call a smart contract. In this article about smart contracts, I described the practicalities of writing transparent code and integrating smart contracts into dApps. While setting a smart contract script is quite easy, its invocation remains an open issue:

Currently, a smart contract can only be invoked by a call from a centralized party, such as a dApp user.

Every time a user wants to call a smart contract, they need to sign a transaction and interact with the blockchain. This might as well be rocket science to a regular user, and certainly doesn’t help the mass adoption of blockchain technology.

Blockchain Trigger is a tool that enables a developer to set a script that will automatically be called when a preset condition is met. Any ecosystem participant can run Blockchain Trigger as a Waves Node extension and expand its functionality, also improving user experience.

Practical applications

The main functionality that Blockchain Trigger enables is automatic invocation of a smart contract without a user’s involvement. A given condition can be specified for calling a smart contract — for instance, hitting a certain block height, a change to a user’s balance, or reaching a certain point of time in the real world.

When the condition is met, any miner who launches Blockchain Trigger will call the smart contract, instead of a user. Let’s look at three examples of how this tool might be used to achieve unique functionality in a dApp.

1. Regular payments

One of Blockchain Trigger’s main applications is automated payments. An example of this is a dApp that automates rent payments for an apartment.

Task: A user needs to make a rent payment once a month.

Solution: The user opens a wallet (creates an account), after which they have to log in every 30 days to create and sign a payment transaction.

Blockchain Trigger-based solution: A user opens a wallet and attaches a smart contract script that corresponds to the relevant rental agreement. The script will automatically be invoked by Blockchain Trigger every 30 days, while the user only needs to make sure that the wallet has a sufficient balance.

Using Blockchain Trigger, we limit a user’s activity to just one event: “Create an account and set the smart contract”. Blockchain Trigger will do the rest.

2. Auto payments for Decentralized Finance

Similar mechanics can be implemented in the DeFi space. For instance, payments for Neutrino staking could be executed by a smart contract that is invoked on a daily basis by Blockchain Trigger, sending Neutrino stakers their additional USDN tokens. Similarly, payments to stakers by node owners could be automated with a smart contract invoked by Blockchain Trigger.

3. Gambling payouts

This use case could help resolve an issue that recently arose with an existing solution. A lottery run by Waves as part of the MRT Farewell Party had several winners. The prizes were not sent to them automatically: winners had to manually send a transaction to claim their WAVES. Blockchain Trigger would have helped to improve the game mechanics, as prizes would automatically have been distributed. This is the most reliable solution, since a user could otherwise buy a lottery ticket a month in advance, forget about it and, as a result, fail to collect their winnings.

Impact on participants’ revenues

Blockchain Trigger can be implemented as a piece of software that miners will be able to launch with Waves Node. A dApp’s owner can reward those who call smart contracts by sending them WAVES, as smart contract invocations bring miners an extra revenue.

To estimate rough revenues for Blockchain Trigger, let’s look at blockchain transaction stats. Based on public data available at http://dev.pywaves.org/txs/, over 2,000 InvokeScript transactions are called daily on Waves’ mainnet, which means 2,000 blockchain script executions. With the imminent activation of Version 1.2, failed transactions will also be written to the blockchain, doubling the number of relevant network transactions.

If 5% of these invocations are called by Blockchain Trigger, we will have 100 daily transactions and 3,000 monthly transactions. It’s hard to estimate the size of fees that dApp owners might offer for contract invocations, but if it’s the same as for smart contract invocation (0.005 WAVES and upwards), we get the figure of 3,000 * 0.005 WAVES = 15 WAVES. By comparison, a miner running Waves Node without any additions and with a generating balance of 10,000 WAVES will collect 50 WAVES a month.

This is a very rough estimate, but it still shows that running Blockchain Trigger with a node will bring miners worthwhile extra revenue.

Tech implementation

In the Waves ecosystem, Blockchain Trigger can be implemented as an extension to the Waves Node app. It would operate as a piece of software, launched independently and operating according to the following algorithm:

  1. Verifying all SetScript transactions
  2. Adding scripts corresponding to a preset standard to the todo list
  3. Creating and sending an InvokeScript transaction if a condition for calling the smart contract from the todo list is met

The tech implementation and the smart contract standard are described in a proposal published on GitHub. Check it out and join the discussion in the comments!

Conclusion

Blockchain Trigger is another step towards lowering the entry threshold for users and enabling true mass adoption of blockchain technology, as it simplifies the dApp creation process by allowing automatic invocation of smart contracts.

The tool’s implementation in the Waves ecosystem would bring extra revenues to network participants. If the tool proves to be useful for the ecosystem, similar mechanics could be implemented in other blockchain protocols, which would be a major step towards cross-chain interoperability and greater popularization of blockchain.

Share your feedback in a GitHub discussion and join Waves Developers Chat!

--

--

--

Waves is an open blockchain protocol and development toolset for Web 3.0 applications and decentralized solutions, aiming to raise security, reliability and speed of IT systems. It enables anyone to build their apps, fostering mass adoption of blockchain.

Recommended from Medium

MFL First Drop and what to expect

Mliki: A Marketplace for Digital and Physical Goods

Livestream Review: DAD Will Truly Solve Traditional Advertising Industry Problems with Blockchain

IIC weekly report-week of 2018–05–28.

Recapitulation of GRISE FINANCE PROJECT AMA event held at AMA LOVERS CLUB.

The Vending Machine Model

Monthly Roundup for Holo & Holochain

ForthBox 103% monthly mint NFT now for BNB (P2E)!..MINT BNB

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vladimir Zhuravlev

Vladimir Zhuravlev

Waves Association 🏄 Telegram: @vlzhr

More from Medium

Dark Matter DeFi Project Update

What a $305K investment in Hermes DeFi looks like

Pangolin — A community-driven DEX for Avalanche & Ethereum Assets

TRAVA TO LAUNCH LENDING POOL ON ETHEREUM NETWORK