# &#x20;Welcome to uProofs

## Introduction <a href="#f3477eeb-d8c7-42dd-a880-faa5f0197cb5" id="f3477eeb-d8c7-42dd-a880-faa5f0197cb5"></a>

"uProofs" is a Software as a Service platform API-First for creating, issuing, viewing, and verifying blockchain-based proofs.

See an example of Universal Proof: [https://uproofs.apio.cc/proofs/timestamp/8e18e5a8-d564-40a3-9083-5a25b51bb1f6](https://uproofs.apio.cc/proofs/timestamp/01d1b684-f819-4558-a877-dd7e7dcf080d)

### Why Blockchain-based proofs <a href="#id-5ec4ef36-e21c-40a2-a254-cf73e327b081" id="id-5ec4ef36-e21c-40a2-a254-cf73e327b081"></a>

uProofs It’s the easiest, fastest way to create blockchain based proofs, aka Universal Proofs. Universal Proofs can be tamperproof, timestamped and easy to validate. Universal Proofs can be used to prove a statement of impact, sensors data, provenance, certifications and so on.

### Why xDai?

We use xDai public Blockchain because:\
✅ Fast transaction times (5 seconds) & low transaction fees\
✅ Stable chain ideal for real world value exchange where 1 xDai = 1 US Dollar.\
✅ A stable token for transactions & gas fees.\
✅ A green, energy-efficient and [ecologically aware](https://www.xdaichain.com/about-xdai/news-and-information/xdai-energy-efficiency) blockchain network.\
✅ Permissionless delegated Proof-Of-Stake based consensus with public [POSDAO](https://www.xdaichain.com/for-validators/posdao-whitepaper).\
✅ Full-featured  [BlockScout Explorer](https://blockscout.com/xdai/mainnet).

## Getting started <a href="#deecbc76-4348-494c-bc46-8d4f208879f2" id="deecbc76-4348-494c-bc46-8d4f208879f2"></a>

It follows the steps to be up and running with Trusty Proofs:

* Register on Trusty Proofs: <https://dashboard.uproofs.apio.cc>
* Obtain an API KEY

When you have the API KEY you can use the REST API. We suggest you to go deeper with the following tutorial.


# Contact Information

For any additional information, please contact us at <info@apio.cc>


# From 0 to 1

## General Information

### 🔗 BASE URL <a href="#id-815f8d14-8bc7-45ee-a937-263ea95ce04c" id="id-815f8d14-8bc7-45ee-a937-263ea95ce04c"></a>

<https://api.uproofs.apio.cc>

### 🔑 AUTHORIZATION <a href="#id-92d53a87-456d-4ef9-98b5-bca0930faf16" id="id-92d53a87-456d-4ef9-98b5-bca0930faf16"></a>

You can use your API KEY putting it inside the header

```
"Authorization": "apikey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
```

## 👤 Create an Identity

### Description

This is the first endpoint to call, it generates the company and also the public and private key for the user, it is inserted in default identity and it will be used to send transaction to blockchain network. The default identity is an Ethereum Public and Private Key, this identity can be used on several network for example xDai, Ethereum Mainnet, Quorum, Artis and others Ethereum Codebase Blockchain.

{% hint style="info" %}
The ***private key*** is encrypted with the API KEY and the API KEY is not saved in our database, there is only the md5 hash on database.
{% endhint %}

### Request

#### ENDPOINT

```http
POST "/identity"
```

#### BODY REQUEST <a href="#d631f37b-e6c4-4632-88b6-9f9420e16390" id="d631f37b-e6c4-4632-88b6-9f9420e16390"></a>

```javascript
{
	"company":{
		"name": "ACME S.p.A.",
		"domain": "acme.it"
	}
}
```

## 🖼️ Create an Asset <a href="#id-74c23a82-5a96-41a4-9c05-52fd739ada44" id="id-74c23a82-5a96-41a4-9c05-52fd739ada44"></a>

### Description

An asset is the template for a series of proofs, for example if you want to certify Internet of Things data you can create an asset and use it to certify sensors data, several assets can be useful to create separate streams of proofs.

{% hint style="danger" %}
In the future we will develop several application on several Blockchain but at the moment it's only available:

* Type: ***JSON***
* Application: ***timestamp*** useful to certify JSON data
* Blockchain: ***xDai*** Proof of Stake public blockchain
  {% endhint %}

### Request

#### ENDPOINT <a href="#id-879d2c59-6b7d-430d-a535-f5f90115962c" id="id-879d2c59-6b7d-430d-a535-f5f90115962c"></a>

```
POST "/assets"
```

#### BODY <a href="#f79b08cb-cbc9-44b8-8e7f-7a4ab473802b" id="f79b08cb-cbc9-44b8-8e7f-7a4ab473802b"></a>

```javascript
{
	"type": "JSON",
	"name": "Asset Name",
	"application": "timestamp",
	"description": "Assets Description",
	"backgroundImage": "url_image",
	"blockchain": "xDai"
}
```

## 🧾 Create a Proof <a href="#id-35a55955-4d4e-4926-a907-8d442dfc9525" id="id-35a55955-4d4e-4926-a907-8d442dfc9525"></a>

### Description

A proof is a core api, before create a proof you need to create an identity and asset because the proof will be signed with identity and receive from asset the structure for certification.

### Request

#### ENDPOINT <a href="#id-95fc742e-5597-4ac8-af87-2615b39f459d" id="id-95fc742e-5597-4ac8-af87-2615b39f459d"></a>

```
POST "/proofs"
```

#### BODY <a href="#dbd9fa12-17b5-4b33-a8f4-94f982ecdf12" id="dbd9fa12-17b5-4b33-a8f4-94f982ecdf12"></a>

```javascript
{
    "assetId": "fe602d7f-b807-4d65-bc29-23b4cea58bb7",
    "data": {
        "timestamp": "those",
        "data": "4ever"
    }
}
```

## 🔍 Verify with Trusty Proofs <a href="#dfdb509c-0193-49ac-b497-3a15b564e549" id="dfdb509c-0193-49ac-b497-3a15b564e549"></a>

This is an auto-generated page that can be used to demonstrate Proofs and Data. The following page is auto-generated for application ***timestamp.***

{% embed url="<https://uproofs.apio.cc/proofs/timestamp/01d1b684-f819-4558-a877-dd7e7dcf080d>" %}


# Encrypt data

## Abstract

When you use Public Blockchain, what you put in Blockchain is public. UPROOFS to guarantee data writes in Blockchain:

* UUID of the Proofs (that helps to recover the public page);
* HASH of the data packet (that helps to verify data timestamped).

Through Explorer someone can use the Smart Contract address to see all the data exchange through UPROOF. Here a screenshot of the list of Transaction made through UPROOFS:

![List of Transactions](https://2582885197-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-McVq2fQ-k_v186Ven9k%2F-Meeu-yEJ3zb6gaD44RD%2F-MeeyB3DJOTZV3ng0Sw8%2Fimage.png?alt=media\&token=c32e690e-7585-4bb4-80e1-ff74aa45939a)

Clicking on one transaction User can see the Transaction Details, here a screenshot:

![](https://2582885197-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-McVq2fQ-k_v186Ven9k%2F-Meeu-yEJ3zb6gaD44RD%2F-MeexX57qvlFiM9wIo9L%2Fimage.png?alt=media\&token=03116afc-0f45-43bd-bb1c-7c65bb25c636)

From here a User can use UUID to see proofs of other users. This is not a problem if data is public...

If you use UPROOFS to timestamp private data you can use Encrypt Functionalities.

## 🔐 How to Encrypt a Proof

You can insert password in your object to encrypt the proof

#### ENDPOINT <a href="#id-95fc742e-5597-4ac8-af87-2615b39f459d" id="id-95fc742e-5597-4ac8-af87-2615b39f459d"></a>

```
POST "/proofs"
```

#### BODY <a href="#dbd9fa12-17b5-4b33-a8f4-94f982ecdf12" id="dbd9fa12-17b5-4b33-a8f4-94f982ecdf12"></a>

```javascript
{
    "assetId": "fe602d7f-b807-4d65-bc29-23b4cea58bb7",
    "password": "12345",
    "data": {
        "timestamp": "those",
        "data": "4ever"
    }
}
```

## Verify an Encrypted Proof <a href="#dfdb509c-0193-49ac-b497-3a15b564e549" id="dfdb509c-0193-49ac-b497-3a15b564e549"></a>

Here the Encrypted Proof if the user cannot provide the password:

![](https://2582885197-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-McVq2fQ-k_v186Ven9k%2F-Meeu-yEJ3zb6gaD44RD%2F-MeeztXCuVzW__l49bcS%2Fimage.png?alt=media\&token=8dec03d8-33ea-4fd3-afc2-ee01255a4399)

If the user provide the password:

![](https://2582885197-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-McVq2fQ-k_v186Ven9k%2F-Meeu-yEJ3zb6gaD44RD%2F-Mef-N9pMdTr-5AzKmaX%2Fimage.png?alt=media\&token=b1db5f4a-9e62-4730-9617-010d710756ba)


# Subscriptions

## Get Subscriptions

<mark style="color:blue;">`GET`</mark> `https://api.uproofs.apio.cc/subscriptions`

This endpoint allows you to get information on your subscription

#### Headers

| Name           | Type   | Description                                               |
| -------------- | ------ | --------------------------------------------------------- |
| Authentication | string | You need to insert api key 🔑 . For Example "apikey 1234" |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{
    "status": true,
    "data": {
        "assets": "Number of Asset",
        "proofs": "Number of Proofs",
        "type": "standard",
        "stripeId": "XXXXX",
        "uuid": "XXXX",
        "createdAt": "2021-07-02T18:40:20.579Z",
        "updatedAt": "2021-07-14T16:56:28.758Z"
    }
}
```

{% endtab %}

{% tab title="401 Could not find a cake matching this query." %}

```
{
    "status": false,
    "error": {
        "statusCode": 401,
        "type": "Unauthorized",
        "message": "Missing authorization header",
        "name": "Unauthorized",
        "code": "Unauthorized"
    }
}
```

{% endtab %}
{% endtabs %}


# Identities

## Create Identity

<mark style="color:green;">`POST`</mark> `https://api.uproofs.apio.cc/identities`

#### Headers

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| Authentication | string | apikey      |

#### Request Body

| Name    | Type   | Description                                                      |
| ------- | ------ | ---------------------------------------------------------------- |
| company | object | Object that contain name and domain of your company or identity. |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Get Identity

<mark style="color:blue;">`GET`</mark> `https://api.uproofs.apio.cc/identities`

This endpoint allows you to get your registered identity

#### Headers

| Name           | Type   | Description                                                |
| -------------- | ------ | ---------------------------------------------------------- |
| Authentication | string | You need to insert your Api Key. For example "apikey 1234" |

{% tabs %}
{% tab title="200 Identity successfully retrieved." %}

```
{
    "status": true,
    "data": {
        "status": "disabled",
        "company": {
            "verified": false,
            "_id": "60df5d7f789d436a860f5447",
            "name": "APIO2 S.p.A.",
            "domain": "apio.cc"
        },
        "defaultIdentity": {
            "_id": "60df5d7f789d4307d60f5448",
            "publicKey": "0x6a2aa30c2910d1301622d5aabf05da7577c938fc",
            "encryptPrivate": {
                "_id": "60df5d7f789d43041a0f5449",
                "iv": "38a4e8d6255299136ed599b956c45f09",
                "content": "fb2bc7020bf8c40c38832eaeb608c30355bfac9a8302a365e94e3f63e523fdcb09543fd01427effbeb5c6f0f6317d43f7032a300dfee66cf2a07731cdcec1fd2"
            }
        },
        "accountId": "8fc9d70a-682a-4587-9793-985120613f04",
        "uuid": "0a8a3015-6401-418f-bd9c-83cccbb24964",
        "createdAt": "2021-07-02T18:39:59.505Z",
        "updatedAt": "2021-07-06T08:51:22.873Z"
    }
}
```

{% endtab %}

{% tab title="401 Wrong Api Key" %}

```
{
    "status": false,
    "error": {
        "statusCode": 401,
        "type": "Unauthorized",
        "message": "Missing authorization header",
        "name": "Unauthorized",
        "code": "Unauthorized"
    }
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
{
    "status": true,
    "data": {
    }
}

```

{% endtab %}
{% endtabs %}


# Assets

## Create an Asset

<mark style="color:green;">`POST`</mark> `https://api.uproofs.apio.cc/assets`

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | string | apikey YOUR\_API\_KEY |

#### Request Body

| Name        | Type   | Description        |
| ----------- | ------ | ------------------ |
| blockchain  | string | Blockchain Used    |
| description | string | Asset Description  |
| name        | string | Asset Name         |
| application | string | Application Type   |
| type        | string | Data Type expected |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": true,
    "data": {
        "type": "JSON",
        "application": "Timestamp",
        "name": "Dati ERP",
        "description": "Dati del ERP 123",
        "backgroundImage": "123",
        "blockchain": "xDai",
        "accountId": "8fc9d70a-682a-4587-9793-985120613f04",
        "uuid": "c6b24306-c08f-4dbd-896e-4baacd34abc8",
        "createdAt": "2021-07-14T17:28:12.624Z",
        "updatedAt": "2021-07-14T17:28:12.624Z"
    }
}
```

{% endtab %}
{% endtabs %}


# Proofs

## Create a Proofs

<mark style="color:green;">`POST`</mark> `https://api.uproofs.apio.cc/proofs`

#### Headers

| Name          | Type   | Description         |
| ------------- | ------ | ------------------- |
| Authorization | string | apikey YOUR\_APIKEY |

#### Request Body

| Name    | Type   | Description              |
| ------- | ------ | ------------------------ |
| data    | string | Data to timestamp        |
| assetId | string | UUID of REGISTERED ASSET |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": true,
    "data": {
        "assetId": "UUID",
        "data": {
            "temperature": "20",
            "humidity": "40",
            "energy": "100"
        },
        "dataHash": {
            "_id": "60ef2315f057add9d59c4e13",
            "input": "{\"temperature\":\"20\",\"humidity\":\"40\",\"energy\":\"100\"}",
            "hash": "de7a57c35e1067d6ea4b3eeb387676f1bc280f8a0662c29861a93f93b0974ed1",
            "hashAlgorithm": "SHA-256"
        },
        "uuid": "84049640-e08a-4310-bbe4-bd4e95c2b3e0",
        "publicUrl": "https://uproofs.apio.cc/proofs/timestamp/84049640-e08a-4310-bbe4-bd4e95c2b3e0",
        "blockchain": {
            "_id": "60ef2315f057ad0dd79c4e14",
            "xDai": {
                "_id": "60ef2315f057ad6c769c4e15",
                "explorer": "https://blockscout.com/xdai/mainnet/tx/",
                "publicKey": "0xc967b0a6a84c7f15527484401d5e361c36016e14",
                "transactionInformation": {
                    "transactionHash": "",
                    "status": "queued"
                }
            }
        },
        "createdAt": "2021-07-14T17:47:01.855Z",
        "updatedAt": "2021-07-14T17:47:01.855Z"
    }
}
```

{% endtab %}
{% endtabs %}

## GET a PROOFS

<mark style="color:blue;">`GET`</mark> `https://api.uproofs.apio.cc/proofs/:id`

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| password      | string | used if data are encrypted |
| Authorization | string | apikey YOUR\_APIKEY        |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": true,
    "data": {
        "assetId": "26ee345c-e645-485b-8605-785d4c8b33fc",
        "data": {
            "temperature": "20",
            "humidity": "40",
            "energy": "100"
        },
        "dataHash": {
            "_id": "60df5db1789d43ab320f5450",
            "input": "{\"temperature\":\"20\",\"humidity\":\"40\",\"energy\":\"100\"}",
            "hash": "de7a57c35e1067d6ea4b3eeb387676f1bc280f8a0662c29861a93f93b0974ed1",
            "hashAlgorithm": "SHA-256"
        },
        "uuid": "8e18e5a8-d564-40a3-9083-5a25b51bb1f6",
        "publicUrl": "https://uproofs.apio.cc/proofs/timestamp/8e18e5a8-d564-40a3-9083-5a25b51bb1f6",
        "blockchain": {
            "_id": "60df5db1789d4315450f5451",
            "xDai": {
                "_id": "60df5db1789d432fe30f5452",
                "explorer": "https://blockscout.com/xdai/mainnet/tx/0x73fcb101186e13113cf96d38df26598a614c80d6fa316729d73249a97af28267",
                "publicKey": "0x6a2aa30c2910d1301622d5aabf05da7577c938fc",
                "transactionInformation": {
                    "transactionHash": "0x73fcb101186e13113cf96d38df26598a614c80d6fa316729d73249a97af28267",
                    "transactionIndex": 18,
                    "blockHash": "0x64a9fd2761b82a8526411aeaee952877b1f68a988174fcf60a559f8ffbd32bba",
                    "blockNumber": 16878847,
                    "cumulativeGasUsed": 10581280,
                    "gasUsed": 23336,
                    "from": "0x6a2aa30c2910d1301622d5aabf05da7577c938fc",
                    "to": "0xb90dadb4c7eb29d0b1e5c5cc53285666be9cba0d",
                    "contractAddress": null,
                    "logs": [],
                    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                    "status": true,
                    "type": "0x0",
                    "timestamp": 1625251265000
                }
            }
        },
        "createdAt": "2021-07-02T18:40:49.444Z",
        "updatedAt": "2021-07-02T18:41:08.686Z"
    }
}
```

{% endtab %}
{% endtabs %}


