[SI] Data Standardization and Index

The 2PM.Network Data Standardization and Index contract is designed to facilitate the secure and standardized registration, storage, and verification of datasets on the blockchain. This enables users to maintain the integrity and consistency of data used within the 2PM.Network, ensuring that data contributions are reliable and verifiable.

Key Features

  1. Dataset Registration: Allows users to register datasets with specified field names and types, ensuring that all data adheres to a predefined structure.

  2. Data Field Type Retrieval: Provides functionality to retrieve the data type of specific fields within registered datasets.

  3. Data Upload and Verification: Supports the secure upload of data hashes along with validation of the data against the registered dataset structure.

Functions

1. registerDataset

  • Description: Registers a new dataset with the given name, field names, and field types.

  • Parameters:

    • name (string): The name of the dataset.

    • fieldNames (string[]): An array of field names.

    • fieldTypes (string[]): An array of field types corresponding to the field names.

  • Events Triggered:

    • DatasetRegistered: Emitted when a dataset is successfully registered.

2. getFieldType

  • Description: Retrieves the type of a specific field from a registered dataset.

  • Parameters:

    • datasetId (uint): The identifier of the dataset.

    • fieldName (string): The name of the field.

  • Returns: The type of the specified field as a string.

3. uploadData

  • Description: Uploads and validates data against the registered dataset structure.

  • Parameters:

    • datasetId (uint): The identifier of the dataset.

    • dataHash (bytes32): The hash of the data being uploaded.

    • fieldNames (string[]): An array of field names used in the data.

    • fieldValues (string[]): An array of field values corresponding to the field names.

  • Events Triggered:

    • DataUploaded: Emitted when data is successfully uploaded and validated.

    • DataValidationFailed: Emitted if the validation fails for any reason (e.g., mismatch in field names, field not found).

    • DataValidationPassed: Emitted when data successfully passes all validations.

Events

  • DatasetRegistered

    • Emitted when a new dataset is registered. Includes the dataset ID and name.

  • DataUploaded

    • Emitted when data is successfully uploaded. Includes the uploader's address, dataset ID, and the data hash.

  • DataValidationFailed

    • Emitted when data fails to pass validation. Includes the uploader's address, dataset ID, and a message describing the reason for failure.

  • DataValidationPassed

    • Emitted when data passes all validations. Includes the uploader's address and dataset ID.

Last updated