Trigger your canister to run periodically, on a schedule, or at any time you designate in the future! Built front to back in Typescript.

Inspiration

Internet Computer, by being compute-first, allows functionality that is outside the boundaries of what a data-first blockchain like EVM is capable of. The idea of being self-running - literally unstoppable - is unique and possible through the heartbeat core function. But that function is expensive and kinda hard to use!

At the same time, we were blown away by Azle. This lets one build with all the speed and familiarity of Typescript while compiling to the WASM that IC requires for its code.

There was an opportunity to make a unique IC capability uniquely easy as a service to people making dynamic, decentralized apps. We can imagine use cases across many categories:

  • SocialFi: DAO governance that acts on the common will after votes by using a time certain for the election. Then the autonomous organization can execute without requiring human intervention.
  • GameFi: Multiplayer games that move their common world forward independent of individual player actions. For example, a battle royale style gameplay could keep changing the map on a regular basis to keep the intensity of gameplay.
  • Metaverse: Autonmous Metaverse NFTs that "behave" even when the user is not around, perhaps even reacting to special events (birthdays, holidays etc)
  • DeFi: Time-limited asynchronous market orders that execute or expire a certain period after going in
  • Public Good: Dead-man-switches that activate certain actions when a user does not otherwise specify "stop" beforehand, releasing information or executing actions to protect protesters. (Messages are cancellable).
  • Blue Sky: Skynet's origin from Terminator 3

What it does

DeTi makes Internet Computers autonomous. DeTi is a decentralized cron scheduling service that will fire off a message to a designated canister on a specific function endpoint on a schedule or at a time designated by the user. We wrangled the date work so you would not have to: run your function every day at 5pm. Or every Tuesday at 9:23pm. Maybe just once next Saturday at 11. No matter your scheduling needs, you can compose them using DeTi.

With DeTi, unstoppable canisters become unstoppable robots. Come try it out. We are offering free DeTi tokens during Supernova. You can check out DeTi out here: https://fl5mh-daaaa-aaaap-qalja-cai.ic0.app/ and its reference implementation here: https://d7hzd-wiaaa-aaaap-qamba-cai.ic0.app/

How we built it

We used the experimental Azle TypeScript-based WASM compiler. We learned a ton about how this transpilation works and where the limits are for expressing one's intent using Typescript. We implemented stable storage, pre/post upgrade continuity for dynamically keyed mappings, and a whole new library for figuring out dates and time based on the IC timestamp. Finally, we implemented the internal accounting token as a DIP20-compatible interface to make it easy to operate and store value for future use.

We made our front-end using React (via create-react-app), Tailwind CSS, and React Router. These tools let us build the whole sophisticated app using one language. We think this will be much easier for other people to understand as they look for references on their IC development journey.

Challenges and Accomplishments

The IC Factor We wanted to focus on an aspect of IC that is different from other blockchain technologies. The focus on unstoppability and advancing to autonomy is very IC and very much unlike other distributed ledger systems. IC can not just record - it can behave.

Social Utility: We're proud of figuring out a path to make the heartbeat more economical as a means of activating IC Canisters. Slowing the main check allows us to manage the vast majority of scheduling use cases while keeping cycle usage in check.

Technical Accomplishment: We are also proud of making Azle work in a nontrivial application. The system is wonderful but, like the whole IC ecosystem, very much in development, and figuring out where the quirks were was a technical challenge. But a worthwhile one!

Giving Back Finally, being able to leave behind tools for the community furthers our own idea of how we want to contribute to the blockchain community. We've spun out a couple of tools to help the community that are based on the work we did here:

  • usePlug makes it easy to integrate the plug wallet into a React App. It exposes a simple provider pattern and is implemented completely in Typescript to make it easy to work with. This repository now uses this tool, so it can be a reference implementation.
  • [azle-react-template](https://github.com/rhdeck/azle-react-template`] is a GitHub template repository designed to make it easy for people to The NPM package and template are a start and we hope that they will allow others to make progress more quickly.

And we hope they do it with Azle!

What we learned

We learned that Internet Computer is very different from the other blockchain work we have done! The many chains involved, the semi-private way data is handled, and the complexity of working with a WASM runtime were all new to the team.

We learned to be patient with Azle - the opportunities are enormous, but it rewards careful, try-build-deploy approaches to extension as we learn how it interacts with the underlying Rust systems.

And we learned that the potential of these technologies is ahead of us. We're excited about the future of Internet Computer. DeTi can send us a reminder to celebrate that progress down the road.

What's next for DeTi: Decentralized Time Travel

We would love to continue to work on this project, which we think would be helpful to a number of projects that are about the unique capabilities of IC.

  • Putting on SNS when it is available
  • Passing custom arguments to the scheduled messages
  • Allow agents - make a canister able to self-schedule using another's pulse account, all from code
  • Add DETI to a DEX for easier liquidity
  • Support identification and wallet software beyond Plug (as cool as it is!)
  • Add payment-based DETI minting
  • Increase the robustness of DETI to handle scale and be more unstoppable by moving across subnets.

We're looking forward to making DETI the best way for internet computers to reach into the future.

Thanks

We are grateful to the DFINITY Foundation, Demergent Labs, Psychedelic Studios, and Jordan Last personally for the amazing resources they've published and helpful answers on the DFINITY discord. This hackathon exposed us to this very cool and different blockchain technology, and we are grateful for it.

Built With

+ 20 more
Share this project:

Updates