# Getting Started

The official TimeSeal Documentation

<figure><img src="https://843227706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOYSlOvO7ifrrMBjd2mML%2Fuploads%2FoGXqVbHJJJs6espSpxrA%2Fimage.png?alt=media&amp;token=e1578617-6cc8-42db-acb2-cb8f30d876ed" alt=""><figcaption></figcaption></figure>


# The API

Welcome to the TimeSeal API documentation! This guide will help you integrate and utilize the powerful features of the TimeSeal service seamlessly.

### Getting Started

Before you start using the TimeSeal API, you'll need to sign up for an account and obtain an API key. Follow these steps to get started:

1. **Sign up**: If you haven't done so already, go to the TimeSeal website ([https://www.timeseal.com](https://www.timeseal.com/)) and create a new account. After successful registration, you'll be taken to the dashboard.
2. When you create a new project, an API key specific to that project will be provided to you.
3. **Authentication**: All API requests require authentication using your API key. You need to include the API key in the `Authorization` header of your HTTP requests.

   Example:

   ```makefile
   Authorization: Bearer YOUR_API_KEY
   ```
4. **Base URL**: The base URL for all API endpoints is `https://api.timeseal.com`.


# timeseal

Documentation for /timeseal endpoint

### Overview

The `/timestamp` endpoint is a part of our blockchain-based timestamping API that allows you to securely timestamp data on the blockchain. Timestamping data on the blockchain ensures the immutability and tamper-proof nature of the data, providing strong evidence of the data's existence and integrity at a specific point in time.

To access the `/timestamp` endpoint, you need a valid API key, the data you want to timestamp, and the type of change you are making to the data. The API will then process your request, generate a cryptographic hash of the data, and record it as a timestamp on the designated blockchain.

### Request Parameters

The `/timestamp` endpoint requires the following parameters in the request body:

#### `data` (string, required)

The data you want to timestamp on the blockchain. It can be any string or JSON data representing the information you want to store.

#### `type` (string, required)

The type of change you are making to the data. This parameter helps in categorizing different types of updates to the data. Examples of type include "create," "update," or "delete". This information is not stored on the blockchain and is only used as metadata.

### Example Request

```javascript
await axios.post(
  "https://api.timeseal.com/v1/timestamp",
  { data: "{inventoryItems: 5}", type: "created" },
  { 
    headers: { 
      apiKey: process.env.TIMESEAL_API_KEY
    }
  },
);

```

### Response

The API will respond with a JSON object containing the timestamping details.

#### Example Response

```json
{
    "status": "success",
    "msg": "operation completed successfully !",
    "txIds": [
        {
            "txId": "cb8f8e8c2116dd7177a63b5726dbaed332c37691bd5045d1855c6d7f9f81d53e",
            "url": "B://cb8f8e8c2116dd7177a63b5726dbaed332c37691bd5045d1855c6d7f9f81d53e"
        }
    ],
    "errors": []
}
```

* `status` (string): Indicates the status of the operation. Possible values are "success", "error" or other relevant status indicators.
* `msg` (string): A human-readable message providing information about the outcome of the operation.
* `txIds` (array): An array containing objects with information about transaction IDs and their corresponding URLs.
  * `txId` (string): The unique identifier for a transaction.
  * `url` (string): The URL associated with the transaction ID, typically in the format "B://txId".
* `errors` (array): An array that may contain error objects if there were issues during the operation. Each error object should provide relevant information about the error.

{% hint style="warning" %}

### Warning

Please be advised that when utilizing our services, all data is stored as-is on the blockchain. It is essential to recognize that information stored on the blockchain is publicly visible and can be accessed by anyone. Therefore, we strongly recommend encrypting any sensitive or private data before storing it on the blockchain. Failing to do so may expose your confidential information to unintended parties. By using our service, you acknowledge the inherent risks associated with the transparency of blockchain technology, and you bear the responsibility to take appropriate measures to protect your privacy.
{% endhint %}


# The SDK

For native integrations

## TimeSeal SDK

Welcome to the TimeSeal SDK documentation! TimeSeal SDKs help you seamless connect your new or existing application with TimeSeal

#### Prerequisites

Before you start using TimeSeal SDK, ensure you have the following prerequisites in place:

1. **TimeSeal Account**: Sign up for a TimeSeal account at <http://www.timeseal.com>
2. **API Key**: Obtain an API key from your TimeSeal account dashboard.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td>Javascript SDK</td><td></td><td><a href="/the-sdk/javascript">Javascript</a></td></tr><tr><td></td><td>Python SDK</td><td></td><td><a href="/the-sdk/python">Python</a></td></tr><tr><td></td><td></td><td></td><td></td></tr></tbody></table>


# Javascript

TimeSeal Javascript SDK

The TimeSeal Node.js SDK allows you to easily integrate TimeSeal's API into your Node.js applications. This documentation provides an overview of how to install the SDK, authenticate using your API key, and make requests to the TimeSeal API endpoints.

### Installation

You can install the TimeSeal Node.js SDK using npm, the Node.js package manager. Open a terminal and run the following command:

```bash
npm install timeseal-sdk
```

### Usage

1. Import the TimeSeal SDK and configure it with your API key.

```javascript
const TimesealSDK = require('timeseal-sdk');

const config = {
    apikey: process.env.TIMESEAL_API_KEY,
};

const timeseal = new TimesealSDK(config);
```

2. Make API requests using the Timeseal SDK.

```javascript
const response = await timeseal.Timeseal.v1.timeseal({
    data: "test",
    type: "create",
});
```

### API Reference

#### `timeseal.Timeseal.v1.timeseal(options)`

This method sends a request to create a TimeSeal for the specified data.

* `options` (object): An object containing the request parameters.
  * `data` (string): The data to be TimeSealed.
  * `type` (string): The type of operation. Can be `create`, `update` or `delete`

Returns a Promise that resolves to the API response.

### Conclusion

The TimeSeal Node.js SDK provides a simple way to interact with the TimeSeal API using Node.js applications. By following the installation and usage instructions, you can seamlessly integrate timesealing functionality into your projects. For more information about the TimeSeal API endpoints and features, refer to the official [TimeSeal API documentation.](/the-api)


# Python

The official Python SDK

Coming Soon


# Extensions

Integrations made easy

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td></td><td>Firebase Extension</td><td></td><td><a href="/extensions/firebase">Firebase</a></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></tbody></table>


# Firebase

TimeSeal Firebase Extension

### Requirements

Before installing the TimeSeal Firebase Extension, you must have:

1. A Firebase project: If you don't have one, you can create it on the Firebase console.
2. Billing enabled: TimeSeal's Firebase Extension is a paid service, and you must have billing enabled for your Firebase project.
3. Firebase Firestore: Your Firebase project must be using Firestore for data storage.
4. Firebase Functions: Your Firebase project must firebase functions enabled.

Once you have completed these steps, you're ready to install the TimeSeal Firebase Extension. Please proceed to the installation guide (INSTALL.md) for further instructions.

### Configuring TimeSeal

To use the TimeSeal Firebase Extension, you need a TimeSeal API key. If you haven't obtained this yet, follow these steps:

1. Sign in to your TimeSeal account.
2. Create a new project within your TimeSeal dashboard.
3. After creating the project, you will receive an API key. Make sure to store this key securely.

### Setting up the Firebase Extension

With your API key, you can now configure the TimeSeal Firebase Extension in your Firebase project:

1. Navigate to the "Extensions" page in your Firebase console.
2. Find the TimeSeal extension and click on "Configure".
3. In the configuration options, enter your TimeSeal API key.
4. Save your changes.

### Specifying Collections and Fields

In the extension configuration, you also need to specify which Firestore collection(s) and fields you want to timestamp:

1. In the configuration options, find the "Collection" input field.
2. Enter the name of the Firestore collection you want to timestamp.
3. In the "Fields" input field, enter the names of the fields you want to timestamp, separated by commas.
4. Save your changes.

### Choosing Storage Method

TimeSeal provides several storage methods for your timestamps: fully onchain, hashed, salted-hash, and encrypted. To choose your preferred method:

1. In the configuration options, find the "Storage Method" dropdown menu.
2. Select your desired encryption method from the dropdown.
3. Save your changes.

With these settings, TimeSeal will automatically add timestamps to the specified fields in the specified collection, using your chosen encryption method.


# TimeSeal

Function and beyond

In the fast-paced world of artificial intelligence (AI), ensuring the integrity and authenticity of data is paramount. Data serves as the lifeblood of AI systems, driving their learning processes and fundamentally shaping their outcomes. As such, the introduction of TimeSeal—a blockchain-based method for storing timestamps—represents a significant advancement in securing data integrity. This technology offers unique benefits that make it a vital tool for ensuring reliable and accountable AI operations.

Blockchain's core attribute, its immutable nature, lends itself to the fundamental strength of TimeSeal. Once a timestamp is written to the blockchain, it cannot be altered or tampered with, providing an indelible record of when the data was created or modified. This feature is crucial in the realm of AI where accurate data tracking and verification are key to maintaining the integrity of AI models.

A consistent and immutable timestamping system like TimeSeal is especially important for training machine learning models. These models learn and adapt based on the data they receive, making it critical to understand the sequence and timing of the data inputs. If the timestamps associated with the data could be changed after the fact, it could potentially allow malicious actors to manipulate the model's learning process and thus, its outcome. With TimeSeal, every data point is timestamped and recorded on the blockchain, preventing any post-hoc alterations and safeguarding the integrity of the model's training process.

Furthermore, TimeSeal's application is pivotal in data auditing in AI systems. It allows for a transparent, traceable chain of data handling, ensuring that all the inputs fed into an AI model can be accounted for accurately. In sectors like healthcare or finance where AI applications are used for critical decision-making, the ability to audit and verify data trails is crucial. TimeSeal's unalterable timestamping mechanism facilitates this, enhancing trust and accountability in AI applications.

Moreover, the immutability and transparency of TimeSeal can significantly aid in AI model reproducibility. Reproducibility is a persistent challenge in AI, where researchers often struggle to recreate the results of others' models due to discrepancies in data handling. The TimeSeal technology can effectively track and record every data point used in an AI model, making it easier for others to follow the same path and reproduce the results, thus fostering collaborative and reliable AI research.

Lastly, in an era where privacy regulations and ethical considerations are gaining prominence, TimeSeal can help demonstrate compliance by providing an immutable record of when data was accessed or modified. This could be particularly useful in the context of the 'right to be forgotten' in data protection regulations, where it is crucial to prove that certain data has been deleted at a specific point in time.

In summary, TimeSeal serves as a powerful tool for enhancing data integrity, transparency, and accountability in AI systems. By providing an unalterable and secure method of timestamping data, it helps mitigate risks associated with data tampering, enhances auditing capabilities, promotes reproducibility in AI research, and supports compliance with data protection regulations. As the AI landscape continues to evolve, technologies like TimeSeal will undoubtedly play a pivotal role in ensuring that development and applications of AI are trustworthy and reliable.


# Types

"TimeSealing" represents a novel approach to ensuring data integrity, privacy, and security in distributed systems, leveraging the power of blockchain technology. Each database row or document is individually hashed in this method, with the computed hash being stored on the blockchain for later verification. This is known as the "Hashed" variant of TimeSealing.

The Hashed variant of TimeSealing serves as a fundamental approach to preserving the integrity of data transactions. By creating a unique hash for each database row or document, and subsequently storing it on the blockchain, the authenticity of each transaction can be retrospectively validated. This feature is an integral part of any robust data management solution in distributed systems, as it provides an immutable log of data transactions. The hashed variant is typically recommended for its balance between data security and bundle size, particularly when dealing with sufficiently long rows or documents.

However, for data with enhanced privacy requirements, the Salted-Hashed variant of TimeSealing might be preferable. In this approach, an extra key—referred to as a 'salt'—is included in the hashing process. This additional step significantly increases the complexity of the hash, making it nearly impossible for hash tables to decrypt the original data entries. Nevertheless, this method presents a slight complication: to verify that a piece of data and its corresponding hash belong together, the salt must be disclosed. This requirement can potentially make the Salted-Hashed variant less attractive, depending on the specific privacy needs.

For the highest level of transparency and decentralization, the Fully Onchain variant of TimeSealing is available. This method involves uploading complete database entries to the blockchain, which facilitates the sharing of data across different entities. Furthermore, this option provides a mechanism for the creation of blockchain-based non-fungible tokens (NFTs) and layer-2 tokens, similar to ordinary tokens. However, due to the public nature of blockchain, this method is best suited for data that can be freely accessed by the general public, thereby limiting its usage to specific types of transactions.

Finally, the Encrypted variant of TimeSealing takes data security to the next level by encrypting data with a user-specified security key before sealing it on the blockchain. Utilizing the AES256 encryption standard, this method enables data to be fully stored on the blockchain while ensuring that only parties with the correct encryption key can access it. This variant is particularly suitable for scenarios where sensitive data needs to be shared among a specific group of users, providing a high level of security and privacy.

Each of these TimeSealing variants offers unique benefits, allowing users to select the most suitable option based on their specific requirements concerning data integrity, privacy, security, and decentralization. As the use of blockchain technology continues to grow, the need for such robust and flexible data management solutions will only increase. TimeSealing represents an innovative step towards addressing this need.

<figure><img src="https://843227706-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOYSlOvO7ifrrMBjd2mML%2Fuploads%2FBkoSDSHWGkxUULsxRGkd%2Fimage.png?alt=media&amp;token=40bb8804-4191-4185-8bd5-abaf77050507" alt=""><figcaption></figcaption></figure>

### **Summary**

**Hashed** is the most common (and recommended) variant of TimeSealing, ensuring small data bundles while ensuring user privacy. Each database row/document gets individually hashed and the hash stored onchain. Later, the hash can be compared against the actual entries to verify authenticity.

**Salted-Hashed** is a more secure variant of hashed, where an additional key is added in the hashing process to ensure hash tables won't identify clear text entries. The downside is that it requires revealing the given key to prove that data and hash belong together. As long as rows/documents are sufficiently long, we recommend Hashed over Salted-Hashed, while specifically privacy-relevant data should be Salted-Hashed. \
\
**Fully Onchain** uploads complete database entries to the blockchain to offer decentralized database entries shared between entities. The option even allows to create onchain NFTs (similar to ordinals tokens) and L2 tokens. While this is the most powerful variant of TimeSealing, it is often limited to public entries that are fine to stay on the public blockchain, readable for everyone.

**Encrypted** variant is a fully onchain TimeSeal encrypted with a user-picked security key. We use an AES256 encryption method to encrypt the data, which allows having data fully onchain and shareable between parties. Those mutual parties can only see the data with shared encryption keys.


# Pricing

Our Pricing:\
\
25,000 TimeSeals/Month for free and afterwards 1$ per 100,000 TimeSeals. (See more on the price plan page). We keep TimeSeal hyper-competitive as one of the few services that TimeStamp each and every entry on-chain, and moreover allow raw data to be written directly to the chain.


# FAQ

Find answers to some of the most frequently asked questions about TimeSeal

### What is TimeSeal?

TimeSeal is a robust tool designed to uphold data integrity in databases using blockchain technology. By attaching a unique timestamp to each data entry, TimeSeal ensures an accurate record of when the data was created or modified. This process results in a transparent, tamper-proof, and easily verifiable record of all data transactions, providing an extra layer of security and accountability.

### How does TimeSeal ensure the security and integrity of my data?

TimeSeal leverages blockchain technology to ensure the security and integrity of your data. Each new database entry is assigned a unique, unalterable timestamp, which gets written into the blockchain. This produces a tamper-proof, chronologically accurate trail of your data. The cryptographic nature of blockchain technology makes it practically impossible to modify the recorded data retroactively, hence ensuring your data's security and integrity.

### Can I use TimeSeal with my existing database?

Yes, TimeSeal is designed to seamlessly integrate with various existing databases. Its implementation is conveniently streamlined to offer a plug-and-play experience. All you need is to obtain your unique API key, add it to the TimeSeal extension or plugin, and TimeSeal takes care of the rest. The tool will then automatically timestamp and seal every new entry added to your database, fortifying your data management system with an additional layer of security and immutability.


