Space and Time API Gateway
What it is and why we built it
The application stack is composed of three core components: the frontend, the backend, and the database. The frontend provides the UI/UX, the backend handles the logic of the app, and the database stores and retrieves data. In a decentralized application, a smart contract acts as the backend (holding the logic) and the blockchain acts as the database. But the blockchain is extremely limited in the amount of data it can store, and smart contracts are extremely limited in the logic they can execute. As a result, developers also deploy a database and a backend to power their dapp alongside their smart contract.
A decentralized application is not really decentralized if it’s built on a centralized backend and database. Space and Time has not only built the first decentralized data warehouse, powering both analytics and applications and scale, we also provide a built-in API gateway operated by our decentralized network. The Space and Time gateway provides all the APIs you need to build scalable, data-driven dapps, so that you don’t have to manage your own backend infrastructure or rely on a centralized solution.
How it works
Data APIs
The Space and Time API Gateway at its core enables interaction with your data in the platform. Our SQL APIs enable users to perform operations like creating tables, inserting/updating/deleting data, and querying data. Using the SQL API, users can rapidly onboard by interacting with the platform using traditional SQL syntax. Through the Resource Discovery APIs, users can easily gain a better understanding of what all resources exist in the platform as well as the metadata surrounding them (e.g., you can see what all tables comprise the Ethereum blockchain dataset as well as what columns each table has and foreign key relationships between them). Lastly, through our View APIs, users can construct a unique API endpoint from which they can execute common queries, improving performance and facilitating future development of the underlying SQL as independent from the API request referencing it. Users can even construct parameterized views, which are views that accept parameters at runtime (effectively query templates).
Streaming
The Space and Time streaming solution enables users to leverage Kafka for high-volume data streams directly into their table(s). We provide a suite of configuration APIs that allows users to set up their own Kafka topics so they can bootstrap their producers and begin using Space and Time as a sink for their data. In addition, we provide a powerful JSON-based configuration design from which users can describe how the data in their Kafka records should be ingested, providing their implementation and letting the platform handle the rest.
Supporting Services
Besides providing an easy method for users to get data into and out of the platform, the gateway actually performs many more functions behind the scenes. To name a few, the gateway ensures data is available and consistent, orchestrating the replication of user data across multiple replicas and transparently rerouting requests in case it detects a failure of the active replica. Another core feature of the gateway is keeping track of all resources in the network, assigning new resources to data warehouse clusters with more available space and compute as well as migrating data to ensure even usage of all clusters. Lastly, the gateway enables proof verification to support Proof of SQL. As data passes through the gateway on its way to a data warehouse, proof data is constructed and stored. Later, when a tamperproof query is executed, this stored proof data is retrieved and used to verify the proof constructed by the data warehouse.
What it enables
With Space and Time, developers don’t have to choose between managing their own backend infra and relying on a centralized backend solution. Space and Time is both your database and your decentralized, serverless backend. To build a dapp on Space and Time, all you have to do is deploy your frontend and your smart contract. We handle the rest.