Skip to main content
European CommissionEBSI European Blockchain

Create a Timestamp

Timestamp API will help you to timestamp individual data, track document versions, and validate already existing timestamps.

This is achieved through two functionalities:

  • Timestamps: Designed for single-point-in-time data anchoring, offering an immutable record of your data's existence on the blockchain.
  • Records: Introduce an enhanced layer of traceability by timestamping various versions of a document under a single record identifier, providing a holistic view of its history.

Creating Timestamps: A Step-by-Step Guide

Load the keys of the legal entity

Command
==> using user ES256K did1 <LE_PRIVATE_KEY_ES256K> <LE_DID>
==> using user ES256 did1 <LE_PRIVATE_KEY_ES256> <LE_DID>

Now connect the wallet with the pilot environment:

Command
==> env pilot

Step 2. Request an access token

Request an access token to the authorisation API with the scope timestamp_write:

Command
==> resAuthTimestamp: authorisation auth timestamp_write_presentation ES256

Now load the access token:

Command
==> using token resAuthTimestamp.access_token

Step 3. Create a Timestamp

Interact with Timestamp API to timestamp some data:

Command
==> timestamp timestampHashes {"test": "some data"}
Output
{
"data": {
"test": "some data"
},
"id": "uEiAQjTSfJoekQZpuNe43jEm11_VFCSNagLOqsk81Tnf-aQ"
}

now you can check the timestamped data:

Command
==> timestamp get /timestamps/uEiAQjTSfJoekQZpuNe43jEm11_VFCSNagLOqsk81Tnf-aQ
Output
{
"hash": "mEiCFEY+9nffGmiCIEU1angy1JvIkLayCumzH2TfYLqCLDw",
"timestampedBy": "0xA4B6C8710f6bF233b8b480498916DEC224A5a891",
"blockNumber": 4024912,
"timestamp": "2023-12-15T16:49:09.000Z",
"data": "0x7b2274657374223a22736f6d652064617461227d",
"transactionHash": "0x19197878626e114811a4011d0d3ff432eaacbdd5eb37466f1b94f73ff03066de"
}
Congratulations!

You have timestamped data in Timestamp API

Records

With Timestamp API you can also create records containing a history of changes of a specific data. Let's see an example.

First let's create a new record with some data:

Command
==> timestamp timestampRecordHashes {"data": "my data"}
Output
Timestamp record hashes. Record Id:

{
"blockNumber": "0x3d6a55",
"recordId": "0x07b041928382a488c150840cd1c7a24f6b658a82d969961be831c820fd998842",
"multibase64urlRecordId": "uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI",
"hashValue": "0x37926887dc319ac87cda01caf411bccb9ab8933d97cf3c2d57d3e13aa8bad580"
}

Now let's timestamp new data using this record ID:

Command
==> timestamp timestampRecordVersionHashes 0x07b041928382a488c150840cd1c7a24f6b658a82d969961be831c820fd998842 {"data": "my data updated"}

Now get the versions stored in the record:

Command
==> timestamp get /records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI
Output
{
"ownerIds": ["0xa4b6c8710f6bf233b8b480498916dec224a5a891"],
"revokedOwnerIds": [],
"firstVersionTimestamps": [
"0x37926887dc319ac87cda01caf411bccb9ab8933d97cf3c2d57d3e13aa8bad580"
],
"lastVersionTimestamps": [
"0x66f27c170fb85e96b253673d035214528929f952424d0e5ab4125f4172d6c696"
],
"totalVersions": 2
}
Command
==> timestamp get /records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions
Output
{
"self": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions?page[after]=1&page[size]=10",
"items": [
{
"versionId": 0,
"href": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions/0"
},
{
"versionId": 1,
"href": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions/1"
}
],
"total": 2,
"pageSize": 10,
"links": {
"first": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions?page[after]=1&page[size]=10",
"prev": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions?page[after]=1&page[size]=10",
"next": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions?page[after]=1&page[size]=10",
"last": "https://api-pilot.ebsi.eu/timestamp/v4/records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions?page[after]=1&page[size]=10"
}
}
Command
==> timestamp get /records/uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI/versions/0
Output
{
"hashes": [
"0x37926887dc319ac87cda01caf411bccb9ab8933d97cf3c2d57d3e13aa8bad580"
],
"info": [
{
"info": "57b1b531f1535d5214c42551"
}
]
}

Compute the multibase64url of the sha256 of this hash:

Command
==> tId: compute timestampId 0x37926887dc319ac87cda01caf411bccb9ab8933d97cf3c2d57d3e13aa8bad580
uEiDvUzJcns92jVdmFX9Ftj-VdmRcXdzrURU2w7bll1a56Q

Let's get this timestamp:

Command
==> timestamp get /timestamps/ tId
Output
{
"hash": "mEiA3kmiH3DGayHzaAcr0EbzLmriTPZfPPC1X0+E6qLrVgA",
"timestampedBy": "0xA4B6C8710f6bF233b8b480498916DEC224A5a891",
"blockNumber": 4024917,
"timestamp": "2023-12-15T16:49:49.000Z",
"data": "0x7b2264617461223a226d792064617461227d",
"transactionHash": "0xc0e703f2791487d9ef5982926c7a9c064d3cb053fba8640610b7959c13893896"
}
Command
==> compute decodeHex 0x7b2264617461223a226d792064617461227d
Output
{ "data": "my data" }

At the same time you can compute the record Id from address, blockNumber, and hash (this hash must be the first version of the record):

Command
==> compute recordId 0xA4B6C8710f6bF233b8b480498916DEC224A5a891 4024917 0x37926887dc319ac87cda01caf411bccb9ab8933d97cf3c2d57d3e13aa8bad580
uB7BBkoOCpIjBUIQM0ceiT2tlioLZaZYb6DHIIP2ZiEI