iExec RLC 백서

iExec RLC

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 12쪽 중 5쪽

e" : "string" , "lastName" : "string" }, "contact" : { "email" : "string" , "phone" : "string" }, "preferences" : { "marketing" : "bool" , "notifications" : "bool" } } File Data ​ ts const fileBuffer = await createArrayBufferFromFile ( file ); const fileData = await dataProtectorCore . protectData ({ data : { fileName : file . name , fileContent : fileBuffer , uploadDate : Date . now (), }, }); 🏷️ Schema for file upload: json { "fileName" : "string" , "fileContent" : "image/jpeg" , "uploadDate" : "f64" } Using schemas in iApp ​ Once you have protected data with a schema, you'll want to process it inside an iApp. 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 guide 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 to create your first data processor Process data : Learn about processProtectedData for running computations See it in action : Try our Hello World tutorial for a complete example ## /guides/manage-data/monetize-protected-data Monetize Protected Data ​ Transform your encrypted data into a sustainable revenue stream. iExec DataProtector enables you to monetize your protected data through signed orders - a flexible system that lets you specify exact conditions for data access. Whether you're a data provider, researcher, or business owner, you can generate income from your valuable datasets while maintaining complete privacy and control. How it works : You create and publish signed orders that define who can access your data, how much they pay per use, and how many times they can access it. Users pay automatically each time they process your data, giving you precise control over monetization. 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 // 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 ## /guides/build-iapp/deploy-&-run Deploy and Run an iApp ​ It's time to run your iApp! After building and testing, you'll need to deploy it to a supported network and then execute it. Prerequisites ​ Before deploying and running your iApp, ensure you have sufficient RLC tokens to cover: Workerpool execution costs for running your iApp on decentralized compute resources Protected Data access fees if your iApp requires confidential datasets (and you're not the data provider) iApp execution costs if you're not the owner of the iApp you're running Getting RLC tokens: Arbitrum Mainnet : Purchase RLC from exchanges or bridge from Ethereum using the RLC Bridge Arbitrum Sepolia Testnet : Get free RLC tokens from the iExec RLC Faucet for testing purposes Deploy your iApp ​ After your tests pass and the package is built, you can deploy your iApp to a supported network. During deployment, you'll enter your DockerHub credentials, specify your app version, and push both standard and TEE-compatible images: Terminal $ iapp deploy --chain arbitrum-mainnet ____ _ | _ \ ___ _ __ | | ___ _ _ | | | |/ _ \ '_ \| |/ _ \| | | | | |_| | __/ |_) | | (_) | |_| | |____/ \___| .__/|_|\___/ \__, | |_| |___/ Now that your iApp has been deployed on the iExec protocol, you can navigate to the cache folder to see your deployments saved. A file named deployments.json in the folder corresponding to your target network will be created containing each deployment made on this network. These files will help you easily track each deployment per network. Here is an example: json [ { "tdxImage" : "robiniexec/iapp:0.0.1-tee-tdx-1.0.0" , "appContractAddress" : "0x9665136c599ec361C8eE627eC4F35A23fBa94897" , "owner" : "0xbabE8270aC9857Af3aaC06877888F1939FbeC578" , "date" : "2025-08-12T13:16:18.252Z" }, ... ] Run your iApp ​ There are multiple ways to execute an iApp on the iExec network. An iApp can be: Self-sufficient - Basic execution without additional inputs Data-dependent - Requires protected data, secrets, input files, or command-line arguments The iApp Generator CLI provides a streamlined way to execute iApp, especially for developers who have built their own iApp. Note : For installation instructions, see the iApp Generator Getting Started guide . Terminal $ iapp run 0x1f80DCebc2EAAff0Db7156413C43B7e88D189923 --chain arbitrum-mainnet _____ _ | ____|_ _____ ___ _ _| |_ ___ | _| \ \/ / _ \/ __| | | | __/ _ \ | |___ > < __/ (__| |_| | || __/ |_____/_/\_\___|\___|\__,_|\__\___| Now that you have run your iApp on the iExec protocol, you can navigate to the cache folder to see your runs saved. A file named runs.json in the folder corresponding to your target network will be created containing each run made on this network. These files will help you easily track each run per network. Use the iExec Explorer to retrieve more data about your tasks. Here is an example: json [ { "iAppAddress" : "0x9665136c599ec361C8eE627eC4F35A23fBa94897" , "dealid" : "0x26d758de1be51697c33fa606cd0c5243082a6e675a4463b106d71fde2893280f" , "taskid" : "0x1a58dd6018b30b022eb35be53ad9374eb630925458d14643a1dfd9c686b964d8" , "txHash" : "0x6f14eac6933c609fb6d3e6b2bbd18c373c6dc99c7d7fd22036d5a20f847c5e42" , "date" : "2025-08-18T18:30:03.711Z" }, ... ] Next Steps ​ Learn how to manage access to your iApp Discover debugging techniques for troubleshooting ## /guides/build-iapp/manage-access Manage Access ​ Orders control who can use your iApp and under what conditions. Once your iApp is deployed with iApp Generator, you need to publish app orders to make it accessible to users and define your governance rules. Think of orders as usage proposals - they define pricing, access restrictions, and execution conditions for your app. What is an Order? ​ An app order is a signed proposal that defines the usage conditions for your iApp: Price per execution (in nRLC) Number of authorized uses Access restrictions (specific users, workerpools) TEE configuration (for confidential applications) TIP Currently, order management is not yet available in iApp Generator. This guide shows you how to use the iExec SDK CLI to create and manage your app orders. For complete SDK documentation, check the iExec SDK documentation . How Orders Work ​ Here's the simplified process: You create an app order with your conditions (price, restrictions, etc.) You sign the order with your wallet You publish the order on the iExec marketplace Users can discover and execute your iApp according to your conditions You automatically receive payment in RLC for each execution Deployed iApp + Published Signed App Order = Application accessible on iExec App Order Example ​ Here's an example app order for a sentiment analysis iApp: json { "app" : "0x123abc..." , // Your iApp address "appprice" : "1000000000" , // 1 RLC per execution "volume" : "100" , // 100 authorized uses "tag" : "0x0000000000000000000000000000000000000000000000000000000000000009" , // Tee Tdx required "datasetrestrict" : "0x0000000000000000000000000000000000000000" , "workerpoolrestrict" : "0x0000000000000000000000000000000000000000" , "requesterrestrict" : "0x0000000000000000000000000000000000000000" } Creating an App Order ​ Step 1: Install the iExec SDK ​ Since iApp Generator doesn't handle orders yet, you need to use the iExec SDK CLI. For detailed installation instructions, see the iExec SDK documentation . npm yarn pnpm bun sh npm install iexec sh yarn add iexec sh pnpm add iexec sh bun add iexec Verify the installation: bash iexec --version iexec --help Step 2: Configure your iExec Project ​ In your iApp Generator project folder, initialize the iExec configuration: bash # In your iApp Generator project folder iexec init --skip-wallet This creates the necessary configuration files: iexec.json - Project configuration chain.json - Blockchain configuration Step 3: Configure your Wallet ​ If you don't have an iExec wallet yet: bash iexec wallet create Or import an existing wallet: bash iexec wallet import < private-ke y > iApp Generator Users If you used iApp Generator, you already have an iapp.config.json file with a generated private key. You can use this existing private key to initialize your wallet: bash # Extract the private key from your `iapp.config.json` iexec wallet import < your-private-ke y > Check your wallet: bash iexec wallet show Step 4: Create the App Order ​ Initialize the app order: bash iexec order init --app This adds an apporder section to your iexec.json . Edit the parameters according to your needs: json { "apporder" : { "app" : "0xYourAppAddress" , "appprice" : "1000000000" , "volume" : "100" , "tag" : "0x0000000000000000000000000000000000000000000000000000000000000009" , "datasetrestrict" : "0x0000000000000000000000000000000000000000" , "workerpoolrestrict" : "0x0000000000000000000000000000000000000000" , "requesterrestrict" : "0x0000000000000000000000000000000000000000" } } Step 5: Sign and Publish the Order ​ Sign your app order with your wallet: bash iexec order sign --app Publish the order on the marketplace: bash iexec order publish --app Your iApp is now accessible according to the conditions you defined! Managing orders ​ View published orders ​ Check active orders for your app: bash iexec orderbook app < your-app-addres s > Modify an Order ​ To change conditions, create a new order with new parameters. Cancel an Order ​ Remove an order from the marketplace: bash iexec order unpublish --app < orderHas h > Completely invalidate an order: bash iexec order cancel --app < orderHas h > Confidential App (TEE Required) ​ json { "appprice" : "2000000000" , "volume" : "500" , "tag" : "0x0000000000000000000000000000000000000000000000000000000000000009" } App order parameters ​ Here's the detailed description of each parameter: app required ​ Description: Ethereum address of your deployed iApp Example: "0x123abc456def..." appprice optional ​ Description: Price to charge per execution (in nano RLC - nRLC) Common values: "0" - Free "1000000000" - 1 RLC per execution "500000000" - 0.5 RLC per execution TIP 1 RLC = 1,000,000,000 nano RLC (10^9) volume optional ​ Description: Number of authorized executions (decrements with each use) Examples: 1 - Single use 100 - Limited campaign 10000 - Virtually unlimited usage tag optional ​ Description: Specifies the required execution environment Supported values: Value Description 0x0000000000000000000000000000000000000000000000000000000000000000 Standard execution 0x0000000000000000000000000000000000000000000000000000000000000009 TEE required ( TDX ) Access restrictions ​ All restrictions use 0x0000000000000000000000000000000000000000 to indicate "no restriction". datasetrestrict optional ​ Description: Restrict usage to a specific dataset Typical usage: 0x0000000000000000000000000000000000000000 (no restriction) workerpoolrestrict optional ​ Description: Restrict execution to a specific workerpool Example: 0x8ef2ec3ef9535d4b4349bfec7d8b31a580e60244 for the main workerpool requesterrestrict optional ​ Description: Restrict usage to a specific user Typical usage: 0x0000000000000000000000000000000000000000 (open to all) What's Next? ​ Your iApp is now accessible with custom conditions! Next steps: Monitor executions : Track usage with iexec task show Adjust pricing : Create new orders based on demand Manage revenue : Check your earnings with iexec account show Technical deep dive ​ iExec SDK Documentation - Complete CLI reference ## /guides/build-iapp/inputs Inputs ​ Your iApp runs inside a secure TEE environment with access to different types of inputs. Understanding what data you can access, how to access it, and when to use each type is crucial for building effective privacy-preserving applications. This guide covers all input types available to your iApp and how to access them within the TEE environment. Two perspectives on inputs ​ Inputs work differently depending on your role: 🔧 As a developer (using iApp Generator): You write code to access inputs from the TEE environment 👤 As a user (using DataProtector): You provide inputs when executing the iApp via processProtectedData() TIP You can also execute iApp outside of DataProtector using other methods. See the Run iApp without ProtectedData guide for more information. This guide shows both perspectives for each input type. Input types overview ​ Inside the TEE, your iApp can work with five distinct categories of inputs: Input Type Visibility Security Level Purpose How iApp Accesses It Protected Data Public Encrypted Data to be processed Clear files in TEE Args Public Clear Configuration parameters Command line arguments Input Files Public Clear Large datasets, models Clear files in TEE Requester Secrets Private Encrypted User's sensitive data Environment variables App Secrets Private Encrypted Developer's sensitive data Environment variables 1. Protected Data ​ What it is: Encrypted data that's only decrypted inside your TEE environment. When to use: Processing sensitive information like personal data, financial records, health data. How to Access Protected Data ​ Protected data is available in the IEXEC_IN directory as decrypted files: Python JavaScript python import os import json # Get the input directory and dataset filename iexec_in = os.environ[ 'IEXEC_IN' ] data_filename = os.environ[ 'IEXEC_DATASET_FILENAME' ] # Protected data is decrypted and available as files try : # For single protected data with open ( f " { iexec_in } / { data_filename } " , 'r' ) as f: data = json.load(f) # Access the sensitive data user_email = data.get( 'email' ) user_preferences = data.get( 'preferences' ) print ( f "Processing data for user: { user_email } " ) except FileNotFoundError : print ( "No protected data provided" ) javascript const fs = require ( 'fs' ); const path = require ( 'path' ); // Get the input directory and dataset filename const iexecIn = process.env. IEXEC_IN ; const dataFilename = process.env. IEXEC_DATASET_FILENAME ; try { // Protected data is decrypted and available as files const dataPath = path. join (iexecIn, dataFilename); const data = JSON . parse (fs. readFileSync (dataPath, 'utf8' )); // Access the sensitive data const userEmail = data.email; const userPreferences = data.preferences; console. log ( `Processing data for user: ${ userEmail }` ); } catch (error) { console. log ( 'No protected data provided' ); } How users provide protected data ​ Users specify the protected data address when executing your iApp: ts // User provides the protected data they want to use for processing const response = await dataProtectorCore . processProtectedData ({ protectedData : '0x123abc...' , // Address of the protected data app : '0x456def...' , // Your iApp address }); WARNING Protected data is decrypted and loaded into TEE enclave memory. Very large datasets (>1-2GB) may cause out-of-memory errors. Consider data preprocessing or chunking for large datasets. 2. Arguments (Args) ​ What they are: Public parameters passed to your iApp during execution. When to use: Configuration settings, model parameters, processing options - anything that doesn't need to be secret. DANGER Args are completely public and visible on the blockchain explorer. Never pass sensitive information through args. How to Access Args ​ In your iApp project, args are passed as command-line arguments: Python JavaScript python import sys # Access args from command line args = sys.argv[ 1 :] # Skip first arg (script name) # Example: iapp run myapp --args "model=bert threshold=0.8" if len (args) >= 2 : model_name = args[ 0 ] # "model=bert" threshold = args[ 1 ] # "threshold=0.8" javascript // Access args from command line const args = process.argv. slice ( 2 ); // Skip node and script name // Example: iapp run myapp --args "model=bert threshold=0.8" if (args. length >= 2 ) { const modelName = args[ 0 ]; // "model=bert" const threshold = args[ 1 ]; // "threshold=0.8" } How users provide args ​ Users pass args through the DataProtector processProtectedData() call: ts // User provides args when executing your iApp const response = await dataProtectorCore . processProtectedData ({ protectedData : '0x123abc...' , app : '0x456def...' , args : 'model=sentiment-bert temperature=0.7 format=json' , // Public arguments }); Example use cases ​ Model configuration: "model=sentiment-bert temperature=0.7" Processing options: "format=json output_size=small" Analysis parameters: "start_date=2024-01-01 end_date=2024-12-31" 3. Input Files ​ What they are: Files downloaded from public URLs during iApp execution. When to use: Large datasets, ML models, reference files that don't contain sensitive information. How to Access Input Files ​ Files are downloaded to the IEXEC_INPUT_FILES_FOLDER directory: Python JavaScript python import os # Get the input files directory input_dir = os.environ.get( 'IEXEC_INPUT_FILES_FOLDER' , './input' ) # List all downloaded files for filename in os.listdir(input_dir): file_path = os.path.join(input_dir, filename) # Process your file with open (file_path, 'r' ) as f: content = f.read() print ( f "Loaded file: { filename } " ) javascript const fs = require ( 'fs' ); const path = require ( 'path' ); // Get the input files directory const inputDir = process.env. IEXEC_INPUT_FILES_FOLDER || './input' ; // List all downloaded files fs. readdirSync (inputDir). forEach (( filename ) => { const filePath = path. join (inputDir, filename); // Process your file const content = fs. readFileSync (filePath, 'utf8' ); console. log ( `Loaded file: ${ filename }` ); }); How Users Provide Input Files ​ Users specify input files when executing your iApp: ts // User provides input files via DataProtector const response = await dataProtectorCore . processProtectedData ({ protectedData : '0x123abc...' , app : '0x456def...' , inputFiles : [ 'https://example.com/sentiment-model.pkl' , 'https://myapp.com/config.json' , ], }); Example use cases ​ ML model files: "https://example.com/sentiment-model.pkl" Reference datasets: "https://data.gov/reference-corpus.csv" Configuration files: "https://myapp.com/config.json" WARNING File size : Limited by TEE enclave memory (typically 1-2GB max) Memory constraint : Files are loaded into enclave memory - large files may cause out-of-memory errors Format : Any format (binary, text, compressed) URLs : Must be dir
프로젝트로 돌아가기