Using Timeleap Just Became Easier!

Earlier this month we released the first version of the TEP-1: Timeleap Plugins. We published an early article to show you how to create your first Timeleap plugin with TEP-1. Since then we've made major updates to Timeleap, and we've released numerous dev tools to make it easier to work with Timeleap.

Let's see how the new changes affect the process of creating a Timeleap plugin, and also interacting with them.

Sia Low-Level API

Sia is the serialization format at the heart of Timeleap. We tried many alternatives, but none of them satisfied the needs of our project. JSON, while widely used, is slow, and not suitable for binary data. We tried MessagePack but we hit compatibility issues between different languages early on. Cap'n Proto isn't well supported, and Protobuf is too complex for our needs.

Sia is made specifically for remote procedure calls (RPCs) and is designed to be fast, efficient, and easy to use. It's a binary format that's easy to parse and serialize. It's so lightweight you can port it to your favorite language in a few hours. We've already ported it to TypeScript, Python, and Go.

Serializing an object in Sia, looks like this:

While this gives us a lot of control, and gives us the best possible performance, it can easily become cumbersome. To make it easier to work with Sia, we've created a high-level API that abstracts away the low-level details. This makes it easier to work with Sia in your projects.

What we did was making a schema language for Sia, together with a compiler to generate the necessary code for you. This way, you can define your data structures in a schema file, and generate the necessary code for your project. We've made the compiler with support for multiple code targets and languages in mind.

For example, the above low-level code can be written in the high-level API like this:

Then in TypeScript:

And you're done!

Timeleap Client

Previously, users needed to create the binary payload for each RPC call manually. Then they had to sign the payload, and append the signature to it. They also had to establish a connection to the broker, send the payload, wait for a response, remap the response ID to the request ID, and finally parse the response.

That's too much work. We've made it easier by creating a high-level client and wallet API for Timeleap. This way, you can connect to the broker, send RPC calls, and receive responses with just a few lines of code.

The client takes care of mapping the response ID to the request ID, and the wallet takes care of signing the payload. Not only this makes it easier to connect and interact with Timeleap, but it also means there will be less user errors.

RPC Calls with Sia Schema

We also added support for defining RPC calls in Sia schema. This way, you can just define an interface to your plugin in the schema file, and users will be able to generate bindings for it for their favorite language. For example, the demo plugin in the TEP examples repository has the following schema:

Then in TypeScript, for example:

Without Sia schema the above could look like this:

Publishable Plugins

Sia schema also allows you to define metadata for your plugin. This way, you can publish your plugin to the Timeleap plugin marketplace, and users will be able to see the metadata of your plugin.

With a schema, users will be able to add your plugin to their project by running a simple command. For example, if you have a plugin for generative AI or a plugin for image processing, users will be able to add your plugin to their website, or their mobile app, with a single command.

Conclusion

We've made it easier to work with Timeleap by adding a high-level API for Sia, and by adding support for defining RPC calls in the Sia schema. This way, you can define your data structures and RPC calls in a schema file, and generate the necessary code for your project.

This prompts code reuse, and makes it easier to publish your plugins to the builder community. We're excited to see what you'll build with Timeleap, and we can't wait to see your plugins in the Timeleap plugin marketplace.

Pouya Eghbali

Pouya Eghbali

2025-01-31

Founder & CEO at Timeleap

How was this page?

Timeleap SA.

Pl. de l'Industrie 2, 1180 Rolle, Switzerland

Logo

Social Media

Tokenomics

Info