Stamping.io API REST architecture

Introduction

In addition to our web panel, Stamping.io has the ability to perform evidence stamping or execute a function of any smart contract deployed on public blockchains through an integration using the Stamping API. To obtain access to our API, you must have a Stamping API account where you can obtain an access token using 3 methods: Basic authentication, bearer or signed with elliptic curve.

The Stamping API server endpoint can be centralized (https://api.stamping.io) or decentralized (Your own IP or domain). In both cases it provides the following functionality:

  • Authentication with our service (Bearer Authentication).
  • It allows publishing digital evidence based on a SHA256 type hash in public blockchains such as: LACChain, POA Network, Fantom, Avalanche, Ethereum, Binance Smart Chain, Polygon or any blockchain network based on the ethereum virtual machine (EVM).
  • Interact (CALL/SEND) with any smart contract that is deployed on public blockchains such as: LACChain, POA Network, Fantom, Avalanche, Ethereum, Binance Smart Chain, Polygon or any blockchain network based on the ethereum virtual machine (EVM).
  • All of our endpoints return JSON objects and our certificates are returned in PDF format.
  • Provides merkle tree information from the stamping of a SHA256 hash that has been anchored in any of the blockchain networks that Stamping.IO supports; if the transaction has been included in a block with the corresponding confirmations, it is also possible to obtain transaction information (TX) of each of the anchors and the respective timestamp.
  • Obtain a digital certificate with the metadata of your stamps and you can share the certificates in PDF, this certificate is issued for each transaction (SHA256 hash) or for each block created within Stamping.io.

SST - Stacking & Stamping Technology

This technology is used to anchor digital evidence based on SHA256 hashes, whose objective is to reduce the response time between an application sending the transaction and the validation in the different public blockchains.

For example, if you want to send digital evidence to a contract deployed on the LACChain network, the average time for the transaction to be accepted and validated can take two (2) seconds; however, there is another limitation that can lead to it taking longer: gas, which can lead to the transaction being rejected or entering the next block, which could take an additional two seconds. Due to the fact that this network does not have a price for gas, there could be a congestion that forces entering the following blocks, which leads the application to wait a long period of time until it has confirmation that the transaction has been accepted.

Stamping.io's SST technology allows transactions to be received in microseconds, it grants an identifier that represents a promise (TRXID), every ten (10) minutes, an automated engine will proceed to issue the transactions to the different public blockchains, then the application will be able to query anchor information using Stamping API.

alternative

Stamping.io technology is ready to receive large numbers of transactions on an industrial scale.

{{domain}}/stamp/

Send digital evidence on public Blockchains

The "stamp" API call will post a hash to the public Stamping.io blockchains. This endpoint will also allow you to store metadata in your stamp: transactionType, data, hash2, hash3, resume, reference, lat, long, url or to. The from & to parameter are used to share anonymized and encrypted message information between two or more users.

You can pass your access token via the &token parameter if you don't want to use the default way of passing a token via headers. If you want to disable the SST stack, you can send the async=false parameter, in which case the transaction will be immediately recorded on the LACChain blockchain network.

URL https://api.stamping.io/stamp/?async={false | true (default)}&token={access_token}
Method POST
Parameters
Parameter Description Example
evidence Hash SHA256 of the document or data to be registered f76809f8f7ac62f94bf554533fff70b42253ef357dc7c415019aa9cef92e15d8
async Indicates whether you want to run synchronously or asynchronously. In case of selecting asynchronous (true) the evidence will be saved in the Stamping.io SST and the next immutation cycle will be saved in the public blockchains (usually every ten minutes). true or false
token Access token. Allows you to identify yourself without the need to send authenticity information in the header. e94e0dcf378c0dc219c51305efd8d
Optional
Parameter Description Example
data Metadata data associated with the evidence. It can be encrypted, base64 or hexadecimal and can be in any format: XML, JSON or TEXT. The maximum size is 2048 bytes. Please do not send binary data of images, photos or videos. {"id":"1939",
"name":"x183.jMK",
"type":"C38"}
transactionType Transaction Type. You can enter a tag or namespace that allows you to write your logs. pe.stamping.app
hash2 Alternate SHA256 hash that may be associated with the transaction. 533fff70b42253ef357dc7c415019aa9cef92e15d8f76809f8f7ac62f94bf554
hash3 Alternate SHA256 hash that may be associated with the transaction. 76809f8f7ac62f94bf554533fff70b42253ef357dc7c415019aa9cef92e15d8f
resume Subject of the transaction certificate of studies
url URL that may be associated with the transaction. The URL of the document or a query report of the data that has been immuted in the blockchain is usually entered. https://stamping.io/files/mydocument.pdf
reference TRXID of another transaction referenced in this transaction. It allows creating nested transactions or traceability of records. 561fcbc753d95104667cbc1e4123f98ebe690ade
lat Latitude (georeferencing) where the digital evidence is captured. -12.046373
long Longitude (georeferencing) where the digital evidence is captured. -77.042755
to userID (assigned by Stamping.io) of the account receiving the transaction. This code is obtained when you create an account on the Stamping API. It is usually used when you want to send a transaction to another user. fjZLakFM4HS8afF3mu0XtKVZYjaj

Response

{
"code":"200",
"message":"Stamping has been successfully transmitted.",
"version":"Stamping API version",
"nonce":"Stamping.io signed nonce code",
"async":true | false,
"trxid":"TRANSACTION_ID od Stamping.io",
"timestamp":Transaction timestamp on Stamping.io,
"blockNumber":"Block number in the LACChain network",
"lacchainId":"Hash of the transaction in the LACChain network",
"credential":"JSON - Verifiable credential (W3C and EIP712&EIP1812). This credential is only displayed when async=false">
}

EXAMPLE CODE

PHP - cURL

					        
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.stamping.io/stamp/?async=true&evidence=<hash SHA256>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic <Token Access>'
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

					        
					   

Javascript - XHR

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});
xhr.open("POST", "https://api.stamping.io/stamp/?async=true&evidence=<hash SHA256>");
xhr.setRequestHeader("Authorization", "Basic <Token Access>");
xhr.send();
					        
					   

Transaction validator

If you want to validate your transactions you can address the URI of your QR code to the following URL: https://stamping.io/en/view/?<TrxID>

Important information

  • If you send the URI of an image in the value of the URL parameter, that image will be displayed in the viewer; however, if you submit a PDF document URI, the image of the first page of the document will be displayed. In both cases, the user is shown the possibility of sharing it on social networks or downloading the value of the original URL.
  • If you send the URI of a website in the URL parameter, the system will show the user only the access link.
If you need to create the QR before sending the transaction to Stamping.io, you can calculate the TrxID as follows:
SHA1(<SHA256 hash of the document or data>)

{{domain}}/stamp/get/

Get digital evidence on public Blockchains

Get the data from the registry in the public blockchains. You can get the transaction data by searching by TRXID, SHA256 HASH of the document or stamped data or by the TRXID of the trace reference.

URL https://api.stamping.io/stamp/get/?
Method GET
Parameters
Parameter Description Example
byTrxid TRXID of the transaction. Value obtained when the record was stamped. 123f98ebe690ade561fcbc753d95104667cbc1e4
Optional
Parameter Description Example
byHash SHA256 hash of the document or stamped data. 08234748cb6621b441639231d6149f3527cff55038f33d29a72151d277668a00
byReference TRXID of the transaction reference to search for. 123f98ebe690ade561fcbc753d95104667cbc1e4

Response

{
"code":"200",
"message":"Stamping has been successfully transmitted.",
"version":"Stamping API version",
"trxid":"TRANSACTION_ID od Stamping.io",
"result":"JSON (JSON-RESGETSTAMP)- Transaction data and its registration in the blockchain",
"references":"Data of the reference transaction and its registration in the blockchain",
}

EXAMPLE - JSON Response

JSON-RESGETSTAMP

URL : https://api.stamping.io/stamp/get/?byTrxid=123f98ebe690ade561fcbc753d95104667cbc1e4
METHOD : GET
					        
"result": {
        "integrity": {
            "evidence": "f76809f8f7ac62f94bf554533fff70b42253ef357dc7c415019aa9cef92e15d8",
            "hash2": "",
            "hash3": "",
            "token": "b078afeae53cda3d17d1ea1e6ea13",
            "tx_lacchain": "0xd1e0b26ebac1604b75586461e03f6e2692a402310a025d90502841530cab2579",
            "transactionType": "CreateBlock",
            "hashType": "SHA256",
            "subject": "",
            "url": "",
            "data": "Crea nuevo bloque "
        },
        "ownership": {
            "userId": "mu0XtKVZYjajfjZLakFM4HS8afF3",
            "owner": "",
            "address": "0xdead00000000000000000000000000000000dead",
            "reference": "NONE",
            "lat": "0",
            "long": "0",
            "to": ""
        },
        "existence": {
            "timestamp": "1643762281000",
            "anchored": "2022-02-01 19:40:04",
            "ip": "66.7.220.3"
        },
        "blockchains": {
            "recipient": "anchored",
            "number": "3610709",
            "certificate": {
                "transaction": "https://stamping.io/api/hash/certificate/?hash=f76809f8f7ac62f94bf554533fff70b42253ef357dc7c415019aa9cef92e15d8"
            },
            "block": "https://stamping.io/api/hash/certificate/?hash=32b0beaa0029673237aa7a424d72fc09135c98167e0725d27026cedb9387ee40"
        },
        "tree": {
            "hash": "08234748cb6621b441639231d6149f3527cff55038f33d29a72151d277668a00",
            "number": "7332733"
        },
        "block": {
            "hashblock": "0e4dc029bd67b1a7dcf60532b693f485dbf9c9bde90bd6ebdc37f847ee4559be",
            "number": "43322",
            "count": "21"
        },
        "networks": {
            "mainnet": {
                "polygon": "",
                "stamping": "bc8f5b8d7f6668a0f4f3014f9e307519fadf6999"
            },
            "testnet": {
                "ropsten": "",
                "bsc": "0x985d80030b75825db226d6700426a7d5d789148e797719cdef4b5146ba7605e6",
                "avalanche": "0x8ebfdefc9e449e9752c7d5d585c8bd0222676fce0e31ef49a19420373600b8ab",
                "lacchain": "0x820321890e179d5825ce9fe2bee8f4cd83125496d829179dcbee17b45df0a25a"
            }
        }
    }
},
					        
					   

EXAMPLE CODE

PHP - cURL

					        
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.stamping.io/stamp/get/?byTrxid=<TRXID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

					        
					   

Javascript - XHR

var data = "";
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});
xhr.open("GET", "https://api.stamping.io/stamp/get/?byTrxid=<TRXID>");
xhr.send(data);
					        
					   

{{domain}}/hash/certificate/

Obtain the digital evidence certificate

The digital evidence certificate can be obtained from a transaction or from an anchor block. Either the SHA256 hash of the document or pinned data or the SHA256 hash of the recipient's merkle tree treeHash must be sent. Returns the PDF document of the certificate.

URL https://api.stamping.io/hash/certificate/
Method GET
Parameters
Parameter Description Example
hash Hash SHA256 of the document or data to be registered f76809f8f7ac62f94bf554533fff70b42253ef357dc7c415019aa9cef92e15d8

Response

EXAMPLE CODE

PHP - cURL

					        
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://stamping.io/api/hash/certificate/?hash=<hash SHA256>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

					        
					   

Javascript - XHR

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});
xhr.open("POST", "https://stamping.io/api/hash/certificate/?hash=<hash SHA256>");
xhr.setRequestHeader("Authorization", "Basic <Token Access>");
xhr.send();
					        
					   
BACK
footer-frame