BLOG — Updates

163 days ago

Instant onchain executions with Block Triggers

Gelato's Functions are serverless, event-driven tools designed for automating blockchain transactions, offering developers a powerful bridge between on-chain and off-chain, enabling developers to execute on-chain transactions based on arbitrary off-chain data and computation.

Introducing Block Triggers Block triggers enable Gelato Functions to actively listen for new blocks and automatically execute the smart contract function as soon as the block is mined. This allows Functions to synchronize with the Blocktime and carry out operations instantly.

Advantages for Developers

Block-triggered Web3 Functions bring several advantages to developers:

  • Lower Latency: Functions execute promptly with each new block, reducing wait times.
  • Sync with Blockchain: By executing in tandem with new blocks, functions are always aligned with the latest blockchain state.
  • Efficient Time Synchronization: The synchronization with block addition eliminates the risk of missed blocks and ensures timely execution.

Use Cases

Block triggers prove beneficial in scenarios that require immediate action in response to state changes:

  • Limit Orders: Block triggers prevent delays in execution, safeguarding against missed price targets or slippage, thereby averting possible financial losses or missed opportunities.

  • Perpetual Orders: Block triggers ensure an immediate reaction, maintaining the efficacy of perpetual strategies and preventing suboptimal trading positions or uncontrolled risk.

How to enable Block Trigger?

Implementing block-driven Web3 Functions is seamless. To create a new task for a Gelato Function with a block trigger:

  1. Navigate to
  2. Choose the "Every Block" option.
  3. Under “What to trigger,” select “Typescript Function.”
  4. Continue with the standard process

About Gelato

Gelato is a Web3 Cloud Platform empowering developers to create automated, gasless, and off-chain-aware Layer 2 chains and smart contracts. Over 400 web3 projects rely on Gelato for years to facilitate millions of transactions in DeFi, NFTs, and gaming.

  • Gelato RaaS: Deploy your own tailor-made ZK or OP L2 chains in a single click with native Account Abstraction and all Gelato middleware baked in.

  • Functions: Serverless, event-driven functions to automate blockchain transactions.

  • Relay: Give your users access to reliable, robust, and scalable gasless transactions via a simple-to-use API.

  • Account Abstraction SDK: Gelato has partnered with Safe, to build a fully-fledged Account Abstraction SDK, combining Gelato's industry's best gasless transaction capabilities, with the industry's most secure smart contract wallet.

Subscribe to our newsletter and turn on your Twitter notifications to get the most recent updates about the Gelato ecosystem! If you are interested in being part of the Gelato team and building the future of the Internet browse the open positions and apply here.