From 1a4107b9d32300d57977f69a49b3c1c9c59da5b6 Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Sat, 2 Aug 2025 21:42:09 +0200 Subject: [PATCH 01/22] feat: Update documentation and guides for DataProtector - Adjusted outline levels in VitePress configuration for better navigation. - Removed outdated 'Guides' link from sidebar. - Enhanced README with additional instructions and a TODO section for future improvements. - Updated package-lock.json and package.json to reflect new project name and version. - Refined index.md to correct links and improve clarity. - Enhanced grantAccess.md with clearer instructions and additional notes on access management. - Expanded getting-started.md with detailed installation steps and SDK usage examples. - Deleted obsolete guides.md file and integrated relevant content into manage-data/guides.md. - Revamped manage-data/guides.md to provide a comprehensive overview of DataProtector guides and structured navigation. - Created detailed create-and-share-access.md guide with installation, data protection, and access granting instructions. - Developed handle-schemas-dataset-types.md to explain schema functionality and its importance in DataProtector. - Expanded manage-data-monetization.md to cover monetization strategies, including pay-per-use and DataProtector Sharing models. --- .vitepress/config.mts | 2 +- .vitepress/sidebar.ts | 4 - README.md | 15 +- package-lock.json | 6 +- package.json | 1 - src/index.md | 2 +- .../dataProtectorCore/grantAccess.md | 19 +- .../dataProtector/getting-started.md | 237 +++++++++++++- src/manage-data/dataProtector/guides.md | 16 - src/manage-data/guides.md | 123 ++++--- .../guides/create-and-share-access.md | 234 ++++++++++++- .../guides/handle-schemas-dataset-types.md | 184 ++++++++++- .../guides/manage-data-monetization.md | 308 +++++++++++++++++- 13 files changed, 1044 insertions(+), 107 deletions(-) delete mode 100644 src/manage-data/dataProtector/guides.md diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 25fbfc6e..9cadf5bd 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -91,7 +91,7 @@ export default defineConfig({ { text: 'Core Concept', link: '/core-concept/glossary' }, ], outline: { - level: [2, 3], + level: [2, 4], }, sidebar: getSidebar(), diff --git a/.vitepress/sidebar.ts b/.vitepress/sidebar.ts index bc73f038..873e5f93 100644 --- a/.vitepress/sidebar.ts +++ b/.vitepress/sidebar.ts @@ -90,10 +90,6 @@ export function getSidebar() { text: 'Getting Started', link: '/manage-data/dataProtector/getting-started', }, - { - text: 'Guides', - link: '/manage-data/dataProtector/guides', - }, { text: 'DataProtector Core', link: '/manage-data/dataProtector/dataProtectorCore', diff --git a/README.md b/README.md index afe0bd68..a7b7ebf3 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ Fork this repository and ensure you're working on the `main` branch: ``` 3. Start the development server: + ```bash npm run dev ``` @@ -138,14 +139,18 @@ Fork this repository and ensure you're working on the `main` branch: > - All pull requests are reviewed by our team before being merged > - Feel free to ask questions in the pull request if you need clarification -## πŸ“„ License - -This project is part of the iExec ecosystem. Please refer to the main iExec -repositories for licensing information. - ## πŸ†˜ Support - πŸ“– [Documentation](https://docs.iex.ec) - πŸ’¬ [Discord Community](https://discord.com/invite/pbt9m98wnU) - πŸ› [Issue Tracker](https://github.com/iExecBlockchainComputing/documentation/issues) + +## TODO + +- Add Arbitrum support +- Adapt hardcoded address to feat with new contracts deployed on arbitrum +- complete `use-iapp` section +- complete `explorer` section +- complete `build-iapp` section +- complete `deep-dive`section diff --git a/package-lock.json b/package-lock.json index 4b5257ee..a5f7545b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,12 @@ { - "name": "documentation", + "name": "iexec-documentation", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "documentation", + "name": "iexec-documentation", + "version": "0.0.0", "dependencies": { "@iexec/dataprotector": "^2.0.0-beta.17", "@iexec/dataprotector-deserializer": "^0.1.1", diff --git a/package.json b/package.json index e443fa93..c89f4665 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "dev": "vitepress dev", "build": "vitepress build", "preview": "vitepress preview", - "check-format": "prettier --ignore-path .gitignore --check .", "format": "prettier --ignore-path .gitignore --write ." }, "dependencies": { diff --git a/src/index.md b/src/index.md index 9629ccef..4a259026 100644 --- a/src/index.md +++ b/src/index.md @@ -25,7 +25,7 @@ features: details: Secure your data with advanced encryption and control access while maintaining privacy using DataProtector - link: /manage-data/dataProtector/what-is-protected-data + link: /manage-data/what-is-protected-data - icon: πŸ€– title: Build iApps details: diff --git a/src/manage-data/dataProtector/dataProtectorCore/grantAccess.md b/src/manage-data/dataProtector/dataProtectorCore/grantAccess.md index 09b4a0eb..78c0c34f 100644 --- a/src/manage-data/dataProtector/dataProtectorCore/grantAccess.md +++ b/src/manage-data/dataProtector/dataProtectorCore/grantAccess.md @@ -44,7 +44,8 @@ import { type GrantAccessParams } from '@iexec/dataprotector'; **Type:** `AddressOrENS` -The ethereum address of the protected data supplied by the user. +The ethereum address of the protected data supplied by the user (returned when +you created it). **You must own this data** to grant access. ```ts twoslash import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; @@ -68,9 +69,9 @@ The address of the application you wish to authorize to process the single application or an application whitelist. To specify a whitelist, you provide the ETH address of an [iExec Whitelist Smart Contract](https://github.com/iExecBlockchainComputing/whitelist-smart-contract/tree/main). -This smart contract aggregates multiple application versions. This allows you to -introduce new versions of your application without needing to grant access for -the `protectedData` each time you do so. +This smart contract should aggregates multiple application versions. This allows +you to introduce new versions of your application without needing to grant +access for the `protectedData` each time you do so. ```ts twoslash import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; @@ -180,12 +181,14 @@ used. It is not technically possible to set an unlimited number of accesses, but you can set `numberOfAccess` to `10000` for example. -::: info Important Notes: If you attempt to process the protected data more -times than specified in `numberOfAccess`, you will encounter a **"no dataset -orders"** error. +::: info + +If you attempt to process the protected data more times than specified in +`numberOfAccess`, you will encounter a **"no dataset orders"** error. To prevent this error, ensure the `numberOfAccess` is properly set when calling -the `grantAccess` method. +the `grantAccess` method. + ::: ```ts twoslash diff --git a/src/manage-data/dataProtector/getting-started.md b/src/manage-data/dataProtector/getting-started.md index bb0045fb..b387c9ab 100644 --- a/src/manage-data/dataProtector/getting-started.md +++ b/src/manage-data/dataProtector/getting-started.md @@ -1,10 +1,241 @@ --- title: Getting Started -description: DataProtector getting started guide +description: DataProtector getting started --- # Getting Started -This page is under development. +[![GitHub package.json version (branch)](https://img.shields.io/badge/npm-2.0.0--beta-green)](https://www.npmjs.com/package/@iexec/dataprotector) - +## Overview + +### Prerequisites + +Before getting started, ensure that you have the following installed on your +system: + +\- [**Node.js**](https://nodejs.org/en/) version 18 or higher + +\- [**NPM**](https://docs.npmjs.com/) (Node.js package manager) + +### Installation + +::: code-group + +```sh [npm] +npm install @iexec/dataprotector +``` + +```sh [yarn] +yarn add @iexec/dataprotector +``` + +```sh [pnpm] +pnpm add @iexec/dataprotector +``` + +```sh [bun] +bun add @iexec/dataprotector +``` + +::: + +**This package is an ESM package. Your project needs to use ESM too.** + [**Read more**](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) + +If you use it with **Webpack**, some polyfills will be needed. You can find a +minimal working project +[here](https://github.com/iExecBlockchainComputing/dataprotector-sdk/tree/115b797cf62dcff0f41e2ba783405d5083d78922/packages/demo/browser-webpack). + +### Instantiate SDK + +Depending on your project's requirements, you can instantiate the SDK using the +umbrella module for full functionality or opt for one of the submodules to +access specific sets of features. + +#### Instantiate using the umbrella module + +For projects requiring the full functionality of the SDK, including both core +and sharing functions. + +::: code-group + +```ts twoslash [Browser] +declare global { + interface Window { + ethereum: any; + } +} +// ---cut--- +import { IExecDataProtector } from '@iexec/dataprotector'; + +const web3Provider = window.ethereum; +// Instantiate using the umbrella module for full functionality +const dataProtector = new IExecDataProtector(web3Provider); + +const dataProtectorCore = dataProtector.core; +const dataProtectorSharing = dataProtector.sharing; +``` + +```ts twoslash [NodeJS] +import { IExecDataProtector, getWeb3Provider } from '@iexec/dataprotector'; + +// Get Web3 provider from a private key +const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY'); + +// Instantiate using the umbrella module for full functionality +const dataProtector = new IExecDataProtector(web3Provider); + +const dataProtectorCore = dataProtector.core; // access to core methods +const dataProtectorSharing = dataProtector.sharing; // access to methods +``` + +::: + +#### Instantiate only the `core` module + +For projects focusing solely on core data protection functions. + +::: code-group + +```ts twoslash [Browser] +declare global { + interface Window { + ethereum: any; + } +} +// ---cut--- +import { IExecDataProtectorCore } from '@iexec/dataprotector'; + +const web3Provider = window.ethereum; +// Instantiate only the Core module +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +``` + +```ts twoslash [NodeJS] +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +// Get Web3 provider from a private key +const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY'); + +// Instantiate only the Core module +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +``` + +::: + +#### Instantiate only the `sharing` module + +For projects that need access management functions specifically. + +::: code-group + +```ts twoslash [Browser] +declare global { + interface Window { + ethereum: any; + } +} +// ---cut--- +import { IExecDataProtectorSharing } from '@iexec/dataprotector'; + +const web3Provider = window.ethereum; +// Instantiate only the Sharing module +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +``` + +```ts twoslash [NodeJS] +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +// Get Web3 provider from a private key +const web3Provider = getWeb3Provider('YOUR_PRIVATE_KEY'); + +// Instantiate only the Sharing module +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +``` + +::: + +#### Instantiate without a Web3 provider + +For projects that only require read functions, you can instantiate the SDK +without a Web3 provider. + +::: code-group + +```ts twoslash [Singleton Modules] +import { + IExecDataProtectorSharing, + IExecDataProtectorCore, +} from '@iexec/dataprotector'; + +// Instantiate only the Core module for read-only core methods +const dataProtectorCore = new IExecDataProtectorCore(); +// Instantiate only the Sharing module for read-only sharing methods +const dataProtectorSharing = new IExecDataProtectorSharing(); +``` + +```ts twoslash [Umbrella Module] +import { IExecDataProtector } from '@iexec/dataprotector'; + +// Instantiate using the umbrella module for read-only functions +const dataProtector = new IExecDataProtector(); + +// Access to read-only core methods +const dataProtectorCore = dataProtector.core; +// Access to read-only sharing methods +const dataProtectorSharing = dataProtector.sharing; +``` + +::: + +#### Advanced configuration + +To add optional parameters, see +[advanced configuration](./advanced/advanced-configuration.md). + +::: info + +πŸ§ͺ While protected data are processed in **TEE** by **intel SGX** technology by +default, `@iexec/dataprotector` can be configured to create and process +protected data in the experimental **intel TDX** environment. + +For more details see: + +- [configure DataProtector TDX](./advanced/advanced-configuration.md#iexecoptions) +- [create TDX protected data](./dataProtectorCore/protectData.md#usage) +- [process TDX protected data](./dataProtectorCore/processProtectedData.md#workerpool) + +⚠️ Keep in mind: TDX mode is experimental and can be subject to instabilities or +discontinuity. + +::: + +## Sandbox + +### Core methods + + + ⚑  Code Sandbox + + +Corresponding GitHub repository: + + + πŸ”Ž  GitHub repository sandbox + + +### Sharing methods + + + ⚑  Code Sandbox + + +Corresponding GitHub repository: + + + πŸ”Ž  GitHub repository sandbox + diff --git a/src/manage-data/dataProtector/guides.md b/src/manage-data/dataProtector/guides.md deleted file mode 100644 index 8d68ac6d..00000000 --- a/src/manage-data/dataProtector/guides.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -description: DataProtector Guides ---- - -# DataProtector Guides - -## Structure proposΓ©e - -- Create and Share Access to Protected Data -- Schemas, Dataset Types, etc. (links to iApps) -- Manage Monetization - -## Contenu Γ  dΓ©velopper - -Cette section sera dΓ©veloppΓ©e avec des guides pratiques pour utiliser -DataProtector. diff --git a/src/manage-data/guides.md b/src/manage-data/guides.md index 91501aff..11186447 100644 --- a/src/manage-data/guides.md +++ b/src/manage-data/guides.md @@ -1,90 +1,105 @@ --- title: DataProtector Guides -description: Step-by-step guides for using iExec DataProtector +description: + Step-by-step guides for protecting, managing, and monetizing your data with + iExec DataProtector --- # πŸ“– DataProtector Guides -Discover how to protect, share, and monetize your data using iExec's -DataProtector technology through these comprehensive guides. +**Master data protection, sharing, and monetization** with these comprehensive +step-by-step guides. Each guide focuses on a specific aspect of building with +DataProtector. -## Getting Started Guides +## Essential Guides -### πŸš€ [Quick Start Guide](/manage-data/dataProtector/getting-started) +### πŸ›‘οΈ [Create and Share Access to Protected Data](/manage-data/guides/create-and-share-access) -Learn the basics of protecting your first dataset and granting access to others. +**Start here if you're new to DataProtector.** Learn how to protect your data +and control exactly who can access it. -### πŸ” [Understanding Protected Data](/manage-data/dataProtector/what-is-protected-data) +- Protect data with client-side encryption +- Grant access to specific users and apps +- Set pricing and usage limits +- Debug mode for development -Deep dive into the concepts behind data protection and privacy-preserving -computation. +--- -## Core Features Guides +### 🏷️ [Handle Schemas and Dataset Types](/manage-data/guides/handle-schemas-dataset-types) -### πŸ“Š Data Protection +**Understand how your data structure works with iApps.** Learn about automatic +schema generation and how to use data types effectively. -- [Protect Your Data](/manage-data/dataProtector/dataProtectorCore/protectData) - - Encrypt and register data -- [Retrieve Protected Data](/manage-data/dataProtector/dataProtectorCore/getProtectedData) - - Access your protected datasets -- [Transfer Ownership](/manage-data/dataProtector/dataProtectorCore/transferOwnership) - - Change data ownership +- Auto-generated schemas from your JSON data +- Supported data types and format conversion +- Using schemas in iApp development +- Type safety and error handling -### πŸ”‘ Access Management +--- -- [Grant Access](/manage-data/dataProtector/dataProtectorCore/grantAccess) - - Give permissions to users -- [View Granted Access](/manage-data/dataProtector/dataProtectorCore/getGrantedAccess) - - See who has access -- [Revoke Access](/manage-data/dataProtector/dataProtectorCore/revokeAllAccess) - - Remove permissions +### πŸ’° [Manage Data Monetization](/manage-data/guides/manage-data-monetization) -### ⚑ Data Processing +**Turn your protected data into revenue.** Explore different monetization +strategies from simple pay-per-use to advanced marketplace distribution. -- [Process Protected Data](/manage-data/dataProtector/dataProtectorCore/processProtectedData) - - Run computations -- [Get Results](/manage-data/dataProtector/dataProtectorCore/getResultFromCompletedTask) - - Retrieve computation outputs +- Pay-per-use with DataProtector Core +- DataProtector Sharing with collections +- Rental, subscription, and sale models +- Revenue optimization strategies -## Data Sharing & Monetization +## Quick Navigation -### πŸ“¦ Collections +::: tip What You'll Learn These guides cover the complete journey from +protecting your first dataset to building a sustainable data business with +automated monetization. ::: -- [Create Collections](/manage-data/dataProtector/dataProtectorSharing/collection/createCollection) - - Group related datasets -- [Manage Collections](/manage-data/dataProtector/dataProtectorSharing/collection/addToCollection) - - Add/remove data +### By Use Case -### πŸ’° Monetization Options +- **πŸš€ Just getting started?** β†’ + [Create and Share Access](/manage-data/guides/create-and-share-access) +- **πŸ”§ Building an iApp?** β†’ + [Handle Schemas and Dataset Types](/manage-data/guides/handle-schemas-dataset-types) +- **πŸ’‘ Want to monetize data?** β†’ + [Manage Data Monetization](/manage-data/guides/manage-data-monetization) -- [Rent Your Data](/manage-data/dataProtector/dataProtectorSharing/renting) - - Time-based access -- [Sell Your Data](/manage-data/dataProtector/dataProtectorSharing/selling) - - Permanent transfers -- [Subscription Model](/manage-data/dataProtector/dataProtectorSharing/subscription) - - Recurring access +### By Experience Level -## Advanced Topics +**Beginner**: Start with data protection basics +β†’ [Create and Share Access](/manage-data/guides/create-and-share-access) -### πŸ”§ [Advanced Configuration](/manage-data/dataProtector/advanced/advanced-configuration) +**Intermediate**: Learn about data structures and iApp integration +β†’ [Handle Schemas and Dataset Types](/manage-data/guides/handle-schemas-dataset-types) -Customize DataProtector for your specific needs. +**Advanced**: Explore monetization strategies and business models +β†’ [Manage Data Monetization](/manage-data/guides/manage-data-monetization) -### πŸ—οΈ [Smart Contracts](/manage-data/dataProtector/advanced/dps-smart-contract) +## Additional Resources -Understand the underlying blockchain technology. +### πŸ“š **SDK Reference** -### πŸ“± [App Whitelisting](/manage-data/dataProtector/advanced/apps-whitelist) +- [DataProtector Core SDK](/manage-data/dataProtector/dataProtectorCore) - + Complete method reference +- [DataProtector Sharing SDK](/manage-data/dataProtector/dataProtectorSharing) - + Advanced distribution features +- [Type Definitions](/manage-data/dataProtector/types) - TypeScript interfaces + and types -Control which applications can access your data. +### 🎯 **Real Examples** -## Migration Guide +- [Content Creator Demo](/overview/use-case-demo/content-creator) - Live example + of data monetization +- [Hello World Tutorial](/overview/helloWorld) - End-to-end walkthrough -### πŸ”„ [Migrate from v1 to v2](/manage-data/dataProtector/migrate-from-v1) +### πŸ”§ **Advanced Topics** -Upgrade from the previous version of DataProtector. +- [Apps Whitelist](/manage-data/dataProtector/advanced/apps-whitelist) - Control + which iApps can access data +- [Smart Contract Details](/manage-data/dataProtector/advanced/dps-smart-contract) - + Blockchain implementation +- [Migration Guide](/manage-data/dataProtector/migrate-from-v1) - Upgrade from + v1 to v2 --- -_These guides will help you master data protection and unlock the full potential -of your datasets._ +**Ready to start?** Pick the guide that matches your current goal and dive in! +πŸš€ diff --git a/src/manage-data/guides/create-and-share-access.md b/src/manage-data/guides/create-and-share-access.md index 92e8749c..f08cadd5 100644 --- a/src/manage-data/guides/create-and-share-access.md +++ b/src/manage-data/guides/create-and-share-access.md @@ -1,10 +1,236 @@ --- title: Create and Share Access to Protected Data -description: Create and share access to protected data +description: + Learn how to protect data and grant secure access for specific apps and users --- -# Create and Share Access to Protected Data +# πŸ›‘οΈ Create and Share Access to Protected Data -This page is under development. +**Want to keep your data private while still using it in confidential +applications?** - +Here's how DataProtector works: first you encrypt your data, then manage your +orders to control exactly who can access it, how many times, and at what price. + +Once data is protected, it's only accessible inside secure enclaves (TEEs) by +the specific people and iApps you authorize through the orders you create. No +exceptions. + +## Installation + +First, install DataProtector in your project: + +::: code-group + +```bash [npm] +npm install @iexec/dataprotector +``` + +```bash [yarn] +yarn add @iexec/dataprotector +``` + +```bash [pnpm] +pnpm add @iexec/dataprotector +``` + +```bash [bun] +bun add @iexec/dataprotector +``` + +::: + +## Protect Your Data + +**Here's what happens:** Your data gets encrypted client-side and stored as an +NFT. Only you control who can decrypt and use it. + +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- +const protectedData = await dataProtectorCore.protectData({ + name: 'My Email Contact', + data: { + email: 'alice@example.com', + firstName: 'Alice', + lastName: 'Smith', + }, +}); + +console.log('Protected data address:', protectedData.address); +``` + +### What You Can Protect + +**Data**: Any JSON object with custom keys. Think user profiles, API +credentials, datasets, model parameters - anything you want to keep private but +still use in computations. + +**Supported types**: Strings, numbers, booleans, nested objects, files (convert +to ArrayBuffer first), and arrays (convert to Record format). + +**Limits**: File size depends on your storage choice (IPFS or Arweave). For +large datasets, consider using another IPFS node. + +::: tip + +Need Help ? Check our +[Schema and Dataset Types guide](/manage-data/guides/handle-schemas-dataset-types) +for detailed formatting instructions. + +::: + +### Debug Mode Option + +Debug mode lets you test with debug iApps during development. As "debug" iApps +don't have the same security standards, we recommend using this mode only during +iApp development. + +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- + +const protectedData = await dataProtectorCore.protectData({ + data: { + email: 'test@example.com', + }, + allowDebug: true, // [!code focus] +}); +``` + +## Grant Access + +**Here's the key:** The protocol blocks all access to your protected data by +default. You must explicitly grant permission for each app and user combination. +By doing this, you publish signed orders that ensure your protected data stays +private while controlling access to it. + +Once you own protected data, here's how to share access: + +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- + +const grantedAccess = await dataProtectorCore.grantAccess({ + protectedData: '0x123abc...', // Your protected data address + authorizedApp: '0x456def...', // iApp that can process the data + authorizedUser: '0x789cba...', // User who can trigger the processing + pricePerAccess: 0, // Cost per use (in nRLC) + numberOfAccess: 10, // Maximum number of uses +}); +``` + +### Parameters + +```ts twoslash +import { type GrantAccessParams } from '@iexec/dataprotector'; +``` + +#### protectedData + +**Type:** `AddressOrENS` + +The ethereum address of the protected data supplied by the user (returned when +you created it). **You must own this data** to grant access. + +#### authorizedApp + +**Type:** `AddressOrENS` + +**What it is**: The iApp address that's allowed to process your data inside the +secure enclave. + +**Why needed**: This ensures only specific, audited applications can access your +data. No random code can touch it. + +**Pro tip**: Use app whitelists for production. Instead of a single app address, +you can specify a whitelist contract that contains multiple app versions. Very +useful for when you need to upgrade your iApps, without losing all the granted +access. + +```ts +// Single app +authorizedApp: 'web3mail.apps.iexec.eth'; + +// Or use a whitelist (recommended for production) +authorizedApp: '0x781482C39CcE25546583EaC4957Fb7Bf04C277D2'; // Web3Mail whitelist +``` + +#### authorizedUser + +**Type:** `AddressOrENS` + +**What it is**: The wallet address of the user that is allowed to process this +data. + +**Why needed**: Even with an authorized app, only specific users can trigger the +computation. This gives you granular control over who uses your data. + +**Don't forget**: Even if you are the owner of the data, you need to authorize +yourself! + +**Special case**: Set to `0x0000000000000000000000000000000000000000` to allow +**any user** to trigger processing (useful for public datasets). + +#### pricePerAccess + +**Type:** `number` +**Default:** `0` + +**Quick explanation**: How much you charge per data usage (in nano RLC - nRLC). + +Set to `0` for free access, or specify a price to monetize your data +automatically. + +**Example**: `pricePerAccess: 1_000_000_000` = 1 RLC per access + +β†’ **Want to learn more monetization capabilities?** See our detailed +[Manage Data Monetization guide](/manage-data/guides/manage-data-monetization) + +#### numberOfAccess + +**Quick explanation**: Maximum number of times this authorization can be used. + +::: warning + +Important If someone tries to process your data more times than allowed, they'll +get a "no dataset orders" error. Set this high enough for your use case. + +::: + +**Example values**: + +- `1` - Single use (great for one-time data analysis) +- `100` - Limited campaign (email marketing with usage cap) +- `10000` - Effectively unlimited for most use cases + +## What's Next? + +**You now have protected data with controlled access.** Here are your next +steps: + +- **Process the data**: Use + [processProtectedData](/manage-data/dataProtector/dataProtectorCore/processProtectedData) + to run computations +- **Manage access**: + [Revoke](/manage-data/dataProtector/dataProtectorCore/revokeOneAccess) or + [modify permissions](/manage-data/dataProtector/dataProtectorCore/grantAccess) + anytime +- **Learn data types**: Deep dive into + [schemas and dataset types](/manage-data/guides/handle-schemas-dataset-types) +- **Monetize data**: Explore + [data monetization strategies](/manage-data/guides/manage-data-monetization) + +--- + +**TL;DR**: Protect data β†’ Grant access to specific app + user β†’ Data stays +encrypted except inside authorized secure enclaves. You keep full control. πŸ”’ diff --git a/src/manage-data/guides/handle-schemas-dataset-types.md b/src/manage-data/guides/handle-schemas-dataset-types.md index 1b221530..d3880ca4 100644 --- a/src/manage-data/guides/handle-schemas-dataset-types.md +++ b/src/manage-data/guides/handle-schemas-dataset-types.md @@ -1,10 +1,186 @@ --- title: Handle Schemas and Dataset Types -description: Handle schemas and dataset types +description: + Learn how schemas work in DataProtector and how to use them in your iApps --- -# Handle Schemas and Dataset Types +# 🏷️ Handle Schemas and Dataset Types -This page is under development. +**Schemas are like TypeScript for your protected data.** They define the +structure and types of your data automatically when you protect it, making it +easy for iApps to know what they're working with. - +Think of schemas as **data labels** - they tell iApps "this protected data +contains an email address and a phone number" without revealing the actual +values. + +## How Schemas Work + +When you protect data with DataProtector, the SDK automatically analyzes your +JSON object and generates a schema. **No manual schema definition needed** - +it's all handled for you. + +```ts +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); + +const protectedData = await dataProtectorCore.protectData({ + name: 'User Contact', + data: { + email: 'alice@example.com', + phoneNumber: '+1234567890', + preferences: { + newsletter: true, + notifications: false, + }, + }, +}); + +// The schema is automatically generated: +console.log(protectedData.schema); +/* Output: +{ + email: 'string', + phoneNumber: 'string', + preferences: { + newsletter: 'bool', + notifications: 'bool' + } +} +*/ +``` + +## Supported Data Types + +The schema automatically detects these types: + +| Type | Description | Example | +| ------------------------------- | -------------- | --------------------- | +| `string` | Text data | `"alice@example.com"` | +| `bool` | Boolean values | `true`, `false` | +| `f64` | Numbers | `42`, `3.14` | +| `i128` | Big integers | `BigInt(123456789)` | +| `application/octet-stream` | Binary data | File contents | +| `image/jpeg`, `image/png`, etc. | Media files | Images, videos | + +::: tip Auto-Detection The SDK automatically detects file types based on +content. No need to specify MIME types manually. ::: + +## Why Schemas Matter + +### 🎯 **For iApp Development** + +Schemas let your iApps validate and process data safely: + +```js +// Inside your iApp +const email = await deserializer.getValue('email', 'string'); +const preferences = await deserializer.getValue( + 'preferences.newsletter', + 'bool' +); +``` + +### πŸ” **For Data Discovery** + +Users can find relevant protected data without seeing the actual content: + +```ts +// Find all protected data with email addresses +const query = { schema: { email: 'string' } }; +// Returns metadata only, no actual emails revealed +``` + +### πŸ›‘οΈ **For Type Safety** + +Prevents your iApps from processing incompatible data types. + +## Real Examples + +### Simple User Profile + +```ts +const userData = await dataProtectorCore.protectData({ + data: { + email: 'user@example.com', + age: 25, + isSubscribed: true, + }, +}); +// Schema: { email: 'string', age: 'f64', isSubscribed: 'bool' } +``` + +### Nested Contact Information + +```ts +const contactData = await dataProtectorCore.protectData({ + data: { + personal: { + firstName: 'Alice', + lastName: 'Smith', + }, + contact: { + email: 'alice@example.com', + phone: '+1234567890', + }, + preferences: { + marketing: false, + notifications: true, + }, + }, +}); +// Schema reflects the full nested structure +``` + +### File Data + +```ts +import { createArrayBufferFromFile } from '@iexec/dataprotector'; + +const file = document.getElementById('fileInput').files[0]; +const fileBuffer = await createArrayBufferFromFile(file); + +const fileData = await dataProtectorCore.protectData({ + data: { + fileName: file.name, + fileContent: fileBuffer, + uploadDate: Date.now(), + }, +}); +// Schema: { fileName: 'string', fileContent: 'image/jpeg', uploadDate: 'f64' } +``` + +## Using Schemas in iApps + +Once you have protected data with a schema, you'll want to process it inside an +iApp. + +::: warning Type Matching **Your iApp and frontend must use the same field names +and types.** If they don't match, you'll get runtime errors when processing the +data. ::: + +β†’ **Ready to build an iApp?** Check out our detailed +[Inputs and Outputs guide](/build_iapp/guides/inputs-and-outputs) to learn how +to access schema fields inside your iApp using the deserializer. + +## Next Steps + +**You now understand how schemas work with protected data.** Here's what to +explore next: + +- **Build an iApp**: Check out the + [iApp Generator guide](/build_iapp/iapp-generator) to create your first data + processor +- **Process data**: Learn about + [processProtectedData](/manage-data/dataProtector/dataProtectorCore/processProtectedData) + for running computations +- **See it in action**: Try our [Hello World tutorial](/overview/helloWorld) for + a complete example + +--- + +**TL;DR**: Schemas = auto-generated data labels. Frontend protects data β†’ Schema +describes structure β†’ iApp uses schema to access fields safely. Match your field +names and types between frontend and iApp! 🏷️ diff --git a/src/manage-data/guides/manage-data-monetization.md b/src/manage-data/guides/manage-data-monetization.md index 4f1c74f8..05460418 100644 --- a/src/manage-data/guides/manage-data-monetization.md +++ b/src/manage-data/guides/manage-data-monetization.md @@ -1,10 +1,310 @@ --- title: Manage Data Monetization -description: Manage data monetization +description: + Explore different ways to monetize your protected data with pay-per-use and + DataProtector Sharing --- -# Manage Data Monetization +# πŸ’° Manage Data Monetization -This page is under development. +**Your protected data can generate revenue automatically.** iExec offers two +main approaches for monetizing your data: simple pay-per-use access and advanced +DataProtector Sharing with multiple distribution models. - +Each approach serves different use cases, from direct data processing to +autonomous smart contract distribution. + +## Two Monetization Approaches + +### 🎯 **Pay-Per-Use (DataProtector Core)** + +Direct access control with simple pricing. You grant access to specific users +and apps, charging per data usage. + +### πŸͺ **DataProtector Sharing** + +Advanced distribution features with collections, subscriptions, rentals, and +sales. Users can purchase access autonomously through smart contracts. + +Let's explore both in detail. + +--- + +## Pay-Per-Use (DataProtector Core) + +**How it works**: When you grant access to your protected data, you set a price +per access. Each time someone processes your data, they pay your specified fee +automatically. + +```ts +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); + +// Grant paid access to your data +const grantedAccess = await dataProtectorCore.grantAccess({ + protectedData: '0x123abc...', // Your data address + authorizedApp: 'email-processor.apps.iexec.eth', + authorizedUser: '0x456def...', // Specific user + pricePerAccess: 5000000000, // 5 RLC per access + numberOfAccess: 100, // Max 100 uses +}); +``` + +### **Use Cases for Pay-Per-Use** + +::: code-group + +```ts [API Access] +// Charge for AI model inference +const grantedAccess = await dataProtectorCore.grantAccess({ + protectedData: myAIModelAddress, + authorizedApp: 'ai-inference.apps.iexec.eth', + authorizedUser: clientAddress, + pricePerAccess: 1000000000, // 1 RLC per inference + numberOfAccess: 1000, +}); +``` + +```ts [Data Processing] +// Charge for data analysis +const grantedAccess = await dataProtectorCore.grantAccess({ + protectedData: healthDataAddress, + authorizedApp: 'health-analyzer.apps.iexec.eth', + authorizedUser: researcherAddress, + pricePerAccess: 10000000000, // 10 RLC per analysis + numberOfAccess: 50, +}); +``` + +```ts [Free Access] +// Grant free access (still controlled) +const grantedAccess = await dataProtectorCore.grantAccess({ + protectedData: publicDatasetAddress, + authorizedApp: 'research.apps.iexec.eth', + authorizedUser: '0x0000000000000000000000000000000000000000', // Any user + pricePerAccess: 0, // Free + numberOfAccess: 10000, +}); +``` + +::: + +### **Pros & Cons of Pay-Per-Use** + +βœ… **Advantages**: + +- Simple setup and direct control +- Works with any existing iApp +- You know exactly who has access +- Immediate payment per usage + +❌ **Limitations**: + +- Manual access granting for each user +- Direct relationship required with each consumer +- No automated distribution features + +--- + +## DataProtector Sharing + +**How it works**: Create collections of your protected data and set up +distribution models. Users can discover and purchase access autonomously through +smart contracts. + +::: tip See It Live The +[Content Creator demo](/overview/use-case-demo/content-creator) shows +DataProtector Sharing in action with file monetization. While it uses +content-delivery for file transfers, the same patterns work for any iApp - AI +models, data processing, oracles, etc. ::: + +### **Step 1: Create a Collection** + +```ts +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); + +// Create a collection to group your data +const collection = await dataProtectorSharing.createCollection(); +console.log('Collection address:', collection.collectionId); + +// Add your protected data to the collection +await dataProtectorSharing.addToCollection({ + protectedData: '0x123abc...', // Your protected data address + collectionId: collection.collectionId, + addOnlyAppWhitelist: '0x256bcd881c33bdf9df952f2a0148f27d439f2e64', // iExec apps whitelist +}); +``` + +### **Step 2: Choose Your Distribution Model** + +DataProtector Sharing offers four distribution models: + +### πŸ†“ **Free Access** + +Perfect for building audience, beta testing, or public datasets. + +```ts +// Make data freely available (but still controlled) +await dataProtectorSharing.setProtectedDataToRenting({ + protectedData: '0x123abc...', + price: 0, // Free access + duration: 86400, // 24 hours access +}); +``` + +### 🏠 **Rental Model** + +Users pay once for temporary access to your data. + +```ts +// Set up rental terms +await dataProtectorSharing.setProtectedDataToRenting({ + protectedData: '0x123abc...', + price: 5000000000, // 5 RLC rental fee + duration: 604800, // 7 days access (in seconds) +}); + +// Users can then rent your data +const rental = await dataProtectorSharing.rentProtectedData({ + protectedData: '0x123abc...', + price: 5000000000, + duration: 604800, +}); +``` + +**Perfect for**: + +- Time-limited datasets (event data, seasonal trends) +- Expensive datasets where users need short-term access +- Content that loses value over time + +### πŸ“… **Subscription Model** + +Users pay for ongoing access to a bundle of data that you can expand over time. + +```ts +// First, set subscription parameters for the collection +await dataProtectorSharing.setSubscriptionParams({ + collectionId: collection.collectionId, + price: 20000000000, // 20 RLC subscription fee + duration: 2592000, // 30 days access +}); + +// Add protected data to the subscription bundle +await dataProtectorSharing.setProtectedDataToSubscription({ + protectedData: '0x123abc...', +}); + +// Add more data to the same subscription +await dataProtectorSharing.setProtectedDataToSubscription({ + protectedData: '0x456def...', // Additional dataset +}); + +// Users subscribe to access all data in the bundle +const subscription = await dataProtectorSharing.subscribeToCollection({ + collectionId: collection.collectionId, + price: 20000000000, + duration: 2592000, +}); +``` + +**Perfect for**: + +- Growing datasets (daily market data, news feeds) +- Educational content series +- Research datasets that expand over time +- SaaS-style data access + +### πŸ’Έ **Sale Model** + +Transfer permanent ownership of your data to the buyer. + +```ts +// List data for sale +await dataProtectorSharing.setProtectedDataForSale({ + protectedData: '0x123abc...', + price: 100000000000, // 100 RLC purchase price +}); + +// Buyers can purchase ownership +const purchase = await dataProtectorSharing.buyProtectedData({ + protectedData: '0x123abc...', + price: 100000000000, +}); +``` + +**Perfect for**: + +- Unique datasets or models +- Digital assets and NFT data +- One-time valuable insights +- When you want to exit data ownership + +## Comparison: When to Use What? + +| Feature | Pay-Per-Use | DataProtector Sharing | +| ------------------------- | ---------------------- | ------------------------------------- | +| **Setup Complexity** | Simple | Moderate | +| **Consumer Relationship** | Direct | Smart contract mediated | +| **Payment** | Per processing | Per access period | +| **User Autonomy** | Requires your approval | Self-service | +| **Distribution Models** | One (pay-per-use) | Four (free, rent, subscription, sale) | +| **Best for** | Direct partnerships | Autonomous distribution | + +### 🎯 **Choose Pay-Per-Use when** + +- You have direct relationships with data consumers +- You want full control over each access grant +- Your data is processed by specific iApps +- Simple pricing model is sufficient + +### πŸͺ **Choose DataProtector Sharing when** + +- You want automated distribution via smart contracts +- Users should purchase access autonomously without your involvement +- You need flexible pricing models (free, rental, subscription) +- You want to build a data business with recurring revenue + +## Real-World Example + +**Want to see data monetization in action?** Check out our **Content Creator +demo** that showcases DataProtector Sharing with real file transfers: + +**[Content Creator Demo](/overview/use-case-demo/content-creator)** - A complete +app demonstrating collections, rentals, and subscriptions for content +monetization. + +::: tip Live Example The Content Creator demo uses a content-delivery iApp for +file transfers, but the same monetization patterns apply to **any iApp and use +case** - AI model inference, data analysis, oracle feeds, Web3Mail, etc. ::: + +## Next Steps + +**Ready to start monetizing your data?** Here are your next steps: + +- **See it in action**: Try the + [Content Creator demo](/overview/use-case-demo/content-creator) to understand + the full flow +- **Start simple**: Begin with + [pay-per-use via grantAccess](/manage-data/guides/create-and-share-access) +- **Explore sharing**: Try + [DataProtector Sharing](/manage-data/dataProtector/dataProtectorSharing) for + automated distribution +- **Build collections**: Learn about + [collection management](/manage-data/dataProtector/dataProtectorSharing/collection) +- **Set up subscriptions**: Implement + [recurring revenue models](/manage-data/dataProtector/dataProtectorSharing/subscription) + +--- + +**TL;DR**: Pay-per-use = Simple direct control. DataProtector Sharing = Smart +contract automation with free/rent/subscription/sale models. Choose based on +your distribution strategy and technical needs. πŸ’° From 71eaa829d459041f609fda1fd8b8a4a9fcb42378 Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Sat, 2 Aug 2025 23:55:02 +0200 Subject: [PATCH 02/22] refactor: enhance documentation for guides and improve visibility of features --- README.md | 3 + .../guides/create-and-share-access.md | 5 - .../guides/handle-schemas-dataset-types.md | 161 +++++++++++++----- .../guides/manage-data-monetization.md | 98 ++++++++--- 4 files changed, 198 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index a7b7ebf3..efcf8576 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,9 @@ Fork this repository and ensure you're working on the `main` branch: - Add Arbitrum support - Adapt hardcoded address to feat with new contracts deployed on arbitrum +- Add link to the new explorer feature Asset_Types in the guide => + `handle-schemas-dataset-types` +- Move `manage-data/dataProtector/advanced/iApp` (Deserializer doc) in an other way to be more visible (may in build-iApp section) - complete `use-iapp` section - complete `explorer` section - complete `build-iapp` section diff --git a/src/manage-data/guides/create-and-share-access.md b/src/manage-data/guides/create-and-share-access.md index f08cadd5..bad47dc1 100644 --- a/src/manage-data/guides/create-and-share-access.md +++ b/src/manage-data/guides/create-and-share-access.md @@ -229,8 +229,3 @@ steps: [schemas and dataset types](/manage-data/guides/handle-schemas-dataset-types) - **Monetize data**: Explore [data monetization strategies](/manage-data/guides/manage-data-monetization) - ---- - -**TL;DR**: Protect data β†’ Grant access to specific app + user β†’ Data stays -encrypted except inside authorized secure enclaves. You keep full control. πŸ”’ diff --git a/src/manage-data/guides/handle-schemas-dataset-types.md b/src/manage-data/guides/handle-schemas-dataset-types.md index d3880ca4..f6a54395 100644 --- a/src/manage-data/guides/handle-schemas-dataset-types.md +++ b/src/manage-data/guides/handle-schemas-dataset-types.md @@ -6,11 +6,12 @@ description: # 🏷️ Handle Schemas and Dataset Types -**Schemas are like TypeScript for your protected data.** They define the -structure and types of your data automatically when you protect it, making it -easy for iApps to know what they're working with. +**Schemas are like content labels that describe what's inside your protected data.** -Think of schemas as **data labels** - they tell iApps "this protected data +They define the structure and types of your data automatically when you protect +it, making it easy for iApps to know what they're working with. + +Think of schemas as **data fingerprints** - they tell iApps "this protected data contains an email address and a phone number" without revealing the actual values. @@ -20,12 +21,12 @@ When you protect data with DataProtector, the SDK automatically analyzes your JSON object and generates a schema. **No manual schema definition needed** - it's all handled for you. -```ts +```ts twoslash import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; const web3Provider = getWeb3Provider('PRIVATE_KEY'); const dataProtectorCore = new IExecDataProtectorCore(web3Provider); - +// ---cut--- const protectedData = await dataProtectorCore.protectData({ name: 'User Contact', data: { @@ -38,20 +39,27 @@ const protectedData = await dataProtectorCore.protectData({ }, }); -// The schema is automatically generated: -console.log(protectedData.schema); -/* Output: +console.log('βœ… Protected data created!'); +console.log('πŸ“ Address:', protectedData.address); +``` + +**🏷️ Generated Schema:** + +```json { - email: 'string', - phoneNumber: 'string', - preferences: { - newsletter: 'bool', - notifications: 'bool' + "email": "string", + "phoneNumber": "string", + "preferences": { + "newsletter": "bool", + "notifications": "bool" } } -*/ ``` +::: info Schema Structure +The schema automatically maps your data structure to types that iApps can understand and validate. +::: + ## Supported Data Types The schema automatically detects these types: @@ -65,8 +73,10 @@ The schema automatically detects these types: | `application/octet-stream` | Binary data | File contents | | `image/jpeg`, `image/png`, etc. | Media files | Images, videos | -::: tip Auto-Detection The SDK automatically detects file types based on -content. No need to specify MIME types manually. ::: +::: tip Auto-Detection +The SDK automatically detects file types based on +content. No need to specify MIME types manually. +::: ## Why Schemas Matter @@ -74,7 +84,11 @@ content. No need to specify MIME types manually. ::: Schemas let your iApps validate and process data safely: -```js +```ts twoslash +import { IExecDataProtectorDeserializer } from '@iexec/dataprotector-deserializer'; + +const deserializer = new IExecDataProtectorDeserializer(); +// ---cut--- // Inside your iApp const email = await deserializer.getValue('email', 'string'); const preferences = await deserializer.getValue( @@ -83,25 +97,37 @@ const preferences = await deserializer.getValue( ); ``` +### πŸ›‘οΈ **For Type Safety** + +Prevents your iApps from processing incompatible data types. + ### πŸ” **For Data Discovery** Users can find relevant protected data without seeing the actual content: -```ts -// Find all protected data with email addresses -const query = { schema: { email: 'string' } }; -// Returns metadata only, no actual emails revealed -``` - -### πŸ›‘οΈ **For Type Safety** +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; -Prevents your iApps from processing incompatible data types. +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- +const listProtectedData = await dataProtectorCore.getProtectedData({ + requiredSchema: { + email: 'string', + }, +}); +``` ## Real Examples ### Simple User Profile -```ts +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- const userData = await dataProtectorCore.protectData({ data: { email: 'user@example.com', @@ -109,12 +135,26 @@ const userData = await dataProtectorCore.protectData({ isSubscribed: true, }, }); -// Schema: { email: 'string', age: 'f64', isSubscribed: 'bool' } +``` + +**🏷️ Generated Schema:** + +```json +{ + "email": "string", + "age": "f64", + "isSubscribed": "bool" +} ``` ### Nested Contact Information -```ts +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- const contactData = await dataProtectorCore.protectData({ data: { personal: { @@ -131,15 +171,43 @@ const contactData = await dataProtectorCore.protectData({ }, }, }); -// Schema reflects the full nested structure +``` + +**🏷️ Generated Schema:** + +```json +{ + "personal": { + "firstName": "string", + "lastName": "string" + }, + "contact": { + "email": "string", + "phone": "string" + }, + "preferences": { + "marketing": "bool", + "notifications": "bool" + } +} ``` ### File Data -```ts -import { createArrayBufferFromFile } from '@iexec/dataprotector'; +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +// Mock function for the example +function createArrayBufferFromFile(file: File): Promise { + return Promise.resolve(new ArrayBuffer(0)); +} + +// Get file from input element +const file = new File([""], "example.jpg", { type: "image/jpeg" }); -const file = document.getElementById('fileInput').files[0]; +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- const fileBuffer = await createArrayBufferFromFile(file); const fileData = await dataProtectorCore.protectData({ @@ -149,7 +217,16 @@ const fileData = await dataProtectorCore.protectData({ uploadDate: Date.now(), }, }); -// Schema: { fileName: 'string', fileContent: 'image/jpeg', uploadDate: 'f64' } +``` + +**🏷️ Schema for file upload:** + +```json +{ + "fileName": "string", + "fileContent": "image/jpeg", + "uploadDate": "f64" +} ``` ## Using Schemas in iApps @@ -157,12 +234,14 @@ const fileData = await dataProtectorCore.protectData({ Once you have protected data with a schema, you'll want to process it inside an iApp. -::: warning Type Matching **Your iApp and frontend must use the same field names +::: warning Type Matching +**Your iApp and frontend must use the same field names and types.** If they don't match, you'll get runtime errors when processing the -data. ::: +data. +::: β†’ **Ready to build an iApp?** Check out our detailed -[Inputs and Outputs guide](/build_iapp/guides/inputs-and-outputs) to learn how +[Inputs and Outputs guide](/build-iapp/guides/inputs-and-outputs) to learn how to access schema fields inside your iApp using the deserializer. ## Next Steps @@ -171,16 +250,10 @@ to access schema fields inside your iApp using the deserializer. explore next: - **Build an iApp**: Check out the - [iApp Generator guide](/build_iapp/iapp-generator) to create your first data + [iApp Generator guide](/build-iapp/iapp-generator) to create your first data processor - **Process data**: Learn about [processProtectedData](/manage-data/dataProtector/dataProtectorCore/processProtectedData) for running computations - **See it in action**: Try our [Hello World tutorial](/overview/helloWorld) for a complete example - ---- - -**TL;DR**: Schemas = auto-generated data labels. Frontend protects data β†’ Schema -describes structure β†’ iApp uses schema to access fields safely. Match your field -names and types between frontend and iApp! 🏷️ diff --git a/src/manage-data/guides/manage-data-monetization.md b/src/manage-data/guides/manage-data-monetization.md index 05460418..be644a7d 100644 --- a/src/manage-data/guides/manage-data-monetization.md +++ b/src/manage-data/guides/manage-data-monetization.md @@ -36,12 +36,12 @@ Let's explore both in detail. per access. Each time someone processes your data, they pay your specified fee automatically. -```ts +```ts twoslash import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; const web3Provider = getWeb3Provider('PRIVATE_KEY'); const dataProtectorCore = new IExecDataProtectorCore(web3Provider); - +// ---cut--- // Grant paid access to your data const grantedAccess = await dataProtectorCore.grantAccess({ protectedData: '0x123abc...', // Your data address @@ -56,7 +56,16 @@ const grantedAccess = await dataProtectorCore.grantAccess({ ::: code-group -```ts [API Access] +```ts twoslash [API Access] +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); + +// Mock addresses for the example +const myAIModelAddress = '0x123abc...'; +const clientAddress = '0x456def...'; +// ---cut--- // Charge for AI model inference const grantedAccess = await dataProtectorCore.grantAccess({ protectedData: myAIModelAddress, @@ -67,7 +76,16 @@ const grantedAccess = await dataProtectorCore.grantAccess({ }); ``` -```ts [Data Processing] +```ts twoslash [Data Processing] +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); + +// Mock addresses for the example +const healthDataAddress = '0x123abc...'; +const researcherAddress = '0x456def...'; +// ---cut--- // Charge for data analysis const grantedAccess = await dataProtectorCore.grantAccess({ protectedData: healthDataAddress, @@ -78,7 +96,15 @@ const grantedAccess = await dataProtectorCore.grantAccess({ }); ``` -```ts [Free Access] +```ts twoslash [Free Access] +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); + +// Mock address for the example +const publicDatasetAddress = '0x123abc...'; +// ---cut--- // Grant free access (still controlled) const grantedAccess = await dataProtectorCore.grantAccess({ protectedData: publicDatasetAddress, @@ -118,11 +144,12 @@ smart contracts. [Content Creator demo](/overview/use-case-demo/content-creator) shows DataProtector Sharing in action with file monetization. While it uses content-delivery for file transfers, the same patterns work for any iApp - AI -models, data processing, oracles, etc. ::: +models, data processing, oracles, etc. +::: ### **Step 1: Create a Collection** -```ts +```ts twoslash import { IExecDataProtectorSharing, getWeb3Provider, @@ -130,7 +157,7 @@ import { const web3Provider = getWeb3Provider('PRIVATE_KEY'); const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); - +// ---cut--- // Create a collection to group your data const collection = await dataProtectorSharing.createCollection(); console.log('Collection address:', collection.collectionId); @@ -151,7 +178,15 @@ DataProtector Sharing offers four distribution models: Perfect for building audience, beta testing, or public datasets. -```ts +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +// ---cut--- // Make data freely available (but still controlled) await dataProtectorSharing.setProtectedDataToRenting({ protectedData: '0x123abc...', @@ -164,7 +199,15 @@ await dataProtectorSharing.setProtectedDataToRenting({ Users pay once for temporary access to your data. -```ts +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +// ---cut--- // Set up rental terms await dataProtectorSharing.setProtectedDataToRenting({ protectedData: '0x123abc...', @@ -190,7 +233,18 @@ const rental = await dataProtectorSharing.rentProtectedData({ Users pay for ongoing access to a bundle of data that you can expand over time. -```ts +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); + +// Mock collection for the example +const collection = { collectionId: 123 }; +// ---cut--- // First, set subscription parameters for the collection await dataProtectorSharing.setSubscriptionParams({ collectionId: collection.collectionId, @@ -227,7 +281,15 @@ const subscription = await dataProtectorSharing.subscribeToCollection({ Transfer permanent ownership of your data to the buyer. -```ts +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +// ---cut--- // List data for sale await dataProtectorSharing.setProtectedDataForSale({ protectedData: '0x123abc...', @@ -282,9 +344,11 @@ demo** that showcases DataProtector Sharing with real file transfers: app demonstrating collections, rentals, and subscriptions for content monetization. -::: tip Live Example The Content Creator demo uses a content-delivery iApp for +::: tip Live Example +The Content Creator demo uses a content-delivery iApp for file transfers, but the same monetization patterns apply to **any iApp and use -case** - AI model inference, data analysis, oracle feeds, Web3Mail, etc. ::: +case** - AI model inference, data analysis, oracle feeds, Web3Mail, etc. +::: ## Next Steps @@ -302,9 +366,3 @@ case** - AI model inference, data analysis, oracle feeds, Web3Mail, etc. ::: [collection management](/manage-data/dataProtector/dataProtectorSharing/collection) - **Set up subscriptions**: Implement [recurring revenue models](/manage-data/dataProtector/dataProtectorSharing/subscription) - ---- - -**TL;DR**: Pay-per-use = Simple direct control. DataProtector Sharing = Smart -contract automation with free/rent/subscription/sale models. Choose based on -your distribution strategy and technical needs. πŸ’° From 705456f3f85c0de5efeae6ec61d3044aa49b9e01 Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Sun, 3 Aug 2025 21:53:36 +0200 Subject: [PATCH 03/22] refactor: rename and update links for data monetization guides, remove deprecated guide --- .vitepress/sidebar.ts | 5 +- README.md | 5 +- src/index.md | 2 +- src/manage-data/guides.md | 59 +-- .../guides/create-and-share-access.md | 4 +- .../guides/handle-schemas-dataset-types.md | 24 +- .../guides/manage-data-monetization.md | 368 ------------------ .../guides/monetize-protected-data.md | 256 ++++++++++++ 8 files changed, 276 insertions(+), 447 deletions(-) delete mode 100644 src/manage-data/guides/manage-data-monetization.md create mode 100644 src/manage-data/guides/monetize-protected-data.md diff --git a/.vitepress/sidebar.ts b/.vitepress/sidebar.ts index 873e5f93..d5d3eff8 100644 --- a/.vitepress/sidebar.ts +++ b/.vitepress/sidebar.ts @@ -76,15 +76,14 @@ export function getSidebar() { link: '/manage-data/guides/handle-schemas-dataset-types', }, { - text: 'Manage Data Monetization', - link: '/manage-data/guides/manage-data-monetization', + text: 'Monetize Protected Data', + link: '/manage-data/guides/monetize-protected-data', }, ], }, { text: 'πŸ” DataProtector', link: '/manage-data/dataProtector', - collapsed: true, items: [ { text: 'Getting Started', diff --git a/README.md b/README.md index efcf8576..3b257617 100644 --- a/README.md +++ b/README.md @@ -149,10 +149,13 @@ Fork this repository and ensure you're working on the `main` branch: ## TODO - Add Arbitrum support +- On arbitrum hide : Oracle Factory ? , DataProtector Sharing ?? - Adapt hardcoded address to feat with new contracts deployed on arbitrum - Add link to the new explorer feature Asset_Types in the guide => `handle-schemas-dataset-types` -- Move `manage-data/dataProtector/advanced/iApp` (Deserializer doc) in an other way to be more visible (may in build-iApp section) +- Add link to remix for deploying whitelist +- Move `manage-data/dataProtector/advanced/iApp` (Deserializer doc) in an other + way to be more visible (may in build-iApp section) - complete `use-iapp` section - complete `explorer` section - complete `build-iapp` section diff --git a/src/index.md b/src/index.md index 4a259026..893add4e 100644 --- a/src/index.md +++ b/src/index.md @@ -43,7 +43,7 @@ features: details: Create revenue streams from your data while maintaining full control and privacy - link: /manage-data/guides/manage-data-monetization + link: /manage-data/guides/monetize-protected-data - icon: 🧠 title: Core Concepts details: diff --git a/src/manage-data/guides.md b/src/manage-data/guides.md index 11186447..7798a4a3 100644 --- a/src/manage-data/guides.md +++ b/src/manage-data/guides.md @@ -37,7 +37,7 @@ schema generation and how to use data types effectively. --- -### πŸ’° [Manage Data Monetization](/manage-data/guides/manage-data-monetization) +### πŸ’° [Monetize Protected Data](/manage-data/guides/monetize-protected-data) **Turn your protected data into revenue.** Explore different monetization strategies from simple pay-per-use to advanced marketplace distribution. @@ -46,60 +46,3 @@ strategies from simple pay-per-use to advanced marketplace distribution. - DataProtector Sharing with collections - Rental, subscription, and sale models - Revenue optimization strategies - -## Quick Navigation - -::: tip What You'll Learn These guides cover the complete journey from -protecting your first dataset to building a sustainable data business with -automated monetization. ::: - -### By Use Case - -- **πŸš€ Just getting started?** β†’ - [Create and Share Access](/manage-data/guides/create-and-share-access) -- **πŸ”§ Building an iApp?** β†’ - [Handle Schemas and Dataset Types](/manage-data/guides/handle-schemas-dataset-types) -- **πŸ’‘ Want to monetize data?** β†’ - [Manage Data Monetization](/manage-data/guides/manage-data-monetization) - -### By Experience Level - -**Beginner**: Start with data protection basics -β†’ [Create and Share Access](/manage-data/guides/create-and-share-access) - -**Intermediate**: Learn about data structures and iApp integration -β†’ [Handle Schemas and Dataset Types](/manage-data/guides/handle-schemas-dataset-types) - -**Advanced**: Explore monetization strategies and business models -β†’ [Manage Data Monetization](/manage-data/guides/manage-data-monetization) - -## Additional Resources - -### πŸ“š **SDK Reference** - -- [DataProtector Core SDK](/manage-data/dataProtector/dataProtectorCore) - - Complete method reference -- [DataProtector Sharing SDK](/manage-data/dataProtector/dataProtectorSharing) - - Advanced distribution features -- [Type Definitions](/manage-data/dataProtector/types) - TypeScript interfaces - and types - -### 🎯 **Real Examples** - -- [Content Creator Demo](/overview/use-case-demo/content-creator) - Live example - of data monetization -- [Hello World Tutorial](/overview/helloWorld) - End-to-end walkthrough - -### πŸ”§ **Advanced Topics** - -- [Apps Whitelist](/manage-data/dataProtector/advanced/apps-whitelist) - Control - which iApps can access data -- [Smart Contract Details](/manage-data/dataProtector/advanced/dps-smart-contract) - - Blockchain implementation -- [Migration Guide](/manage-data/dataProtector/migrate-from-v1) - Upgrade from - v1 to v2 - ---- - -**Ready to start?** Pick the guide that matches your current goal and dive in! -πŸš€ diff --git a/src/manage-data/guides/create-and-share-access.md b/src/manage-data/guides/create-and-share-access.md index bad47dc1..40ba3f40 100644 --- a/src/manage-data/guides/create-and-share-access.md +++ b/src/manage-data/guides/create-and-share-access.md @@ -194,7 +194,7 @@ automatically. **Example**: `pricePerAccess: 1_000_000_000` = 1 RLC per access β†’ **Want to learn more monetization capabilities?** See our detailed -[Manage Data Monetization guide](/manage-data/guides/manage-data-monetization) +[Monetize Protected Data guide](/manage-data/guides/monetize-protected-data) #### numberOfAccess @@ -228,4 +228,4 @@ steps: - **Learn data types**: Deep dive into [schemas and dataset types](/manage-data/guides/handle-schemas-dataset-types) - **Monetize data**: Explore - [data monetization strategies](/manage-data/guides/manage-data-monetization) + [data monetization strategies](/manage-data/guides/monetize-protected-data) diff --git a/src/manage-data/guides/handle-schemas-dataset-types.md b/src/manage-data/guides/handle-schemas-dataset-types.md index f6a54395..ecd46917 100644 --- a/src/manage-data/guides/handle-schemas-dataset-types.md +++ b/src/manage-data/guides/handle-schemas-dataset-types.md @@ -6,7 +6,8 @@ description: # 🏷️ Handle Schemas and Dataset Types -**Schemas are like content labels that describe what's inside your protected data.** +**Schemas are like content labels that describe what's inside your protected +data.** They define the structure and types of your data automatically when you protect it, making it easy for iApps to know what they're working with. @@ -48,7 +49,7 @@ console.log('πŸ“ Address:', protectedData.address); ```json { "email": "string", - "phoneNumber": "string", + "phoneNumber": "string", "preferences": { "newsletter": "bool", "notifications": "bool" @@ -56,9 +57,8 @@ console.log('πŸ“ Address:', protectedData.address); } ``` -::: info Schema Structure -The schema automatically maps your data structure to types that iApps can understand and validate. -::: +::: info Schema Structure The schema automatically maps your data structure to +types that iApps can understand and validate. ::: ## Supported Data Types @@ -73,10 +73,8 @@ The schema automatically detects these types: | `application/octet-stream` | Binary data | File contents | | `image/jpeg`, `image/png`, etc. | Media files | Images, videos | -::: tip Auto-Detection -The SDK automatically detects file types based on -content. No need to specify MIME types manually. -::: +::: tip Auto-Detection The SDK automatically detects file types based on +content. No need to specify MIME types manually. ::: ## Why Schemas Matter @@ -203,7 +201,7 @@ function createArrayBufferFromFile(file: File): Promise { } // Get file from input element -const file = new File([""], "example.jpg", { type: "image/jpeg" }); +const file = new File([''], 'example.jpg', { type: 'image/jpeg' }); const web3Provider = getWeb3Provider('PRIVATE_KEY'); const dataProtectorCore = new IExecDataProtectorCore(web3Provider); @@ -234,11 +232,9 @@ const fileData = await dataProtectorCore.protectData({ Once you have protected data with a schema, you'll want to process it inside an iApp. -::: warning Type Matching -**Your iApp and frontend must use the same field names +::: warning Type Matching **Your iApp and frontend must use the same field names and types.** If they don't match, you'll get runtime errors when processing the -data. -::: +data. ::: β†’ **Ready to build an iApp?** Check out our detailed [Inputs and Outputs guide](/build-iapp/guides/inputs-and-outputs) to learn how diff --git a/src/manage-data/guides/manage-data-monetization.md b/src/manage-data/guides/manage-data-monetization.md deleted file mode 100644 index be644a7d..00000000 --- a/src/manage-data/guides/manage-data-monetization.md +++ /dev/null @@ -1,368 +0,0 @@ ---- -title: Manage Data Monetization -description: - Explore different ways to monetize your protected data with pay-per-use and - DataProtector Sharing ---- - -# πŸ’° Manage Data Monetization - -**Your protected data can generate revenue automatically.** iExec offers two -main approaches for monetizing your data: simple pay-per-use access and advanced -DataProtector Sharing with multiple distribution models. - -Each approach serves different use cases, from direct data processing to -autonomous smart contract distribution. - -## Two Monetization Approaches - -### 🎯 **Pay-Per-Use (DataProtector Core)** - -Direct access control with simple pricing. You grant access to specific users -and apps, charging per data usage. - -### πŸͺ **DataProtector Sharing** - -Advanced distribution features with collections, subscriptions, rentals, and -sales. Users can purchase access autonomously through smart contracts. - -Let's explore both in detail. - ---- - -## Pay-Per-Use (DataProtector Core) - -**How it works**: When you grant access to your protected data, you set a price -per access. Each time someone processes your data, they pay your specified fee -automatically. - -```ts twoslash -import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorCore = new IExecDataProtectorCore(web3Provider); -// ---cut--- -// Grant paid access to your data -const grantedAccess = await dataProtectorCore.grantAccess({ - protectedData: '0x123abc...', // Your data address - authorizedApp: 'email-processor.apps.iexec.eth', - authorizedUser: '0x456def...', // Specific user - pricePerAccess: 5000000000, // 5 RLC per access - numberOfAccess: 100, // Max 100 uses -}); -``` - -### **Use Cases for Pay-Per-Use** - -::: code-group - -```ts twoslash [API Access] -import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorCore = new IExecDataProtectorCore(web3Provider); - -// Mock addresses for the example -const myAIModelAddress = '0x123abc...'; -const clientAddress = '0x456def...'; -// ---cut--- -// Charge for AI model inference -const grantedAccess = await dataProtectorCore.grantAccess({ - protectedData: myAIModelAddress, - authorizedApp: 'ai-inference.apps.iexec.eth', - authorizedUser: clientAddress, - pricePerAccess: 1000000000, // 1 RLC per inference - numberOfAccess: 1000, -}); -``` - -```ts twoslash [Data Processing] -import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorCore = new IExecDataProtectorCore(web3Provider); - -// Mock addresses for the example -const healthDataAddress = '0x123abc...'; -const researcherAddress = '0x456def...'; -// ---cut--- -// Charge for data analysis -const grantedAccess = await dataProtectorCore.grantAccess({ - protectedData: healthDataAddress, - authorizedApp: 'health-analyzer.apps.iexec.eth', - authorizedUser: researcherAddress, - pricePerAccess: 10000000000, // 10 RLC per analysis - numberOfAccess: 50, -}); -``` - -```ts twoslash [Free Access] -import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorCore = new IExecDataProtectorCore(web3Provider); - -// Mock address for the example -const publicDatasetAddress = '0x123abc...'; -// ---cut--- -// Grant free access (still controlled) -const grantedAccess = await dataProtectorCore.grantAccess({ - protectedData: publicDatasetAddress, - authorizedApp: 'research.apps.iexec.eth', - authorizedUser: '0x0000000000000000000000000000000000000000', // Any user - pricePerAccess: 0, // Free - numberOfAccess: 10000, -}); -``` - -::: - -### **Pros & Cons of Pay-Per-Use** - -βœ… **Advantages**: - -- Simple setup and direct control -- Works with any existing iApp -- You know exactly who has access -- Immediate payment per usage - -❌ **Limitations**: - -- Manual access granting for each user -- Direct relationship required with each consumer -- No automated distribution features - ---- - -## DataProtector Sharing - -**How it works**: Create collections of your protected data and set up -distribution models. Users can discover and purchase access autonomously through -smart contracts. - -::: tip See It Live The -[Content Creator demo](/overview/use-case-demo/content-creator) shows -DataProtector Sharing in action with file monetization. While it uses -content-delivery for file transfers, the same patterns work for any iApp - AI -models, data processing, oracles, etc. -::: - -### **Step 1: Create a Collection** - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -// Create a collection to group your data -const collection = await dataProtectorSharing.createCollection(); -console.log('Collection address:', collection.collectionId); - -// Add your protected data to the collection -await dataProtectorSharing.addToCollection({ - protectedData: '0x123abc...', // Your protected data address - collectionId: collection.collectionId, - addOnlyAppWhitelist: '0x256bcd881c33bdf9df952f2a0148f27d439f2e64', // iExec apps whitelist -}); -``` - -### **Step 2: Choose Your Distribution Model** - -DataProtector Sharing offers four distribution models: - -### πŸ†“ **Free Access** - -Perfect for building audience, beta testing, or public datasets. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -// Make data freely available (but still controlled) -await dataProtectorSharing.setProtectedDataToRenting({ - protectedData: '0x123abc...', - price: 0, // Free access - duration: 86400, // 24 hours access -}); -``` - -### 🏠 **Rental Model** - -Users pay once for temporary access to your data. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -// Set up rental terms -await dataProtectorSharing.setProtectedDataToRenting({ - protectedData: '0x123abc...', - price: 5000000000, // 5 RLC rental fee - duration: 604800, // 7 days access (in seconds) -}); - -// Users can then rent your data -const rental = await dataProtectorSharing.rentProtectedData({ - protectedData: '0x123abc...', - price: 5000000000, - duration: 604800, -}); -``` - -**Perfect for**: - -- Time-limited datasets (event data, seasonal trends) -- Expensive datasets where users need short-term access -- Content that loses value over time - -### πŸ“… **Subscription Model** - -Users pay for ongoing access to a bundle of data that you can expand over time. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); - -// Mock collection for the example -const collection = { collectionId: 123 }; -// ---cut--- -// First, set subscription parameters for the collection -await dataProtectorSharing.setSubscriptionParams({ - collectionId: collection.collectionId, - price: 20000000000, // 20 RLC subscription fee - duration: 2592000, // 30 days access -}); - -// Add protected data to the subscription bundle -await dataProtectorSharing.setProtectedDataToSubscription({ - protectedData: '0x123abc...', -}); - -// Add more data to the same subscription -await dataProtectorSharing.setProtectedDataToSubscription({ - protectedData: '0x456def...', // Additional dataset -}); - -// Users subscribe to access all data in the bundle -const subscription = await dataProtectorSharing.subscribeToCollection({ - collectionId: collection.collectionId, - price: 20000000000, - duration: 2592000, -}); -``` - -**Perfect for**: - -- Growing datasets (daily market data, news feeds) -- Educational content series -- Research datasets that expand over time -- SaaS-style data access - -### πŸ’Έ **Sale Model** - -Transfer permanent ownership of your data to the buyer. - -```ts twoslash -import { - IExecDataProtectorSharing, - getWeb3Provider, -} from '@iexec/dataprotector'; - -const web3Provider = getWeb3Provider('PRIVATE_KEY'); -const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); -// ---cut--- -// List data for sale -await dataProtectorSharing.setProtectedDataForSale({ - protectedData: '0x123abc...', - price: 100000000000, // 100 RLC purchase price -}); - -// Buyers can purchase ownership -const purchase = await dataProtectorSharing.buyProtectedData({ - protectedData: '0x123abc...', - price: 100000000000, -}); -``` - -**Perfect for**: - -- Unique datasets or models -- Digital assets and NFT data -- One-time valuable insights -- When you want to exit data ownership - -## Comparison: When to Use What? - -| Feature | Pay-Per-Use | DataProtector Sharing | -| ------------------------- | ---------------------- | ------------------------------------- | -| **Setup Complexity** | Simple | Moderate | -| **Consumer Relationship** | Direct | Smart contract mediated | -| **Payment** | Per processing | Per access period | -| **User Autonomy** | Requires your approval | Self-service | -| **Distribution Models** | One (pay-per-use) | Four (free, rent, subscription, sale) | -| **Best for** | Direct partnerships | Autonomous distribution | - -### 🎯 **Choose Pay-Per-Use when** - -- You have direct relationships with data consumers -- You want full control over each access grant -- Your data is processed by specific iApps -- Simple pricing model is sufficient - -### πŸͺ **Choose DataProtector Sharing when** - -- You want automated distribution via smart contracts -- Users should purchase access autonomously without your involvement -- You need flexible pricing models (free, rental, subscription) -- You want to build a data business with recurring revenue - -## Real-World Example - -**Want to see data monetization in action?** Check out our **Content Creator -demo** that showcases DataProtector Sharing with real file transfers: - -**[Content Creator Demo](/overview/use-case-demo/content-creator)** - A complete -app demonstrating collections, rentals, and subscriptions for content -monetization. - -::: tip Live Example -The Content Creator demo uses a content-delivery iApp for -file transfers, but the same monetization patterns apply to **any iApp and use -case** - AI model inference, data analysis, oracle feeds, Web3Mail, etc. -::: - -## Next Steps - -**Ready to start monetizing your data?** Here are your next steps: - -- **See it in action**: Try the - [Content Creator demo](/overview/use-case-demo/content-creator) to understand - the full flow -- **Start simple**: Begin with - [pay-per-use via grantAccess](/manage-data/guides/create-and-share-access) -- **Explore sharing**: Try - [DataProtector Sharing](/manage-data/dataProtector/dataProtectorSharing) for - automated distribution -- **Build collections**: Learn about - [collection management](/manage-data/dataProtector/dataProtectorSharing/collection) -- **Set up subscriptions**: Implement - [recurring revenue models](/manage-data/dataProtector/dataProtectorSharing/subscription) diff --git a/src/manage-data/guides/monetize-protected-data.md b/src/manage-data/guides/monetize-protected-data.md new file mode 100644 index 00000000..ebeecdef --- /dev/null +++ b/src/manage-data/guides/monetize-protected-data.md @@ -0,0 +1,256 @@ +--- +title: Monetize Protected Data +description: + Explore different ways to monetize your protected data with signed orders + (usage-based) and time-based access (time-period payments) +--- + +# πŸ’° Monetize Protected Data + +**Your protected data can generate revenue automatically.** + +iExec offers two fundamental approaches for monetizing your data: + +- **DataProtector Core**: **Signed orders** with pay-per-use counting - specify + exact conditions, users pay for each individual data processing +- **DataProtector Sharing**: **Time-based access** with period payments - users + pay for unlimited access during specific time periods + +## Signed Orders (DataProtector Core) + +**How it works**: You create and publish signed orders that specify the exact +conditions for accessing your protected data. Each order defines: + +- **Authorized App**: Which iApp can process your data +- **Authorized User**: Who can access your data (specific address or any user) +- **Price per Access**: Cost for each individual use +- **Number of Access**: Maximum times the data can be used +- **Usage Counting**: Each data processing decrements the available access count + +```ts twoslash +import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorCore = new IExecDataProtectorCore(web3Provider); +// ---cut--- +// Create a signed order with specific conditions +const grantedAccess = await dataProtectorCore.grantAccess({ + protectedData: '0x123abc...', // Your data address + authorizedApp: 'email-processor.apps.iexec.eth', // Specific iApp only + authorizedUser: '0x456def...', // Specific user only + pricePerAccess: 5000000000, // 5 RLC per individual use + numberOfAccess: 100, // Maximum 100 total uses +}); + +console.log('Signed order created:', grantedAccess); +``` + +**Perfect for**: + +- Direct partnerships with known clients +- Precise control over access conditions +- Simple setup with specific partners +- Exact counting of data usage + +## Time-Based Access Implementation (DataProtector Sharing) + +**How it works**: Instead of counting individual uses, DataProtector Sharing +provides **time-based access periods**. Users purchase access for specific +durations (hours, days, months) and can use your protected data unlimited times +during that period. Smart contracts handle all distribution automatically. + +**Key Innovation**: Shift from usage counting to time-based access - users buy +access time, not individual transactions. + +**Access Models Available**: + +- **Rental**: Pay once to access to individual protected data (not all the + collection) +- **Subscription**: Recurring payments for ongoing access +- **Sale**: Permanent ownership transfer + +::: tip See It Live + +The [Content Creator demo](/overview/use-case-demo/content-creator) shows +DataProtector Sharing in action with file monetization. While it uses the +content-delivery iApp for file streaming, the same patterns work for any iApp - +AI models, data processing, oracles, etc. + +::: + +### **Step 1: Create a Collection** + +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +// ---cut--- +// Create a collection to group your data and provide +// a set of protectedData available for the subscription. +const collection = await dataProtectorSharing.createCollection(); +console.log('Collection address:', collection.collectionId); + +// Add your protected data to the collection +await dataProtectorSharing.addToCollection({ + protectedData: '0x123abc...', // Your protected data address + collectionId: collection.collectionId, + addOnlyAppWhitelist: '0x256bcd881c33bdf9df952f2a0148f27d439f2e64', // iExec apps whitelist +}); +``` + +### **Step 2: Choose Your Distribution Model** + +**DataProtector Sharing offers tree distribution models:** + +#### 🏠 **Time-Based Rental Model** + +Users pay once for **unlimited access during a specific time period** (not per +use). For a specific protectedData of the created collection : + +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +// ---cut--- +// DATA OWNER: Set up time-based rental terms +await dataProtectorSharing.setProtectedDataToRenting({ + protectedData: '0x123abc...', + price: 5000000000, // 5 RLC for the entire period + duration: 604800, // 7 days of unlimited access +}); + +// CLIENT/SUBSCRIBER: Rent access for the full time period +const rental = await dataProtectorSharing.rentProtectedData({ + protectedData: '0x123abc...', + price: 5000000000, // One payment for full period + duration: 604800, // Unlimited use for 7 days +}); +``` + +**Perfect for**: + +- Time-sensitive datasets (event data, seasonal trends) +- Expensive datasets where users need intensive short-term access +- Content that loses value over time +- Users who need to run multiple analyses during a period + +#### πŸ“… **Time-Based Subscription Model** + +Users pay for **recurring time-based access** to a bundle of data. Unlimited +usage during each subscription period. + +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); + +// Mock collection for the example +const collection = { collectionId: 123 }; +// ---cut--- +// DATA OWNER: Set time-based subscription parameters +await dataProtectorSharing.setSubscriptionParams({ + collectionId: collection.collectionId, + price: 20000000000, // 20 RLC per 30-day period + duration: 2592000, // 30 days unlimited access +}); + +// DATA OWNER: Add protected data to the time-based subscription bundle +await dataProtectorSharing.setProtectedDataToSubscription({ + protectedData: '0x123abc...', +}); + +// DATA OWNER: Add more data to the same subscription +await dataProtectorSharing.setProtectedDataToSubscription({ + protectedData: '0x456def...', // Additional dataset +}); + +// CLIENT/SUBSCRIBER: Get time-based subscription access +const subscription = await dataProtectorSharing.subscribeToCollection({ + collectionId: collection.collectionId, + price: 20000000000, // Pay for full period + duration: 2592000, // 30 days unlimited usage +}); +``` + +**Perfect for**: + +- Growing datasets (daily market data, news feeds) +- Educational content series +- Research datasets that expand over time +- SaaS-style data access + +#### πŸ’Έ **Sale Model** + +Transfer permanent ownership of your data to the buyer. + +```ts twoslash +import { + IExecDataProtectorSharing, + getWeb3Provider, +} from '@iexec/dataprotector'; + +const web3Provider = getWeb3Provider('PRIVATE_KEY'); +const dataProtectorSharing = new IExecDataProtectorSharing(web3Provider); +// ---cut--- +// DATA OWNER: List data for sale +await dataProtectorSharing.setProtectedDataForSale({ + protectedData: '0x123abc...', + price: 100000000000, // 100 RLC purchase price +}); + +// CLIENT/BUYER: Purchase ownership +const purchase = await dataProtectorSharing.buyProtectedData({ + protectedData: '0x123abc...', + price: 100000000000, +}); +``` + +**Perfect for**: + +- Unique datasets or models +- Digital assets and NFT data +- One-time valuable insights +- When you want to exit data ownership + +## Which Approach to Choose? + +| **Signed Orders (Core)** | **Time-Based Access (Sharing)** | +| ---------------------------- | ------------------------------- | +| Usage counting & pay-per-use | Time periods & unlimited usage | +| Direct signed orders | Smart contract automation | +| High control, simple setup | Medium control, flexible models | + +**Choose Signed Orders when**: You need precise control, direct partnerships, +and usage-based billing. + +**Choose Time-Based Access when**: You want automated distribution, unlimited +usage periods, and flexible pricing models. + +## Next Steps + +**Ready to start monetizing your data?** Here are your next steps: + +- **See it in action**: Try the + [Content Creator demo](/overview/use-case-demo/content-creator) to understand + the full flow +- **Start simple**: Begin with + [pay-per-use via grantAccess](/manage-data/guides/create-and-share-access) +- **Explore sharing**: Try + [DataProtector Sharing](/manage-data/dataProtector/dataProtectorSharing) for + automated distribution +- **Build collections**: Learn about + [collection management](/manage-data/dataProtector/dataProtectorSharing/collection) +- **Set up subscriptions**: Implement + [recurring revenue models](/manage-data/dataProtector/dataProtectorSharing/subscription) From 922460659aecdff8a582d725dbb0e9e1af44b082 Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Sun, 3 Aug 2025 22:02:28 +0200 Subject: [PATCH 04/22] feat: add check-format script to package.json for code formatting checks --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index c89f4665..e443fa93 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "dev": "vitepress dev", "build": "vitepress build", "preview": "vitepress preview", + "check-format": "prettier --ignore-path .gitignore --check .", "format": "prettier --ignore-path .gitignore --write ." }, "dependencies": { From a9f63d64a2bf3bbb8ad6f48987c2f6af94c37abd Mon Sep 17 00:00:00 2001 From: Robin Le Caignec <72495599+Le-Caignec@users.noreply.github.com> Date: Mon, 4 Aug 2025 09:08:57 +0200 Subject: [PATCH 05/22] Update src/manage-data/guides/monetize-protected-data.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/manage-data/guides/monetize-protected-data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/guides/monetize-protected-data.md b/src/manage-data/guides/monetize-protected-data.md index ebeecdef..f1b54dd0 100644 --- a/src/manage-data/guides/monetize-protected-data.md +++ b/src/manage-data/guides/monetize-protected-data.md @@ -104,7 +104,7 @@ await dataProtectorSharing.addToCollection({ ### **Step 2: Choose Your Distribution Model** -**DataProtector Sharing offers tree distribution models:** +**DataProtector Sharing offers three distribution models:** #### 🏠 **Time-Based Rental Model** From 3e3b598ce87e0aeb9f698494afbbaf7457557a5a Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Mon, 4 Aug 2025 12:32:14 +0200 Subject: [PATCH 06/22] refactor: remove deprecated guides and update sidebar links --- .vitepress/sidebar.ts | 1 - src/manage-data/guides.md | 48 --------------------------------------- 2 files changed, 49 deletions(-) delete mode 100644 src/manage-data/guides.md diff --git a/.vitepress/sidebar.ts b/.vitepress/sidebar.ts index d5d3eff8..6a0aa60c 100644 --- a/.vitepress/sidebar.ts +++ b/.vitepress/sidebar.ts @@ -65,7 +65,6 @@ export function getSidebar() { }, { text: 'πŸ“– Guides', - link: '/manage-data/guides', items: [ { text: 'Create and Share Access to Protected Data', diff --git a/src/manage-data/guides.md b/src/manage-data/guides.md deleted file mode 100644 index 7798a4a3..00000000 --- a/src/manage-data/guides.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: DataProtector Guides -description: - Step-by-step guides for protecting, managing, and monetizing your data with - iExec DataProtector ---- - -# πŸ“– DataProtector Guides - -**Master data protection, sharing, and monetization** with these comprehensive -step-by-step guides. Each guide focuses on a specific aspect of building with -DataProtector. - -## Essential Guides - -### πŸ›‘οΈ [Create and Share Access to Protected Data](/manage-data/guides/create-and-share-access) - -**Start here if you're new to DataProtector.** Learn how to protect your data -and control exactly who can access it. - -- Protect data with client-side encryption -- Grant access to specific users and apps -- Set pricing and usage limits -- Debug mode for development - ---- - -### 🏷️ [Handle Schemas and Dataset Types](/manage-data/guides/handle-schemas-dataset-types) - -**Understand how your data structure works with iApps.** Learn about automatic -schema generation and how to use data types effectively. - -- Auto-generated schemas from your JSON data -- Supported data types and format conversion -- Using schemas in iApp development -- Type safety and error handling - ---- - -### πŸ’° [Monetize Protected Data](/manage-data/guides/monetize-protected-data) - -**Turn your protected data into revenue.** Explore different monetization -strategies from simple pay-per-use to advanced marketplace distribution. - -- Pay-per-use with DataProtector Core -- DataProtector Sharing with collections -- Rental, subscription, and sale models -- Revenue optimization strategies From d1ac3ecfbb8f4e64a3990423a0576cfce89746bc Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Mon, 4 Aug 2025 12:33:38 +0200 Subject: [PATCH 07/22] refactor: improve formatting and readability of schema documentation --- .../guides/handle-schemas-dataset-types.md | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/manage-data/guides/handle-schemas-dataset-types.md b/src/manage-data/guides/handle-schemas-dataset-types.md index ecd46917..a6885cb0 100644 --- a/src/manage-data/guides/handle-schemas-dataset-types.md +++ b/src/manage-data/guides/handle-schemas-dataset-types.md @@ -57,8 +57,12 @@ console.log('πŸ“ Address:', protectedData.address); } ``` -::: info Schema Structure The schema automatically maps your data structure to -types that iApps can understand and validate. ::: +::: info Schema Structure + +The schema automatically maps your data structure to types that iApps can +understand and validate. + +::: ## Supported Data Types @@ -73,8 +77,12 @@ The schema automatically detects these types: | `application/octet-stream` | Binary data | File contents | | `image/jpeg`, `image/png`, etc. | Media files | Images, videos | -::: tip Auto-Detection The SDK automatically detects file types based on -content. No need to specify MIME types manually. ::: +::: tip Auto-Detection + +The SDK automatically detects file types based on content. No need to specify +MIME types manually. + +::: ## Why Schemas Matter @@ -232,9 +240,12 @@ const fileData = await dataProtectorCore.protectData({ Once you have protected data with a schema, you'll want to process it inside an iApp. -::: warning Type Matching **Your iApp and frontend must use the same field names -and types.** If they don't match, you'll get runtime errors when processing the -data. ::: +::: warning Type Matching + +**Your iApp and frontend must use the same field names and types.** If they +don't match, you'll get runtime errors when processing the data. + +::: β†’ **Ready to build an iApp?** Check out our detailed [Inputs and Outputs guide](/build-iapp/guides/inputs-and-outputs) to learn how From 4b540d92bb8062e836e2aec3df6d5cc5b9f17ffa Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Mon, 4 Aug 2025 12:35:23 +0200 Subject: [PATCH 08/22] refactor: enhance section headers with emojis for better visual distinction --- src/manage-data/guides/monetize-protected-data.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/manage-data/guides/monetize-protected-data.md b/src/manage-data/guides/monetize-protected-data.md index f1b54dd0..90ca0e08 100644 --- a/src/manage-data/guides/monetize-protected-data.md +++ b/src/manage-data/guides/monetize-protected-data.md @@ -16,7 +16,7 @@ iExec offers two fundamental approaches for monetizing your data: - **DataProtector Sharing**: **Time-based access** with period payments - users pay for unlimited access during specific time periods -## Signed Orders (DataProtector Core) +## πŸ“ Signed Orders (DataProtector Core) **How it works**: You create and publish signed orders that specify the exact conditions for accessing your protected data. Each order defines: @@ -52,7 +52,7 @@ console.log('Signed order created:', grantedAccess); - Simple setup with specific partners - Exact counting of data usage -## Time-Based Access Implementation (DataProtector Sharing) +## πŸ“… Time-Based Access Implementation (DataProtector Sharing) **How it works**: Instead of counting individual uses, DataProtector Sharing provides **time-based access periods**. Users purchase access for specific @@ -106,7 +106,7 @@ await dataProtectorSharing.addToCollection({ **DataProtector Sharing offers three distribution models:** -#### 🏠 **Time-Based Rental Model** +#### **Time-Based Rental Model** Users pay once for **unlimited access during a specific time period** (not per use). For a specific protectedData of the created collection : @@ -142,7 +142,7 @@ const rental = await dataProtectorSharing.rentProtectedData({ - Content that loses value over time - Users who need to run multiple analyses during a period -#### πŸ“… **Time-Based Subscription Model** +#### **Time-Based Subscription Model** Users pay for **recurring time-based access** to a bundle of data. Unlimited usage during each subscription period. @@ -191,7 +191,7 @@ const subscription = await dataProtectorSharing.subscribeToCollection({ - Research datasets that expand over time - SaaS-style data access -#### πŸ’Έ **Sale Model** +#### **Sale Model** Transfer permanent ownership of your data to the buyer. From e9950add805cfc4c74637549d9897d0b6b64d702 Mon Sep 17 00:00:00 2001 From: akugone Date: Mon, 4 Aug 2025 15:42:21 +0200 Subject: [PATCH 09/22] refactor: enhance 'What Is Protected Data?' documentation with improved structure and visual elements --- src/manage-data/what-is-protected-data.md | 234 ++++++++++++++++++---- 1 file changed, 199 insertions(+), 35 deletions(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index eb29223d..573cf4e2 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -5,54 +5,218 @@ description: Understanding iExec's data protection mechanisms # ❓ What Is Protected Data? -Protected Data is iExec's revolutionary approach to data privacy and ownership. -It allows you to maintain control over your data while enabling computation on -it without exposing the raw information. +
+

Data Protection Made Simple

+

Learn how iExec's DataProtector keeps your sensitive information secure while enabling powerful computation and monetization.

+
-## Key Concepts - -### Data Ownership - -- **You own your data**: The original data never leaves your control -- **Granular permissions**: Decide who can access and use your data -- **Revocable access**: Grant and revoke permissions at any time +Protected Data refers to any data encrypted using the iExec Data Protector tool. +This end-to-end encryption solution enables users to protect, manage and +monetize their data within the Web3 ecosystem. -### Privacy-Preserving Computation +
+

Unlike standard datasets, Protected Data exposes only its data types on-chain (for example, indicating that it contains an email address or a photo). This allows anyone to identify entries with specific types.

+
-- **Encrypted processing**: Data is encrypted during computation -- **TEE (Trusted Execution Environment)**: Secure enclaves protect data during - processing -- **Zero-knowledge**: Compute on data without revealing it - -### Monetization +## Key Concepts -- **Data marketplaces**: Sell access to your protected data -- **Usage tracking**: Monitor how your data is being used -- **Fair compensation**: Get paid for data usage +### πŸ‘‘ Data Ownership + +
+ +
+
+
+ β€’ +
+ You own your data: The original data never leaves your control +
+
+
+ β€’ +
+ Granular permissions: Decide who can access and use your data +
+
+
+ β€’ +
+ Revocable access: Grant and revoke permissions at any time +
+
+
+
+ +### πŸ”’ Privacy-Preserving Computation + +
+ +
+
+
+ β€’ +
+ Encrypted processing: Data is encrypted during computation +
+
+
+ β€’ +
+ TEE (Trusted Execution Environment): Secure enclaves protect data during processing +
+
+
+ β€’ +
+ Zero-knowledge: Compute on data without revealing it +
+
+
+
+ +### πŸ’° Monetization + +
+ +
+
+
+ β€’ +
+ Data marketplaces: Sell access to your protected data +
+
+
+ β€’ +
+ Usage tracking: Monitor how your data is being used +
+
+
+ β€’ +
+ Fair compensation: Get paid for data usage +
+
+
+
## How It Works -1. **Protect**: Encrypt and register your data on the iExec network -2. **Share**: Grant access permissions to specific users or applications -3. **Monitor**: Track usage and maintain control -4. **Monetize**: Earn from your data while keeping it private +
+
+
+ 1. +
+ Protect: Encrypt and register your data on the iExec network +
+
+
+ 2. +
+ Share: Authorize specific users and applications to access your data +
+
+
+ 3. +
+ Monitor: Track usage and maintain control +
+
+
+ 4. +
+ Monetize: Earn from your data while keeping it private +
+
+
+ 5. +
+ Compute: Authorized users can compute on your data with the authorized iApps +
+
+
+
## Use Cases -- **Personal Data**: Health records, financial data, personal preferences -- **Business Intelligence**: Market research, customer analytics, proprietary - datasets -- **AI Training**: Training models without exposing sensitive data -- **Research**: Collaborative research with privacy guarantees +
+
+
+ πŸ‘€ +

Personal Data

+
+
    +
  • Health records
  • +
  • Financial data
  • +
  • Personal preferences
  • +
+
+ +
+
+ 🏒 +

Business Intelligence

+
+
    +
  • Market research
  • +
  • Customer analytics
  • +
  • Proprietary datasets
  • +
+
+ +
+
+ πŸ€– +

AI Training

+
+
    +
  • Training models without exposing sensitive data
  • +
  • Federated learning
  • +
  • Privacy-preserving ML
  • +
+
+ +
+
+ πŸ”¬ +

Research

+
+
    +
  • Collaborative research with privacy guarantees
  • +
  • Cross-institutional studies
  • +
  • Clinical trial data
  • +
+
+
+ +
+

Ready to protect your data? Start with our DataProtector guides and learn how to secure your sensitive information while unlocking its value.

+
## Next Steps -Ready to protect your data? Check out: - -- [Getting Started with DataProtector](/manage-data/dataProtector/getting-started) -- [DataProtector Guides](/manage-data/guides) +
+
+
+ πŸš€ +
+ Getting Started: DataProtector Quick Start Guide +
+
+
+ πŸ“š + +
+
+
+ +
+

Protect your data, maintain control, and unlock its value with iExec's DataProtector - the complete solution for privacy-first data management.

+
--- -_Protect your data, maintain control, and unlock its value with iExec's -DataProtector._ +_Ready to take control of your data? Start protecting what matters most._ From e62d754f762993befc342917353fe12774d2b238 Mon Sep 17 00:00:00 2001 From: akugone Date: Mon, 4 Aug 2025 15:52:10 +0200 Subject: [PATCH 10/22] refactor: simplify and enhance 'What Is Protected Data?' section for clarity and readability --- src/manage-data/what-is-protected-data.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index 573cf4e2..f7397a22 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -5,13 +5,8 @@ description: Understanding iExec's data protection mechanisms # ❓ What Is Protected Data? -
-

Data Protection Made Simple

-

Learn how iExec's DataProtector keeps your sensitive information secure while enabling powerful computation and monetization.

-
- -Protected Data refers to any data encrypted using the iExec Data Protector tool. -This end-to-end encryption solution enables users to protect, manage and +Protected Data refers to any data encrypted using the **iExec Data Protector +tool**. This end-to-end encryption solution enables users to protect, manage and monetize their data within the Web3 ecosystem.
From 8edf3be00cede281d1b5d9ab6000a61819a41607 Mon Sep 17 00:00:00 2001 From: akugone Date: Mon, 4 Aug 2025 15:53:39 +0200 Subject: [PATCH 11/22] refactor: remove promotional content from 'What Is Protected Data?' section to enhance focus on data management --- src/manage-data/what-is-protected-data.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index f7397a22..388b699b 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -207,11 +207,3 @@ monetize their data within the Web3 ecosystem.
- -
-

Protect your data, maintain control, and unlock its value with iExec's DataProtector - the complete solution for privacy-first data management.

-
- ---- - -_Ready to take control of your data? Start protecting what matters most._ From b795fdf3ccc08c90903e87e7f07ebac3c9ab7b01 Mon Sep 17 00:00:00 2001 From: akugone Date: Mon, 4 Aug 2025 16:22:51 +0200 Subject: [PATCH 12/22] refactor: clarify data protection and schema documentation for improved understanding and usability --- src/manage-data/guides/create-and-share-access.md | 12 ++++++------ .../guides/handle-schemas-dataset-types.md | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/manage-data/guides/create-and-share-access.md b/src/manage-data/guides/create-and-share-access.md index 40ba3f40..2839ffe6 100644 --- a/src/manage-data/guides/create-and-share-access.md +++ b/src/manage-data/guides/create-and-share-access.md @@ -13,8 +13,8 @@ Here's how DataProtector works: first you encrypt your data, then manage your orders to control exactly who can access it, how many times, and at what price. Once data is protected, it's only accessible inside secure enclaves (TEEs) by -the specific people and iApps you authorize through the orders you create. No -exceptions. +the specific users and iApps (iExec application running in TEE) you authorize +through the orders you create. No exceptions. ## Installation @@ -65,12 +65,12 @@ console.log('Protected data address:', protectedData.address); ### What You Can Protect -**Data**: Any JSON object with custom keys. Think user profiles, API -credentials, datasets, model parameters - anything you want to keep private but -still use in computations. +**Data**: Any kind of data you want to keep private and make available for +computations by authorized users and iApps. **Supported types**: Strings, numbers, booleans, nested objects, files (convert -to ArrayBuffer first), and arrays (convert to Record format). +to ArrayBuffer first), and arrays (convert to Record format), you can find the +full list [here](/manage-data/dataProtector/types) **Limits**: File size depends on your storage choice (IPFS or Arweave). For large datasets, consider using another IPFS node. diff --git a/src/manage-data/guides/handle-schemas-dataset-types.md b/src/manage-data/guides/handle-schemas-dataset-types.md index a6885cb0..17d865cb 100644 --- a/src/manage-data/guides/handle-schemas-dataset-types.md +++ b/src/manage-data/guides/handle-schemas-dataset-types.md @@ -86,6 +86,11 @@ MIME types manually. ## Why Schemas Matter +- **Clarity**: Makes your data easier to understand and reuse +- **Safety**: Ensures iExec apps don’t process the wrong data +- **Structure**: Facilitates structured communication between **front-end and + iApp logic** + ### 🎯 **For iApp Development** Schemas let your iApps validate and process data safely: From 013a196138afae829b19eb1f5eb8f4cb0d73a0f0 Mon Sep 17 00:00:00 2001 From: akugone Date: Mon, 4 Aug 2025 16:37:55 +0200 Subject: [PATCH 13/22] refactor: streamline DataProtector types documentation with enhanced clarity and structure --- src/manage-data/dataProtector/types.md | 153 ++++++++++--------------- 1 file changed, 60 insertions(+), 93 deletions(-) diff --git a/src/manage-data/dataProtector/types.md b/src/manage-data/dataProtector/types.md index 9940edd0..878873c5 100644 --- a/src/manage-data/dataProtector/types.md +++ b/src/manage-data/dataProtector/types.md @@ -2,129 +2,97 @@ Types in DataProtector. -## GrantedAccess +## πŸ”‘ GrantedAccess -### dataset +### dataset: `string` -`string` +- Address of the `protectedData` containing user data -Address of the `protectedData` containing user data +### datasetprice: `string` -### datasetprice +- Price (iun nRLC) to charge the user specified in `requesterrestrict` for each + use of this `protectedData` -`string` +### volume: `string` -Price (iun nRLC) to charge the user specified in `requesterrestrict` for each -use of this `protectedData` +- Number of authorized uses of this `protectedData`; each use decrements this + counter -### volume +### tag: `string` -`string` +- Defines whether a `protectedData` is usable in a TEE environment; `0x00` is + TEE while `0x03` is non-TEE -Number of authorized uses of this `protectedData`; each use decrements this -counter +### apprestrict: `string` -### tag +- Address of the authorized application; a value of 0x0 indicates any + application may access this data -`string` +### requesterrestrict: `string` -Defines whether a `protectedData` is usable in a TEE environment; `0x00` is TEE -while `0x03` is non-TEE +- Address of the requester authorized to use this `protectedData` in workloads; + a value of 0x0 indicates any requester may use this data -### apprestrict +### workerpoolrestrict: `string` -`string` +- Address of the decentralized infrastructure (worker pool) authorized to + execute the application; a value of 0x0 indicates any worker pool may access + this data -Address of the authorized application; a value of 0x0 indicates any application -may access this data +### salt: `string` -### requesterrestrict +- Random value to make an order unique and reusable as nonce in a blockchain + transaction -`string` +### sign: `string` -Address of the requester authorized to use this `protectedData` in workloads; a -value of 0x0 indicates any requester may use this data +- Order signature of all the `grantedAccess` fields -### workerpoolrestrict +## πŸ” ProtectedData -`string` +### name: `string` -Address of the decentralized infrastructure (worker pool) authorized to execute -the application; a value of 0x0 indicates any worker pool may access this data +- Name specified when the protected data was created. This piece of information + is public and visible on-chain. -### salt +### address: `Address` -`string` +- Ethereum address of the protected data. -Random value to make an order unique and reusable as nonce in a blockchain -transaction +### owner: `Address` -### sign +- Ethereum address of the protected data owner. -`string` +### schema: `DataSchema` -Order signature of all the `grantedAccess` fields +- Data schema for the protected data as defined when the protected data was + created (see [protectedData](./dataProtectorCore/protectData.md)). `schema` + provides a structured representation of the protected data format and + attributes. This field plays a crucial role in understanding and interpreting + the underlying structure of the sensitive information. -## ProtectedData +### creationTimestamp: `number` -### name +- Timestamp specifying when the protected data was created, expressed in + milliseconds since the epoch. This timestamp provides precise information + about the moment of creation and can be used for chronological ordering or + time-based operations. -`string` +### multiaddr: `string` | `undefined` -Name specified when the protected data was created. This piece of information is -public and visible on-chain. +- The multiaddr field is the IPFS path of your encrypted data. -### address +## ❌ RevokedAccess -`Address` +### access: [`GrantedAccess`](./types.md#grantedaccess) -Ethereum address of the protected data. +- The granted access that was revoked. -### owner +### txHash: `string` -`Address` - -Ethereum address of the protected data owner. - -### schema - -`DataSchema` - -Data schema for the protected data as defined when the protected data was -created (see [protectedData](./dataProtectorCore/protectData.md)). `schema` -provides a structured representation of the protected data format and -attributes. This field plays a crucial role in understanding and interpreting -the underlying structure of the sensitive information. - -### creationTimestamp - -`number` - -Timestamp specifying when the protected data was created, expressed in -milliseconds since the epoch. This timestamp provides precise information about -the moment of creation and can be used for chronological ordering or time-based -operations. - -### multiaddr - -`string` | `undefined` - -The multiaddr field is the IPFS path of your encrypted data. - -## RevokedAccess - -### access - -[`GrantedAccess`](./types.md#grantedaccess) - -The granted access that was revoked. - -### txHash - -`string` - -The ID of the transaction that happened on iExec's side chain. You may view -details on the transaction using the [iExec explorer](https://explorer.iex.ec). +- The ID of the transaction that happened on iExec's side chain. You may view + details on the transaction using the + [iExec explorer](https://explorer.iex.ec). _Hash example:_ `0xc9c2d58fc01fe54149b7daf49a0026d4ab1fdd3d10fb7c76350790fff03fe24d` @@ -133,14 +101,13 @@ _Hash example:_ `0xc9c2d58fc01fe54149b7daf49a0026d4ab1fdd3d10fb7c76350790fff03fe You can read more about he iExec Explorer [here](https://protocol.docs.iex.ec/for-developers/toolbox/iexec-explorer). -## SuccessWithTransactionHash - -### txHash +## βœ… SuccessWithTransactionHash -`string` +### txHash: `string` -The hash of the transaction that happened on iExec's side chain. You may view -details on the transaction using the [iExec explorer](https://explorer.iex.ec). +- The hash of the transaction that happened on iExec's side chain. You may view + details on the transaction using the + [iExec explorer](https://explorer.iex.ec). _Hash example:_ `0xc9c2d58fc01fe54149b7daf49a0026d4ab1fdd3d10fb7c76350790fff03fe24d` From 52bf30da45e13cde82a32f9a693f97552c61ade7 Mon Sep 17 00:00:00 2001 From: akugone Date: Mon, 4 Aug 2025 17:05:05 +0200 Subject: [PATCH 14/22] refactor: enhance clarity and conciseness in DataProtector access management documentation --- .../guides/create-and-share-access.md | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/manage-data/guides/create-and-share-access.md b/src/manage-data/guides/create-and-share-access.md index 2839ffe6..08406e9c 100644 --- a/src/manage-data/guides/create-and-share-access.md +++ b/src/manage-data/guides/create-and-share-access.md @@ -9,12 +9,9 @@ description: **Want to keep your data private while still using it in confidential applications?** -Here's how DataProtector works: first you encrypt your data, then manage your -orders to control exactly who can access it, how many times, and at what price. - -Once data is protected, it's only accessible inside secure enclaves (TEEs) by -the specific users and iApps (iExec application running in TEE) you authorize -through the orders you create. No exceptions. +DataProtector lets you encrypt data and control access through orders - +specifying who can use it, how many times, and at what price.Protected data is +only accessible in secure enclaves (TEEs) by authorized users and iApps. ## Installation @@ -68,12 +65,11 @@ console.log('Protected data address:', protectedData.address); **Data**: Any kind of data you want to keep private and make available for computations by authorized users and iApps. -**Supported types**: Strings, numbers, booleans, nested objects, files (convert -to ArrayBuffer first), and arrays (convert to Record format), you can find the -full list [here](/manage-data/dataProtector/types) +**Supported types**: Common data types like text, numbers, true/false values, +and files. See the [full list here](/manage-data/dataProtector/types). -**Limits**: File size depends on your storage choice (IPFS or Arweave). For -large datasets, consider using another IPFS node. +**Storage**: Store your data on IPFS or Arweave. For larger files, you can use +your own IPFS node. ::: tip @@ -106,12 +102,15 @@ const protectedData = await dataProtectorCore.protectData({ ## Grant Access -**Here's the key:** The protocol blocks all access to your protected data by -default. You must explicitly grant permission for each app and user combination. -By doing this, you publish signed orders that ensure your protected data stays -private while controlling access to it. +By default, your protected data is private. To let others use it, you need to +grant access to both: + +- An authorized user (who can trigger the processing) +- An authorized iApp (the application that will process the data in the private + environment) -Once you own protected data, here's how to share access: +This ensures that only specific users can use specific applications to process +your data. Here's how to set it up: ```ts twoslash import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector'; From 41c40166b91740e865aab38121e2f9aef85003c8 Mon Sep 17 00:00:00 2001 From: Robin Le Caignec <72495599+Le-Caignec@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:27:29 +0200 Subject: [PATCH 15/22] Update src/manage-data/guides/create-and-share-access.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/manage-data/guides/create-and-share-access.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/guides/create-and-share-access.md b/src/manage-data/guides/create-and-share-access.md index 08406e9c..b91de133 100644 --- a/src/manage-data/guides/create-and-share-access.md +++ b/src/manage-data/guides/create-and-share-access.md @@ -10,7 +10,7 @@ description: applications?** DataProtector lets you encrypt data and control access through orders - -specifying who can use it, how many times, and at what price.Protected data is +specifying who can use it, how many times, and at what price. Protected data is only accessible in secure enclaves (TEEs) by authorized users and iApps. ## Installation From b78925323c78900e771e65d9d58be5fb998a3e7f Mon Sep 17 00:00:00 2001 From: Robin Le Caignec <72495599+Le-Caignec@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:27:36 +0200 Subject: [PATCH 16/22] Update src/manage-data/what-is-protected-data.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/manage-data/what-is-protected-data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index 388b699b..e044785d 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -124,7 +124,7 @@ monetize their data within the Web3 ecosystem. Monetize: Earn from your data while keeping it private -
+
5.
Compute: Authorized users can compute on your data with the authorized iApps From fc3d43873cb095edf32c6ce662c01295b93e82d0 Mon Sep 17 00:00:00 2001 From: akugone Date: Tue, 5 Aug 2025 09:31:25 +0200 Subject: [PATCH 17/22] refactor: swap headings in DataProtector documentation for improved clarity and user navigation --- src/manage-data/what-is-protected-data.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index 388b699b..8b8345cc 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -194,15 +194,15 @@ monetize their data within the Web3 ecosystem.
- πŸš€ + πŸ“š
- πŸ“š + πŸš€
From 712bcf530e19097081f4275a6bdab6070dfbacfb Mon Sep 17 00:00:00 2001 From: MartinLeclercq Date: Tue, 5 Aug 2025 09:34:35 +0200 Subject: [PATCH 18/22] Apply suggestions from code review Co-authored-by: Robin Le Caignec <72495599+Le-Caignec@users.noreply.github.com> --- src/manage-data/what-is-protected-data.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index 29cd8032..bd6e5593 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -10,12 +10,12 @@ tool**. This end-to-end encryption solution enables users to protect, manage and monetize their data within the Web3 ecosystem.
-

Unlike standard datasets, Protected Data exposes only its data types on-chain (for example, indicating that it contains an email address or a photo). This allows anyone to identify entries with specific types.

+

Unlike standard datasets, Protected Data exposes its data types on-chain (for example, indicating that it contains an email address or a photo). This allows anyone to identify entries with the corresponding types.

## Key Concepts -### πŸ‘‘ Data Ownership +### πŸ‘‘ Data Governance
From 350c31bec9b8ad0582e796d372cc991d49b36315 Mon Sep 17 00:00:00 2001 From: MartinLeclercq Date: Tue, 5 Aug 2025 09:35:05 +0200 Subject: [PATCH 19/22] Update src/manage-data/what-is-protected-data.md --- src/manage-data/what-is-protected-data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index bd6e5593..031555bd 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -51,7 +51,7 @@ monetize their data within the Web3 ecosystem.
β€’
- Encrypted processing: Data is encrypted during computation + Encrypted Processing: Maintains a complete chain of trust.
From e18c3a0141afbf33de6e0060ae84aa169e7c7950 Mon Sep 17 00:00:00 2001 From: akugone Date: Tue, 5 Aug 2025 09:39:08 +0200 Subject: [PATCH 20/22] fix: update link in 'What Is Protected Data?' section to direct users to the complete DataProtector documentation --- src/manage-data/what-is-protected-data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index 031555bd..d32c91ec 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -196,7 +196,7 @@ monetize their data within the Web3 ecosystem.
From ce4f7b9a8582af4f3f3ec56ff7af373858a2b3fe Mon Sep 17 00:00:00 2001 From: akugone Date: Tue, 5 Aug 2025 09:39:23 +0200 Subject: [PATCH 21/22] refactor: update terminology in 'What Is Protected Data?' section to enhance clarity on secret storage --- src/manage-data/what-is-protected-data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/what-is-protected-data.md b/src/manage-data/what-is-protected-data.md index d32c91ec..44afe224 100644 --- a/src/manage-data/what-is-protected-data.md +++ b/src/manage-data/what-is-protected-data.md @@ -63,7 +63,7 @@ monetize their data within the Web3 ecosystem.
β€’
- Zero-knowledge: Compute on data without revealing it + Secret storage: Secrets stored in a TEE database.
From d7c6ea8ef95b64f22403377c37388541b3e1ab43 Mon Sep 17 00:00:00 2001 From: Le-Caignec Date: Tue, 5 Aug 2025 09:39:49 +0200 Subject: [PATCH 22/22] fix: update link in 'RevokedAccess' section to correctly reference 'GrantedAccess' --- src/manage-data/dataProtector/types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manage-data/dataProtector/types.md b/src/manage-data/dataProtector/types.md index 878873c5..96881529 100644 --- a/src/manage-data/dataProtector/types.md +++ b/src/manage-data/dataProtector/types.md @@ -84,7 +84,7 @@ Types in DataProtector. ## ❌ RevokedAccess -### access: [`GrantedAccess`](./types.md#grantedaccess) +### access: [`GrantedAccess`](#πŸ”‘-grantedaccess) - The granted access that was revoked.