The Osmosis DEX suite is growing exponentially, and it can be hard to keep track of all the teams building exciting new features. This series of Ecosystem Spotlights allows you to get to know the teams in their own words (lightly edited). To see more, check out our other posts or the Osmosis Ecosystem website.

What is Croncat?
Croncat is an on-chain transaction robot that makes it possible for accounts and smart contracts to schedule future tasks. Its name derives from the old Unix command-line scheduler called cron, itself a play on chronos, Greek for time. As such, Croncat tasks can be set to execute either by block height or familiar time-based cron patterns.

Task execution may occur just once, or repeat until the conditions set by the user are met — such as funds being fully dispersed from a contract via multiple transactions — or it may recur periodically according to a given cadence.

Why is Croncat important? Who will use it?
The first use case is obvious: an automated DAO payroll system that will eliminate manual interactions with wallets when payments are due. DAOs or subDAOs on Osmosis could use Croncat to automate their recurring CosmWasm multi-sig transactions without having to gather the signers for routine payments.

Croncat can also help NFT marketplaces by automatically performing logic once a given condition is met. For example, a marketplace could automatically transfer ownership at the end of bidding, and perhaps reimburse the failed bids, if necessary.

Unlimited royalties are possible as well. Imagine that a 100-person orchestra creates a music NFT, and each needs to be paid royalties individually. At some point, gas limits will prevent all of these from being paid in a single transaction. But with Croncat, an NFT contract could create a task to be called “immediately, repeating until [X condition] is met.”

In the future, there will be even more such cases where a transaction starts a process that cannot be finished in a single transaction, either because of gas fees or because other conditions must first be met, as may be the case with interchain lending, certain derivatives contracts, interchain limit orders and automatic arbitrage (which will require private transactions to be effective), and much more. Croncat will make it possible to automate all this on-chain.

Automatic swaps can also occur with Croncat. Say, for example, that a user has several LP positions on Osmosis and would like to swap some percentage of the total liquidity for stablecoins. Currently, they would need to sign transactions manually, which can be quite time-consuming. Alternatively, they might set up a regular, web2 cron job to perform these tasks, but that service would require their private key, which is highly insecure. With Croncat, however, they can set it and forget it.

More use cases can be found in the documentation.

How does it work?
Blockchains do not have “heartbeats” to synchronize them with off-chain occurrences like web2 servers do. Rather, for the chain to act on a user’s intention, an account must execute a transaction. Therefore, just as Chainlink, for example, communicates prices to blockchains via an oracle network, so Croncat communicates off-chain intentions to blockchains via a network of off-chain task executors called “agents.”

Agents are paid directly by task setters, with no intermediation, custody, or rent-taking by Croncat. When a wallet or smart contract creates a Croncat task, they attach funds to pay a random agent. If a user tries to create a task without including the proper amount, Croncat will throw an error instructing them pass a payment.

Croncat agents can be anyone able to run the agent software. This tool is simple enough to run on a Raspberry Pi or similar hobby computers, as long as it is connected to the internet. Once an agent is confident in their setup, they can nominate themselves to “active agent” status and begin querying nodes in order to be assigned transactions.

For instance, a Croncat agent might ask a node endpoint for a given Cosmos blockchain (see the Cosmos SDK docs for more on endpoints) to determine how many tasks it should execute, and the Croncat manager smart contract might respond, “you have 3 tasks to execute this block, and 19 to execute within this minute.” (Block times will depend on the specific Cosmos blockchain, but are on the order of seconds.)

The agent would then send a transaction to the Croncat manager contract with enough gas to fuel all potential cross-contract calls required to execute the tasks. Agents are expected to keep up or risk being demoted, leaving an empty slot for another agent to become active and take their place. In the future, agents might end up being largely protocol-run, either as a blockchain module or intrinsic in validator duties.

You can find more details on these processes in the Croncat docs: “Croncat in a Nutshell.”

Any risks / safety concerns & ways of mitigating them?
While Croncat can handle any Cosmos Message type, support for them is being introduced incrementally. For instance, the Bank Message type is one of the first that will allow for native tokens to be paid in payroll. To prevent any unforeseen bugs or malicious behavior, Croncat will disallow message types that are not specifically battle-tested. Then, as community members reach out with new ideas for us to implement, we will prioritize supporting any new required message types.

Croncat had its first implementation in a different layer 1 blockchain (NEAR), and lessons were learned from that experience. While Croncat did not suffer any serious attacks, we did receive security reports and voluntarily paid two security bounties from the Croncat DAO, a Swiss entity. This is not Croncat’s first rodeo, and we have learned to be even more aware of safety from these relatively benign, firsthand experiences.

II. Team

What are your origin stories? What got you into crypto and DeFi?
Trevor Clarke had a history of winning Ethereum hackathons, before organizing a Meetup in Portland, OR to teach community members about blockchain tech. Mike Purvis attended them and was essentially a web3 apprentice for a time before finding a position at NEAR Protocol in early 2020. They attended ETHDenver together in 2020, and, after many sleepless nights, won a bounty from Quorum (a JP Morgan-funded enterprise-edition of Ethereum later acquired by Consensys).

They began to discuss the seeds of Croncat in December 2020, and decided then that since Rust was the best language to write it in, that they would have to learn it. And so they did.

What’s your edge?
The Croncat team is building foundational systems that will allow web3 to flourish. While we are not opposed to external (non-grant) funding, the focus is not on making a large profit. Rather, we believe that scheduled transactions are such a basic need in blockchains that they should be built into the protocol layer, where they will enable even more decentralized use cases than exist today.

What are you interested in outside of crypto?
Trevor can 3D-print and assemble anything you can imagine, a maker and builder to the core. Mike is an avid esports spectator who believes there is huge potential for DAOs in the gaming space.

Both believe a good carbonara is key to success.

III. Building on Osmosis

What attracted you to Osmosis? Why build here?
The top use cases for Croncat involve recurring swaps, “shaving off” a portion of rewards into stables, and in general automating decentralized investment workflows. There is great value in building tools that allow less tech-savvy users to feel comfortable using DeFi, for example by letting them spread their their eggs across multiple baskets.

Furthermore, we believe that Croncat “recipes” will emerge that enable common swaps/moves of token assets. The Osmosis community will likely prove to be excellent authors of simple and advanced recipes, which will allow casual users to easily automate their digital asset strategies.

How do you see yourself developing within the Osmosis ecosystem?
The Croncat team is going to develop in tandem with Osmosis’ modular logic, and we’ll get to learn more about bindings, too, those fascinating points of contact between smart contracts and the blockchain code!

A big part of developing ourselves in the ecosystem is showing what Croncat makes possible, so as we build we will be educating. By the same token, we will be listening to what the community needs. We have a Discord, and we keep a close eye on our Twitter DMs (@croncats): in fact, even as we are participating in this interview, we are fielding questions from another DeFi project.

Are you planning to spin off your own appchain?
Right now, we are entirely focused on shipping the CosmWasm version of Croncat, but outposts on various chains are likely in future iterations. Croncat does not particularly need its own chain; rather, its best future might be as a Cosmos SDK module that will any chain that wants to offer scheduled transactions on the protocol level. We are also actively talking with folks from Interwasm DAO and Deus Labs who have recommended pinning the smart contract to the blockchain memory (which would require a separate governance vote), which will accelerate execution and save on-chain compute similarly to a module.

Ultimately, we want to enable an entirely new set of DeFi primitives including time-locked assets, streaming payments, automated lockup contracts, and more. The possibilities are endless.

IV. Token / Governance

Which features of your app require governance, if any? And how do you expect that governance to be conducted?
Croncat is a DAO running on DAO DAO. As mentioned earlier, there is a Swiss entity set up for this, which will help pay regular/security bounties, payroll, and other administrative tasks. It will also serve as a gathering point for the various parts of the Croncat community — particularly those running agents — to make their voices heard.

The Croncat manager smart contract has a rather exhaustive set of configurations that can be set by an owner account, which will be the DAO, so the agents can help set the parameters of their work. For instance, we believe that to incentivize agents to participate, we should offer some baseline of income. But these incentives would likely be too small if there were, say, 1,000 agents for 500 tasks. Therefore, we have set a ratio of minimum tasks per agent, and we don’t allow new agents to become active if there aren’t enough tasks. We believe this effort is what the agent community will want; however, we have also received feedback that such artificial scarcity might be undesirable. We will use the DAO to garner support for changing this configuration setting as well as others.

Will you have a token?
A token is not in the plans, no. Croncat is a public utility for the new world, and a token would complicate the path to becoming an SDK module or something similar.

V. Roadmap & Additional Features

What is the timeline for the features you’ve already described?
Croncat expects to have a DAO payroll implemented and working (perhaps with a few trusted agents at first) by early-to-mid September, 2022. We would like to have basic token swaps on Osmosis available and live on mainnet for Cosmoverse Medellin, in late September.

After you launch your mainnet / minimum viable product, what are your plans for next steps, additional features, etc.?
Since we’re focusing mostly on Bank and Wasm Execute Messages at the moment, there are plenty of other Messages to work on and battle-test. We also believe there are very interesting use cases that involve using the Fee Grant and Authz modules, but we will leave that for future iterations.

If you haven’t already covered it, where do you see your project long-term?
The largest Cosmos chains could all use Croncat’s decentralized, scheduled transactions. Given the use cases highlighted earlier, the first three no-brainer chains would be Osmosis, Juno, and Stargaze. Longer term, our efforts may move to a module (using EndBlock, for instance), but this will depend on how the prospect of code pinning goes, and what we learn from real usage.

Where do you see Osmosis and the Cosmos in the next few years?
This is a fascinating time in web3 history where there are great ideas emerging from layer 1 and layer 2 blockchains. It is axiomatic that things in crypto change very quickly, and we must all adapt on the fly, borrowing the best patterns and improving them. We believe that Cosmos appchains offer the best environment for this fast, flexible, iterative approach.