Skip to main content

Setting Up Streams with Functions

Updated on
Feb 27, 2024

Setting Up Streams with Functions

This section guides you through setting up a Stream with Functions as the destination, leveraging the versatility and power of QuickNode Functions.

Streams Settings

On your QuickNode dashboard, navigate to the Streams page by clicking the Streams tab on the left side-panel. After, click the Create Stream button in the top-right corner. You'll be prompted to first configure your Stream settings:

Stream Settings

  • Chain and Network: Begin by selecting a target Chain and Network from the list of supported chains and networks. You can check the supported chains and network here
  • Dataset: Once you've chosen the network and chain, proceed to select a Dataset that defines the type of data you intend to stream. See the full list of supported data schemas here.
  • Stream name: A stream name will be populated by default but you can modify this if needed.
  • Region: By default, the region most closest to you will be populated, however, you can modify this if needed.
  • Batch size: Configure the batch size for your Stream. By default this will be set to 1 (for minimal latency), however you can update this if needed.
  • Stream start: By default, your stream will start at the tip of the chain (e.g., latest block number), however if you are backfilling (retrieving historical data), you can update this value to start from a specific block number.
  • Stream end: If you want your Stream to end a specific block number, update this value. Otherise, by default the Stream won't end.

Reorg Handling

Streams come pre-configured to handle reorgs. You can enable the Latest block delay and Restream on reorg settings to properly manage reorgs to your preferences. Check out the Reorg handling page to learn more about Reorgs and how to properly manage them.

Reorg Handling

Destination Settings

Now, to configure the Stream with a Functions destination, follow these steps:

Destination Settings Functions

  • Select the URL of the Function you have already deployed and want to use.
  • If needed, update the Timeout, Retry, and Pause fields to be align with your criteria
  • Optionally, add an Custom Header with an arbitrary key and value

After configuring all the settings according to your preferences, click on the Create a Stream button located in the bottom right corner. This action will generate a stream for you, utilizing the Function you provided.

Additional Context and Information

  • Why Use Functions as a Destination: Functions allow for complex data processing like filtering and transforming blockchain data in real-time. This is particularly useful for applications that need to respond dynamically to blockchain events.
  • Capabilities of Functions: With support for various languages (including Node.js, Python, Go, PHP, and Ruby), and the option to upload a ZIP or Docker image, Functions provide a powerful and flexible development environment for your serverless functions.
  • Blockchain Optimized: Functions as a destination for Streams is tailored to blockchain applications. Pipe your streaming blockchain data directly into your customized Function instantly, with no need to manage your own infra.
Share this doc