Recent Changes - Search:

APIS

Api /

Validar

GET /api.stamping.io/getstamp/?<tipo de consulta>

Esta API permite consultar el estado de un estampado en la Blockchain, existen 2 tipos de consultas:

  • byTrxid: Buscar a traves del trxtid que fue retornado por el servicio API o la librería PHP cuando se estampo una evidencia.
  • byHash: Buscar por el valor de la evidencia digital que fue estampada en la Blockchain.

Usando URL - GET

api.stamping.io/get/?evidence=<evidence (Hash o trxid)>&token=<Token de Acceso generado desde su DATA WALLET>

Ejemplo:

http://api.stamping.io/get/?evidence=e7049f9d5609d01961e4bea9ab23dd932bb1d0378eeb0eeaaebb4803fef632e2&token=MTU0MjI5NDc4NjgxMzoyTWxPZXZDbnpsNGpmaDBXSi9wYVNPWUZoUUU=

Tenga en cuenta que por seguridad la evidencia debe ser creada por el dueño del token enviado, puede enviar como evidencia el hash (64 bytes) o el trxid que le devolvió stamping.io cuando estampó la evidencia en la Blockchain.

Usando API REST

byHash

Permite hacer búsquedas de estampados utilizando el hash que fue guardado como evidencia:

<?php

        $ch = curl_init();
        $value="281b6657c64072aa811cf79d80ab05ba26d7c6f930e62235b60f77f450e54891";
        $data = array(
            'evidence' => $value
        );

        curl_setopt($ch, CURLOPT_URL, "https://api.stamping.io/getstamp/?"."byHash"."=".$value);
        curl_setopt($ch, CURLOPT_POST, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
          "Content-Type: application/json",
          "Authorization: Basic "."MTUzOTA0NDUwNjUyMjp5UFlIS2c5eTh2MW5JMW5TSFl2Zzl4bVhoYWc="
        ));
        $response = curl_exec($ch);

        echo ($response);
        curl_close($ch);

?>

byTrxid

Permite hacer búsquedas de estampados utilizando el valor retornado por stamping.io cuando endoso un estampado en la Blockchain (trxid):

<?php

        $ch = curl_init();
        $value="809f8995a235f8adcce38ba157b90a9647279859";
        $data = array(
            'evidence' => $value
        );

        curl_setopt($ch, CURLOPT_URL, "https://api.stamping.io/getstamp/?"."byTrxid"."=".$value);
        curl_setopt($ch, CURLOPT_POST, false);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
          "Content-Type: application/json",
          "Authorization: Basic "."MTU0MjI5NDc4NjgxMzoyTWxPZXZDbnpsNGpmaDBXSi9wYVNPWUZoUUU="
        ));
        $response = curl_exec($ch);

        echo ($response);
        curl_close($ch);

?>

Respuesta

Si desea mayor información de los datos obtenidos con el API deberá ingresar a este link: https://gitlab.com/stamping/stamping.io/blob/master/README.md Tenga en cuenta que si usted busca una evidencia (hash) o trxid que no ha sido creado por el propietario del token, le va a salir un error: {

  "code":"403", 
  "message":"P02 - Error, The trxid xxxxxxxxxxxxxx is invalid!."

}

Usan las Librerías de PHP

Buscar una evidencia en la Blockchain usando método byHash

<?php

include 'stampclass.php';

  $data = new stampData;
  $data->evidence="281b6657c64072aa811cf79d80ab05ba26d7c6f930e62235b60f77f450e54891"; //$_GET['evidence'];

  $stamp = new stamp; 
  $stamp->token="MTUzOTA0NDUwNjUyMjp5UFlIS2c5eTh2MW5JMW5TSFl2Zzl4bVhoYWc=";

  $result =  $stamp->getStamp("byHash",$data->evidence);

  if ($result->code=="200") {

        echo ("<h2>Resultado de la consulta</h2>");
        echo ("<h3>Stamping Id:".$result->trxid."</h3>");
        echo ("<table><tr><td>Elemento</td><td>Valor</td></tr>");
        echo ("<tr><td>trxid</td><td>".$result->trxid."</td></tr>"); 
        echo ("<tr><td>Code</td><td>".$result->code."</td></tr>"); 
        echo ("<tr><td>message</td><td>".$result->message."</td></tr>"); 
        echo ("<tr><td>url</td><td><a href='".$result->url."' target='_blank'>".$result->url."</a></td></tr>"); 
        echo ("<tr><td>data</td><td>".$result->data."</td></tr>"); 
        echo ("<tr><td>evidence</td><td>".$result->evidence."</td></tr>");
        echo ("<tr><td>hash2</td><td>".$result->hash2."</td></tr>");
        echo ("<tr><td>hash3</td><td>".$result->hash3."</td></tr>");
        echo ("<tr><td>to</td><td>".$result->to."</td></tr>");
        echo ("<tr><td>reference</td><td>".$result->reference."</td></tr>");
        echo ("<tr><td>subject</td><td>".$result->subject."</td></tr>");
        echo ("<tr><td>transactionType</td><td>".$result->transactionType."</td></tr>");
        echo ("<tr><td>from</td><td>".$result->userId."</td></tr>");
        echo ("<tr><td>status</td><td>".$result->status."</td></tr>");
        echo ("<tr><td>timestamp</td><td>".$result->timestamp."</td></tr>");
        echo ("<tr><td>blockchaiId</td><td>".$result->blockchaiId."</td></tr>");
        echo ("<tr><td>blockchainTimestamp</td><td>".$result->blockchainTimestamp."</td></tr>");
        echo ("<tr><td>blockchainToken</td><td>".$result->blockchainToken."</td></tr>");

        echo ("<tr><td>merkleRootBTC</td><td>".$result->merkleRootBTC."</td></tr>");
        echo ("<tr><td>prefixBTC</td><td>".$result->prefixBTC."</td></tr>");
        echo ("<tr><td>sourceIdBTC</td><td><a href='https://www.blocktrail.com/BTC/tx/".$result->sourceIdBTC."'  target='_blank'>".$result->sourceIdBTC."</td></tr>");

        echo ("<tr><td>merkleRootETC</td><td>".$result->merkleRootETC."</td></tr>");
        echo ("<tr><td>prefixETC</td><td>".$result->prefixETC."</td></tr>");
        echo ("<tr><td>sourceIdETC</td><td><a href='https://gastracker.io/tx/".$result->sourceIdETC."'  target='_blank'>".$result->sourceIdETC."</a></td></tr>");

        echo ("<tr><td>merkleRootETH</td><td>".$result->merkleRootETH."</td></tr>");
        echo ("<tr><td>prefixETH</td><td>".$result->prefixETH."<br>");
        echo ("<tr><td>sourceIdETH</td><td><a href='https://etherscan.io/tx/".$result->sourceIdETH."' target='_blank'>".$result->sourceIdETH."</a></td></tr>");

        echo ("<tr><td>merkleRootLTC</td><td>".$result->merkleRootLTC."</td></tr>");
        echo ("<tr><td>prefixLTC</td><td>".$result->prefixLTC."</td></tr>");
        echo ("<tr><td>sourceIdLTC</td><td><a href='https://live.blockcypher.com/ltc/tx/".$result->sourceIdLTC."' target='_blank'>".$result->sourceIdLTC."</a></td></tr>");
        echo ("<tr><td>merkleRootSTP</td><td>".$result->merkleRootSTP."</td></tr>");
        echo ("<tr><td>prefixSTP</td><td>".$result->prefixSTP."</td></tr>");
        echo ("<tr><td>sourceIdSTP</td><td>".$result->sourceIdSTP."</td></tr>");

    } else {
        echo ($result->code);
        echo ($result->message);
    }

?>

Buscar una evidencia en la Blockchain usando método byTrxid

<?php

    include 'stampclass.php';

    $data = new stampData;
    $data->trxid='809f8995a235f8adcce38ba157b90a9647279859';
    $stamp = new stamp; 
    $stamp->token="MTU0MjI5NDc4NjgxMzoyTWxPZXZDbnpsNGpmaDBXSi9wYVNPWUZoUUU=";

    //Type:  byTrxid or byHash;
    $result =  $stamp->getStamp("byTrxid",$data->trxid);
    if ($result->code=="200") {
        echo ("<h2>Resultado de la consulta</h2>");
        echo ("<h3>Stamping Id:".$result->trxid."</h3>");
    }

?>

Usando cURL

Para obtener el cliente_id:secret, se requiere decodificar en base64 al token de acceso generado desde tu DATA WALLET, para que se muestre el valor del client_id:

"decodeBase64(TOKEN) = client_id:secret" (Mayor información vea la sección de autenticación)

$ curl -u client_id:secret http://api.stamping.in/getstamp/?byHash=<hash sha256>

$ curl -u client_id:secret http://api.stamping.in/getstamp/?byTrxid=<TrxId>

Validación usando URL

Cuando se registra un hash (SHA256) en nuestra plataforma se retorna un código de transacción llamado trxId, usted puede validarlo usando un código QR asociándolo a la siguiente URL: http://www.stamping.io/q/?{trxId}&lang=en por ejemplo:

http://www.stamping.io/q/?ea5cc0e144326b2ec92877fd6ffa089ddc317208&lang=en

Tenga en cuenta que la etiqueta {lang} indica el idioma a presentar: en (Inglés) y es (Español)

Resultado de la consultas vía API REST

La respuesta es un objeto codificado JSON que contiene los datos del registro en el blockchain de Bitcoin, Ethereum o Stamping.io que contiene los siguiente datos:

Esta pendiente de anclarse en Bitcoin/Ethereum/Stamping

{

	"code": "200",
	"message": "ok",
	"trxid": "0b4ab0c88e6fa71181e70013e35848091a3d0dc7",
	"result": {
		"data": "",
		"evidence": "5fef2ab39c2ed60ca5e5dc2b8677861d7e35bff95f6200c58e5965bbfce57c65",
		"hash2": "",
		"hash3": "",
		"hashType": "",
		"to": "",
                "from":"",
		"reference": "",
		"subject": "",
		"blockchain": {
			"result": {
				"hash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
				"id": "5ba6cc4ecf12e90004339d25",
				"receipts": {
					"btc": 14743,
					"eth": 343
				},
				"time": "2018-09-22 23:12:14.469000",
				"token": "2387f5b43b2f4d7"
			}
		},
		"timestamp": "",
		"transactionType": ""
	}

}

Ya se encuentra anclado en Bitcoin/Ethereum/Stamping

{

	"code": "200",
	"message": "ok",
	"trxid": "0b4ab0c88e6fa71181e70013e35848091a3d0dc7",
	"result": {
		"data": "",
		"evidence": "5fef2ab39c2ed60ca5e5dc2b8677861d7e35bff95f6200c58e5965bbfce57c65",
		"hash2": "",
		"hash3": "",
		"hashType": "",
		"to": "",
                "from": "",
		"reference": "",
		"resume": "",
		"blockchain": {
			"result": {
				"hash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
				"id": "5ba6cc4ecf12e90004339d25",
				"receipts": {
					"btc": 14653,
					"eth": 253
				},
				"time": "2018-09-22 23:12:14.469000",
				"token": "2387f5b43b2f4d7"
			}
		},
		"blockchainGet": {
			"result": [{
				"hash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
				"id": "5ba6cc4ecf12e90004339d25",
				"receipts": {
					"btc": {
						"@context": "https://w3id.org/chainpoint/v2",
						"anchors": [{
							"prefix": "53363583",
							"sourceId": "81bb04c9033d686d913a20ff21132dbe1634e34f52b1f0dd75cbbe966610254a",
							"type": "BTCOpReturn"
						}],
						"merkleRoot": "DB0B89618577B66EABDDFB4612A7E4E3011907468EC2B55877DBC6FB2342B139",
						"proof": [{
							"right": "441CAEC998B3B4D371B9B6AC992CBC5181B4923327D8D26072164588CF9B4FD8"
						}, {
							"left": "6E59CD5E4807BCEEA3B9137C31D64B97D01E928956E8802951F0B9F9465480EB"
						}, {
							"right": "C32D9D73270E6AAB7C106332773D252A8E94D93FAABC8DADB63C5CFA9BBFB789"
						}, {
							"left": "BD57E44DF10A5E03F2FD54023808F7C919BD96378C41FBA48FD3EF39AB680613"
						}, {
							"right": "83308E5926C35BF89EF6FB6350EF5FE352BE4EE472792D7D7A7C2E6D843B7216"
						}, {
							"left": "07625175CC98E83314DDC78FE2FB05B9F8402E731433EB230A720B99660AA273"
						}, {
							"left": "ECAB59C53E21F4644DA02379142DEBA07D0D5B04F748E96BAB8B8F30EA350E19"
						}, {
							"right": "3A170BA99C8F201D6C8D50F19C43D2C2F7BDF7F7527A158DBCA50038FDC031CB"
						}, {
							"left": "E26C6465A41FC0D51BE356ABEB3419F66F763E787053AE6C02C942EDE47F4379"
						}],
						"targetHash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
						"type": "BTA-SHA256"
					},
					"etc": {
						"@context": "https://w3id.org/chainpoint/v2",
						"anchors": [{
							"prefix": "53363583",
							"sourceId": "0xd7952fbe5c26ee0cda8b98e4f9211617213364d6cf3ffdc109243696a368dd4b",
							"type": "ETCData"
						}],
						"merkleRoot": "B5D153F527AC7DF6A4CF379C0850C097A7C17F92892624E2316BE1F3A5876E42",
						"proof": [{
							"right": "441CAEC998B3B4D371B9B6AC992CBC5181B4923327D8D26072164588CF9B4FD8"
						}, {
							"left": "6E59CD5E4807BCEEA3B9137C31D64B97D01E928956E8802951F0B9F9465480EB"
						}, {
							"right": "C32D9D73270E6AAB7C106332773D252A8E94D93FAABC8DADB63C5CFA9BBFB789"
						}, {
							"left": "BD57E44DF10A5E03F2FD54023808F7C919BD96378C41FBA48FD3EF39AB680613"
						}, {
							"right": "83308E5926C35BF89EF6FB6350EF5FE352BE4EE472792D7D7A7C2E6D843B7216"
						}],
						"targetHash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
						"type": "BTA-SHA256"
					},
					"eth": {
						"@context": "https://w3id.org/chainpoint/v2",
						"anchors": [{
							"prefix": "53363583",
							"sourceId": "0xa12a33fb55749a70d03d282b23dd8311c384862efc1a50a0245315483ab716be",
							"type": "ETHData"
						}],
						"merkleRoot": "B5D153F527AC7DF6A4CF379C0850C097A7C17F92892624E2316BE1F3A5876E42",
						"proof": [{
							"right": "441CAEC998B3B4D371B9B6AC992CBC5181B4923327D8D26072164588CF9B4FD8"
						}, {
							"left": "6E59CD5E4807BCEEA3B9137C31D64B97D01E928956E8802951F0B9F9465480EB"
						}, {
							"right": "C32D9D73270E6AAB7C106332773D252A8E94D93FAABC8DADB63C5CFA9BBFB789"
						}, {
							"left": "BD57E44DF10A5E03F2FD54023808F7C919BD96378C41FBA48FD3EF39AB680613"
						}, {
							"right": "83308E5926C35BF89EF6FB6350EF5FE352BE4EE472792D7D7A7C2E6D843B7216"
						}],
						"targetHash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
						"type": "BTA-SHA256"
					},
					"ltc": {
						"@context": "https://w3id.org/chainpoint/v2",
						"anchors": [{
							"prefix": "53363583",
							"sourceId": "8c3e9a09e0ccd44dcbbc29c9b947449a0966bfc1d23f9ab3bab49f9c3c0cd35a",
							"type": "LTCOpReturn"
						}],
						"merkleRoot": "DB0B89618577B66EABDDFB4612A7E4E3011907468EC2B55877DBC6FB2342B139",
						"proof": [{
							"right": "441CAEC998B3B4D371B9B6AC992CBC5181B4923327D8D26072164588CF9B4FD8"
						}, {
							"left": "6E59CD5E4807BCEEA3B9137C31D64B97D01E928956E8802951F0B9F9465480EB"
						}, {
							"right": "C32D9D73270E6AAB7C106332773D252A8E94D93FAABC8DADB63C5CFA9BBFB789"
						}, {
							"left": "BD57E44DF10A5E03F2FD54023808F7C919BD96378C41FBA48FD3EF39AB680613"
						}, {
							"right": "83308E5926C35BF89EF6FB6350EF5FE352BE4EE472792D7D7A7C2E6D843B7216"
						}, {
							"left": "07625175CC98E83314DDC78FE2FB05B9F8402E731433EB230A720B99660AA273"
						}, {
							"left": "ECAB59C53E21F4644DA02379142DEBA07D0D5B04F748E96BAB8B8F30EA350E19"
						}, {
							"right": "3A170BA99C8F201D6C8D50F19C43D2C2F7BDF7F7527A158DBCA50038FDC031CB"
						}, {
							"left": "E26C6465A41FC0D51BE356ABEB3419F66F763E787053AE6C02C942EDE47F4379"
						}],
						"targetHash": "5FEF2AB39C2ED60CA5E5DC2B8677861D7E35BFF95F6200C58E5965BBFCE57C65",
						"type": "BTA-SHA256"
					}
				},
				"time": "2018-09-22 23:12:14.469",
				"token": "2387f5b43b2f4d7"
			}]
		},
		"timestamp": "",
		"transactionType": ""
	}

}

Edit - History - Print - Recent Changes - Search
Page last modified on November 17, 2018, at 08:36 PM