Skip to main content
Version: v2.x.x

Event Listener and Single Node Execution

Single Execution

For some use cases (such as making an API or RPC request), it may be desired to execute a Lit Action on a single node, as opposed to every node in the Lit Network in parallel.

Single execution is now enabled in the SDK by passing the targetNodeRange parameter after your executeJS function (i.e. 'executeJs({ targetNodeRange: 1 })'). You can pass 1-10 to specify the number of nodes the Lit Action should be executed on. The selection process for this is random, and the client can't choose which specific node runs it.

Single execution allows you to request that a Lit Action be ran by a single node, but you will still need to call 100% of the nodes and collect responses from at least two-thirds of them in order to sign a particular output. In order to return a signed value in single execution mode, you’ll need to use a “one-to-many” node call, which is not yet supported.

Event Listener

The Lit event listener allows you to create specific event-based triggers for executing Lit Actions.

The SDK is designed around the principle of conditionally pre-approved chain reactions with account abstraction. This series of actions encrypted, conditional, often on-chain, can be chained together to trigger complex strategies.

With the SDK, you'll be able to set three core condition functions: webhooks, on-chain events, and intervals.

  1. Webhooks Webhooks are automated messages sent from apps triggered by user defined behavior. The event listener SDK is designed to query (request) and monitor information from specific APIs. In a blockchain context, this might include tracking price changes of a specific cryptocurrency or updates from a decentralized app.

  2. On-Chain Events The SDK allows you to set up listeners for specific events occurring on the blockchain, like a contract being executed or a new block being added. By subscribing to these events, you're telling the SDK to keep an eye on particular occurrences within blockchain networks.

  3. Intervals Intervals within the SDK act as the timing mechanism that governs how frequently the SDK checks the webhooks and on-chain events. By setting intervals, you determine how often the SDK will check for updates in the specified webhooks or on-chain events. If you need real-time reaction, you might set a short interval, whereas a less time-sensitive circuit might have longer intervals.

Node Code Platform

No Code Platform image Looking to automate signing with Lit Actions, without minimal code? Check out this platform that utilizes the event listener SDK.

Event listener SDK brought to you by DIGITALAX. Read the documentation to learn more.