Create Your First Event Based Job
In this tutorial, you'll learn how to automate a smart contract function using TriggerX's event-based trigger. We’ll walk through each step, from understanding the contract to setting up an event-driven job on the TriggerX platform.
Understanding the Smart Contract
Contract Functionality:
The smart contract we'll use contains a function helloWorld
that increments a stored value by a specified amount each time it’s called.

Why Automate with TriggerX
Monitoring and reacting to events manually can be inefficient and prone to delay or error. With TriggerX, you can automate the response to an on-chain event, ensuring actions are taken precisely and immediately after an event occurs.
Step-by-Step Guide to Creating an Event-Based Job
Access the TriggerX App:
Navigate to the TriggerX application and connect your wallet.
Navigate to 'Create Job':
On the home page, click on the "Start Building" button. By default, this opens the custom job creation page.
Select Trigger Type:
Choose Event-Based Trigger to schedule the function execution at regular intervals.
Choose Network:
Select OP Sepolia as the network where your contract is deployed.
Set Timeframe: Set the duration for which the job should actively listen for events. For example, choose 1 day.
Choose Recurrence: Indicate whether this job should be:
Recurring (executed every time the event is emitted)
One-Time (executed only once on the first event) Choose the desired option based on your automation needs.
Enter Event Contract Address: Provide the contract address that emits the event you want to listen to:
0x49a81A591afdDEF973e6e49aaEa7d76943ef234C
Select Event to Trigger Execution: From the list of available events, select:
CounterIncremented(uint256, uint256, uint256
Enter Contract Address: Input the address of the contract whose function you want to call when the event is triggered:
0x6bd14b295B10821c53AB92613593786A623fa612
ABI Handling:
If your contract is verified on the blockchain explorer, TriggerX will automatically fetch the ABI.
If it’s not verified, manually input the ABI during this step.
Select Function to Trigger: From the available functions in the contract, choose:
helloWorld
Define Function Arguments:
Argument Type:
Static: Provide a fixed value that will be used each time the function is called.
Dynamic: Fetch the value dynamically from an API or an IPFS-hosted script.
For Static Argument:
Enter the value directly. For example, to increment by 1
every time the event occurs, input 1
.
For Dynamic Argument: Provide the IPFS link to your script that dynamically fetches the value. (Templates and documentation are available in the TriggerX DevHub).
Finalize and Create Job: Click the “Create Job” button. While the system calculates the necessary fees, enjoy a mini-game featuring a man collecting food. Once the fee estimation is complete, click “Next” to finalize your job creation.

Summary
You’ve now set up an event-based job on TriggerX!
This job will listen for the CounterIncremented
event on the OP Sepolia network and automatically call the helloWorld
function in response, incrementing your contract’s stored value.
For more advanced features, customization, and templates, check out the TriggerX DevHub.
Last updated