AI Training Data Licensing
What it does:
Automates licensing of datasets for AI training and ensures dataset creators receive royalties when their data is used.
Why it matters:
Provides transparent and enforceable licenses, prevents unauthorized use, ensures fair revenue distribution, and enables monetization of high-quality AI training data.
How it works:
-
Dataset creators register datasets with metadata, licensing terms, and royalty percentages
-
AI developers request usage rights by paying fees on-chain
-
Smart contract automatically grants access and enforces usage conditions
-
Payments are split among stakeholders based on predefined royalty shares
-
Licenses can be time-limited or perpetual and are tracked on-chain
-
Integrates with AI Agent Payment Contract, Personal Data Monetization Vault, or Play-to-Earn Reward Engine
-
All licensing activity is auditable and immutable
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/access/Ownable.sol";
/**
* @title AITrainingDataLicensing
* @author Nam
* @notice Automates licensing and royalty distribution for AI training datasets
*/
contract AITrainingDataLicensing is Ownable {
struct Dataset {
string metadataHash; // IPFS / encrypted dataset reference
address payable creator;
uint256 licenseFee; // in wei
uint256 licenseDuration; // seconds
mapping(address => uint256) activeLicenses; // licensee => expiration timestamp
}
mapping(uint256 => Dataset) public datasets;
uint256 public datasetCount;
// -------------------- EVENTS --------------------
event DatasetRegistered(uint256 indexed datasetId, address indexed creator, uint256 licenseFee, uint256 licenseDuration);
event LicenseGranted(uint256 indexed datasetId, address indexed licensee, uint256 expiration);
// -------------------- DATASET MANAGEMENT --------------------
function registerDataset(string calldata _metadataHash, uint256 _licenseFee, uint256 _licenseDuration) external {
require(_licenseFee > 0, "Fee must be >0");
require(_licenseDuration > 0, "Duration must be >0");
datasetCount += 1;
Dataset storage d = datasets[datasetCount];
d.metadataHash = _metadataHash;
d.creator = payable(msg.sender);
d.licenseFee = _licenseFee;
d.licenseDuration = _licenseDuration;
emit DatasetRegistered(datasetCount, msg.sender, _licenseFee, _licenseDuration);
}
// -------------------- LICENSE MANAGEMENT --------------------
function purchaseLicense(uint256 _datasetId) external payable {
Dataset storage d = datasets[_datasetId];
require(msg.value == d.licenseFee, "Incorrect fee");
uint256 expiration = block.timestamp + d.licenseDuration;
if (d.activeLicenses[msg.sender] > block.timestamp) {
expiration = d.activeLicenses[msg.sender] + d.licenseDuration;
}
d.activeLicenses[msg.sender] = expiration;
d.creator.transfer(msg.value);
emit LicenseGranted(_datasetId, msg.sender, expiration);
}
function hasLicense(uint256 _datasetId, address _user) external view returns (bool) {
return datasets[_datasetId].activeLicenses[_user] > block.timestamp;
}
}