Skip to content
6. Dataset Registration

6. Dataset Registration

This tutorial covers registering datasets in the dAIEDGE Middleware for use in AI model training and benchmarking.

Overview

Dataset registration allows you to:

  • Publish datasets to the blockchain with ownership tracking
  • Version datasets
  • Control access to proprietary datasets
  • Enable dataset discovery for benchmarking
  • Track dataset usage

Prerequisites


Required Roles

Dataset Roles

To register and manage datasets, you need the following roles:

RolePurposeRequired For
DATASET_OWNER_ROLERegister and update datasetsCreating new dataset registrations
DATASET_OPERATOR_ROLEList and view datasetsListing datasets, getting dataset details

Authorization

You can register datasets if:

  • Your identity has DATASET_OWNER_ROLE (granted by ADMIN_ROLE)

You can list and view datasets if:

  • Your identity has DATASET_OPERATOR_ROLE (granted by ADMIN_ROLE)

You can update datasets if:

  • You own the dataset (registered it), OR
  • You have DATASET_OPERATOR_ROLE AND are a valid delegate of the dataset owner (via Identity Management)

See the Role Management tutorial to obtain these roles.


Step 1: Register Dataset

Endpoint

POST /api/v1/dataset

Request

curl -X POST https://middleware-daiedge.bisite.usal.es/api/v1/dataset \
  -H "Content-Type: application/json" \
  -H "x-session-id: {SESSION_ID}" \
  -d '{
    "walletId": "0000019d8e3b5c7a9f2d4e6b8a1c3f5e",
    "password": "WalletPass123!",
    "did": "did:ethr:development:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7",
    "name": "ImageNet-1K",
    "description": "1000-class image classification dataset",
    "uri": "https://datasets.example.com/imagenet-1k",
    "version": "1.0.0"
  }'

Request Body

FieldTypeRequiredDescription
walletIdstringYesYour wallet ID
passwordstringYesWallet password
didstringYesYour identity DID (format: did:ethr:{network}:0x...)
namestringYesDataset name (max 255 chars)
descriptionstringYesDataset description (max 255 chars)
uristringYesDataset location URL (max 255 chars)
versionstringYesDataset version (max 255 chars)

Response (200 OK)

{
  "id": "0x7c9a2f1e5b8d4a6c3e9f7b2d5a8c1f4e6b9d3a7c5e2f8b4d1a6c9e3f7b5d2a8c"
}

Returns the dataset ID (bytes32 hash).

Error Responses

CodeErrorCause
404WALLET_NOT_FOUNDWallet doesn’t exist
400WRONG_PASSWORDWallet password incorrect
400INVALID_DIDIdentity address format invalid
400INVALID_NAMEName empty or > 255 chars
400INVALID_DESCRIPTIONDescription empty or > 255 chars
400INVALID_URIURI empty or > 255 chars
400INVALID_VERSIONVersion empty or > 255 chars
403INVALID_WALLETWallet doesn’t belong to you
500TRANSACTION_ERRORBlockchain transaction failed (check you have DATASET_OWNER_ROLE)

Step 2: List Datasets

Endpoint

GET /api/v1/dataset?userDID={userDID}&page={page}

Request

curl -X GET "https://middleware-daiedge.bisite.usal.es/api/v1/dataset?userDID=did:ethr:development:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7&page=1" \
  -H "x-session-id: {SESSION_ID}"

Note: Requires DATASET_OPERATOR_ROLE. The list endpoint filters datasets based on access permissions.

Response (200 OK)

{
  "datasets": [
    {
      "id": "0x7c9a2f1e5b8d4a6c3e9f7b2d5a8c1f4e6b9d3a7c5e2f8b4d1a6c9e3f7b5d2a8c",
      "owner": "did:ethr:development:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7",
      "name": "ImageNet-1K",
      "description": "1000-class image classification dataset",
      "uri": "https://datasets.example.com/imagenet-1k",
      "version": "1.0.0",
      "created": 1697000000000
    }
  ],
  "page": 1,
  "totalPages": 5,
  "total": 120
}

Note: There is no delete endpoint for datasets, once registered, a dataset remains on the blockchain. Use the detail endpoint below to retrieve a specific dataset directly by its ID.

Get Dataset Details

Endpoint

GET /api/v1/dataset/{id}?userDID={userDID}
curl -X GET "https://middleware-daiedge.bisite.usal.es/api/v1/dataset/{DATASET_ID}?userDID=did:ethr:development:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7" \
  -H "x-session-id: {SESSION_ID}"

Step 3: Update Dataset

Endpoint

POST /api/v1/dataset/{id}

Request

curl -X POST https://middleware-daiedge.bisite.usal.es/api/v1/dataset/{DATASET_ID} \
  -H "Content-Type: application/json" \
  -H "x-session-id: {SESSION_ID}" \
  -d '{
    "walletId": "0000019d8e3b5c7a9f2d4e6b8a1c3f5e",
    "password": "WalletPass123!",
    "did": "did:ethr:development:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7",
    "name": "ImageNet-1K",
    "description": "Updated 1000-class image classification dataset",
    "uri": "https://datasets.example.com/imagenet-1k-v2",
    "version": "2.0.0"
  }'

Request body fields are the same as Step 1: Register Dataset.

Response (200 OK)

{}

Authorization

You can update a dataset if:

  • You are the dataset owner (registered it), OR
  • You have DATASET_OPERATOR_ROLE AND are a valid delegate of the owner (via Identity Management)

Access Control for Datasets

Dataset access control works identically to hardware access control. See Hardware Access Control tutorial for details.

Grant Dataset Access

curl -X POST https://middleware-daiedge.bisite.usal.es/api/v1/access/grant-access \
  -H "Content-Type: application/json" \
  -H "x-session-id: {SESSION_ID}" \
  -d '{
    "walletId": "0000019d8e3b5c7a9f2d4e6b8a1c3f5e",
    "password": "WalletPass123!",
    "userDID": "did:ethr:development:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7",
    "did": "did:ethr:development:0x8Ba1f109551bD432803012645Ac136ddd64DBA72",
    "resourceId": "0x7c9a2f1e5b8d4a6c3e9f7b2d5a8c1f4e6b9d3a7c5e2f8b4d1a6c9e3f7b5d2a8c",
    "resourceType": "dataset",
    "expirationTime": 1735689600,
    "usageLimit": 100,
    "indefinite": false
  }'

Next Steps

Related Topics