Getting Started with Chainlink Automation
Chainlink Automation will reliably execute smart contract functions using a variety of triggers. Explore the examples below to see how Chainlink Automation works for each type of trigger. Before you begin, you will need an active cryptocurrency wallet such as Metamask.
- Time-based trigger: Use a time-based trigger to execute your function according to a time schedule.
- Custom logic trigger: Use a custom logic trigger to provide custom solidity logic that Automation Nodes evaluate (offchain) to determine when to execute your function onchain.
- Log trigger: Use log data as both trigger and input.
Try out Chainlink Automation
Click the tabs below to use Chainlink Automation with each type of trigger:
Increment a counter every 5 minutes using our example contract.
-
Navigate to the Chainlink Automation app and connect to Arbitrum Sepolia in the top dropdown menu.
-
Connect your cryptocurrency wallet to the app if you haven't done so already. You may also need to fetch Arbitrum Sepolia testnet LINK here.
-
Click Register new Upkeep and select Time-based trigger.
-
Under Target contract address, enter 0x083935210524c0A8922ec610d1063Aa0A54d9d70. This is a simple counter contract that increments with each call. View the source code here.
-
In the Contract call section, enter
addInteger
under Target function. In the Function inputs section, enter a number to increment by under intToAdd. Then click Next. -
Specify the time schedule, for example every 5 minutes. Paste the cron expression
*/5 * * * *
under Cron expression or select one of the example timers. Then click Next. -
To learn more about CRON expressions, click here.
-
Enter an Upkeep name, your public key address under Admin Address,
500000
under Gas limit, and0.1
under Starting balance (LINK). -
Click Register Upkeep.
-
After the transaction has completed, you can view the performs for your upkeep in the upkeep details.
You have successfully automated your first time-based upkeep. To learn more about creating time-based upkeeps, read here.
Increment a counter using custom logic stored onchain.
-
Navigate to the Chainlink Automation app and connect to Arbitrum Sepolia in the top dropdown menu.
-
Connect your cryptocurrency wallet to the app if you haven't done so already. You might also need to fetch LINK for the Arbitrum Sepolia testnet from faucets.chain.link.
-
Click Register new Upkeep and select Custom logic trigger.
-
Under Target contract address, enter 0x6C0AAAeBcDb6F5D03759B8BF14b47BE491755530. This contract is an Automation-compatible contract that uses logic stored onchain and onchain state to determine when to increment a counter. View the source code here. Click Next.
-
Enter an Upkeep name, your public key address under Admin Address,
500000
under Gas limit, and0.1
under Starting balance (LINK). -
Finally, enter your public key address under Check data (Hexadecimal).
checkData
is optional static data that you can pass into your upkeep to ensure your counter increments. -
Click Register Upkeep.
-
After the transaction is complete, you can view the performs for your upkeep in the upkeep details. Your upkeep should perform once every minute and stop after 4 performs.
You have successfully automated your first custom logic upkeep. To learn more about creating custom logic upkeeps, read here.
Increment an onchain counter using a log as trigger.
-
Navigate to the Chainlink Automation app and connect to Arbitrum Sepolia in the top dropdown menu.
-
Connect your cryptocurrency wallet to the app if you haven't done so already. You might also need to fetch LINK for the Arbitrum Sepolia testnet from faucets.chain.link.
-
Click Register new Upkeep and select Log trigger.
-
Under Contract to automate, enter 0xe817e4A71C69C72C01B31906F9F8591FbaB6b448. This is a simple
iLogAutomation
-compatible example contract that increments a counter when a log is detected. View the source code here. Click Next. -
Under Contract emitting logs, enter 0x1260206b960bB07F12d48C19fad505CeFc071bDd. This is the contract Automation will listen to for emitted logs. View the source code here. Click Next.
-
Under Emitted log select Bump from the dropdown menu. This is the log signature Automation will look for.
-
Log index topic filters are optional filters to narrow the logs you want to trigger your upkeep. For this example, enter your public key address under addr and leave the num field empty. Later when you call the bump function to emit the log, your
msg.Sender
address will be emitted in the log, triggering your upkeep. Click Next. -
Enter an Upkeep name, your public key address under Admin Address,
500000
under Gas limit, and0.1
under Starting balance (LINK). -
Click Register Upkeep and wait for the transaction to complete.
-
To trigger your upkeep call bump on the trigger contract by navigating to the Arbitrum Sepolia scanner, connecting your wallet and executing the bump function. You can observe your upkeep's perform in the Automation dashboard.
You have successfully automated your first log trigger upkeep. To learn more about creating log trigger upkeeps, read here.
Supported networks and costs
For a list of blockchains that are supported by Chainlink Automation, see the Supported Networks page. To learn more about the cost of using Chainlink Automation, see the Automation Economics page.
Contact us
For help with your specific use case, contact us to connect with one of our Solutions Architects. You can also ask questions about Chainlink Automation on Stack Overflow or the #automation channel in our Discord server. Utility contracts can also help you get started quickly.