Web3 Functions: Instant 1-Second Executions

Gelato Team

Oct 3, 2023

Gelato's Web3 Functions serve as a powerful bridge between on-chain and off-chain, enabling developers to execute on-chain transactions based on arbitrary off-chain data (APIs, subgraphs, etc.) and computation.

Until now, Web3 Functions achieved their fastest latency of 5 seconds when executed sequentially. With the introduction of Parallel Executions, we’re ushering in a new era of even lower latency, allowing for more frequent runs and increased throughput — reducing execution time to just 1 second.

Sequential vs. Parallel Executions

In Sequential Mode, Web3 Functions run one after another in a structured order. In Parallel Mode, functions run independently and simultaneously, optimizing speed and efficiency.

Sequential Mode

Each Web3 Function runs one at a time, waiting for the previous task to finish. This ensures operations don’t overlap, making it ideal for tasks that need to happen in a specific order.

Parallel Mode

Functions don’t wait for previous ones to complete. While the first instance is running, a new instance can launch in the next time interval. This mode is optimized for speed and is especially useful for “Send and Forget” tasks where sequence doesn’t matter.

Sequential vs Parallel Execution

New Use Cases Enabled by Parallel Executions

Parallel mode is particularly advantageous for scenarios demanding immediate response:

  • Liquidations: Address rapid collateral fluctuations instantly to protect lenders and prevent insolvency risks. Platforms like Alpaca Finance and B.Protocol benefit here.

  • Limit Orders: Capture transient market opportunities. DEXs like PancakeSwap and Quickswap can use parallel executions for timely trade completions at intended prices.

  • Perpetual Protocols: Ensure real-time alignment of contract prices with underlying assets, minimizing slippage and maintaining trading efficiency.

Any use case requiring real-time, instant execution can benefit from parallel executions enabled by Gelato’s Web3 Functions.

How to Enable Parallel Execution

Switch between sequential and parallel execution modes by updating the schema.json of your Web3 Function:

{
  "executionMode": "sequential" // For sequential tasks
}

or

{
  "executionMode": "parallel" // For parallel tasks
}

About Gelato

Gelato is web3’s decentralized backend empowering builders to create augmented smart contracts that are automated, gasless, and off-chain aware across all major EVM-compatible blockchains (Ethereum, Arbitrum, Polygon, Optimism, zkSync, and more). Over 400+ projects rely on Gelato to power millions of transactions across DeFi, NFT, and Gaming.

Gelato currently offers four services:

  • Gelato zkRaaS: Deploy tailor-made ZK L2 chains in a single click with native Account Abstraction and all Gelato middleware baked in.

  • Web3 Functions: Connect your smart contracts to off-chain data & computation with decentralized cloud functions.

  • Automate: Automate your smart contracts by executing transactions automatically in a reliable, developer-friendly & decentralized manner.

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

  • Account Abstraction SDK: Built with Safe, combining Gelato’s gasless transaction capabilities with secure smart contract wallets.

Subscribe to our newsletter and turn on Twitter notifications for the latest updates about the Gelato ecosystem.
Interested in joining the Gelato team? Browse open positions and apply here.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.

Ready to build?

Start with a testnet, launch your mainnet in days, and scale with industry-leading UX.