Blockchain API (v1alpha2)

Blockchain API Reference

This page is primarily intended for developers who will be writing applications that will use DataTrails for provenance. If you are looking for a simple way to test our API you might prefer our Postman collection, the YAML runner or the Developers section of the web UI.

Additional YAML examples can be found in the articles in the Overview section.

Blockchain API Examples

Create the bearer_token and store in a file in a secure local directory with 0600 permissions.

Fetch Transactions for an event (v1alpha2)

Blockchain transactions can be fetched from the blockchain endpoint using the Asset’s Event ID as a parameter:

assets/add30235-1424-4fda-840a-d5ef82c4c96f/events/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000

To fetch all transactions for an Asset’s Events GET the blockchain resource:

curl -v -X GET \
     -H "@$HOME/.datatrails/bearer-token.txt" \
     https://app.datatrails.ai/archivist/v1alpha2/blockchain/assets/add30235-1424-4fda-840a-d5ef82c4c96f/events/11bf5b3

Depending on the type of proof mechanism used, the response will be:

Simple Hash:

{
   "transactions":[
      {
         "transaction":{
            "hash":"0x4bb529697a096b23947e13f78492d90a66e2e9d76c5feb015cd321590b00e72a",
            "nonce":"402",
            "blockhash":"0x9ea557196d44e6433be7676ca5bdef5f8753fa6d92bbb5e7456fe3979f84ea40",
            "block_number":"861180",
            "transaction_index":0,
            "r":"0xcb4282065fb5c0b6c674bf7d3b7fb9ee4c49f135b02b9b1cf1c607bb3ff406a",
            "s":"0x5fa50214efdbc1cf13f98bb962ddf3224f1d5ba77cb19aafac5171b6ae1e8074",
            "from":"0xED3939b59D1fC93dD3158522E728Df483BC9998d",
            "to":"0x4c07935361B497EBD5801E3b4D2cF29C2179069e",
            "value":"0",
            "gas":"500000000",
            "gas_price":"0",
            "input":"0xa7ea3ea7607b464c8c5d4172880146c1c303329600000000000000000000000000000000ab6e28d836193ad54e941e9ff09b27946bdc7838c46fcf91bc11026e6737afb6000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000635bc6bb00000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000000000000000000000000000000000000000014313937302d30312d30315430303a30303a30305a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000014323032322d31302d32385431323a31303a33355a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000003677465000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026c74000000000000000000000000000000000000000000000000000000000000",
            "v":"0xea"
         },
         "simple_hash_details":{
            "api_query":"https://app.datatrails.ai/archivist/v2/assets/-/events?order_by=SIMPLEHASHV1&proof_mechanism=SIMPLE_HASH&timestamp_accepted_since=1970-01-01T00:00:00Z&timestamp_accepted_before=2022-10-28T12:10:35Z",
            "start_time":"1970-01-01T00:00:00Z",
            "end_time":"2022-10-28T12:10:35Z",
            "hash_schema_version":1,
            "anchor_hash":"ab6e28d836193ad54e941e9ff09b27946bdc7838c46fcf91bc11026e6737afb6",
            "event_count":6
         },
         "kind":"SIMPLE_HASH"
      }
   ],
   "next_page_token":""
}

Blockchain OpenAPI Docs

API to manage Blockchain.

get  /archivist/v1alpha2/blockchain/assets/{asset_uuid}/events/{uuid}

List of Blockchain Transactions associated with an event.

Description: List of Blockchain Transactions associated with an event. If the event’s asset has a proof mechanism of khipu, this will be a list of transactions that compose the event. If the event’s asset has a proof mecahnism of simple hash, this will be a list containing one transaction, that describes the simple hash anchor transaction. If the list is empty, the event has not been anchored yet.

{
  "next_page_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6InN0dW50aWR",
  "transactions": [
    {
      "khipu_details": {},
      "kind": "SIMPLE_HASH",
      "simple_hash_details": {
        "anchor_hash": "da84e5104ec02982515127adda821ffc533acf7f07bd9b5839f31239e888feea",
        "api_query": "https://app.rkvst.com/archivist/v2/assets/-/events?order_by=SIMPLEHASHV1\u0026proof_mechanism=SIMPLE_HASH\u0026timestamp_accepted_since=2022-09-01T09:01:02Z\u0026timestamp_accepted_before=2022-10-05T10:02:03Z",
        "end_time": "2022-10-05T10:02:03Z",
        "event_count": 12000,
        "hash_schema_version": 1,
        "start_time": "2022-09-01T09:01:02Z"
      },
      "transaction": {
        "blockHash": "0xef1234567d3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
        "blockNumber": 3,
        "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
        "gas": 314159,
        "gasPrice": "2000000000000",
        "hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
        "input": "0x57cb2fc4",
        "nonce": 2,
        "r": "0x8912348621879462817634897216348712638941",
        "s": "0x1234689712638957682375682364892376487238",
        "to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
        "transactionIndex": 0,
        "v": "0x26",
        "value": "123450000000000000"
      }
    }
  ]
}
Response ParameterTypeDescription
next_page_tokenstringToken to retrieve the next page of results or empty if there are none.
transactionsarray
ResponsesDescription
200A successful response.
401Returned when the user is not authenticated to the system.
403Returned when the user is not authorized to view event’s blockchain transactions.
404Returned when the asset with the id does not exist. or the event with the id does not exist
429Returned when a user exceeds their subscription’s rate limit for requests.

get  /archivist/v1alpha2/blockchain/assets:openapi

Get OpenAPI spec for Blockchain

Description: Get OpenAPI v2.0 spec for Blockchain

ResponsesDescription
200A successful response.
401Returned when the user is not authenticated to the system.
429Returned when a user exceeds their subscription’s rate limit for requests.