Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b7b0847
Add comprehensive guide for managing app access control and pricing
Le-Caignec Aug 4, 2025
33613a1
fix: improve formatting and clarity in TDX experimental guide
Le-Caignec Aug 4, 2025
2b806e7
fix: clarify definition of iApp and its secure processing environment
akugone Aug 5, 2025
7e06e9d
fix: enhance clarity on iApp's secure processing and its significance
akugone Aug 5, 2025
6ae8832
fix: enhance iApp Generator documentation for improved usability and …
akugone Aug 5, 2025
6f969c1
fix: update iApp documentation to improve workflow clarity and FAQ st…
akugone Aug 5, 2025
09190eb
fix: update iApp documentation to enhance clarity on privacy and exec…
akugone Aug 5, 2025
d531ddf
fix: enhance iApp documentation with improved formatting and clarity
akugone Aug 6, 2025
43a3433
fix: update iApp documentation to enhance clarity on user-provided pr…
akugone Aug 6, 2025
c644a91
fix: add clarification on dataset type mismatches in iApp documentation
akugone Aug 6, 2025
240f3b8
fix: update TDX experimental guide with feature comparisons and integ…
akugone Aug 6, 2025
46c65c5
fix: update TDX experimental guide with environment variable declaration
akugone Aug 6, 2025
1fc56a9
fix: update iApp Generator documentation to clarify Docker requirements
akugone Aug 6, 2025
fbe926a
fix: update TDX experimental guide with DataProtector SDK configurati…
akugone Aug 6, 2025
803c221
Co-authored-by: MartinLeclercq <akugone@users.noreply.github.com>
Le-Caignec Aug 7, 2025
a6e5872
fix: remove outdated guides for AI frameworks, managing iApps, orders…
Le-Caignec Aug 7, 2025
7b228c6
fix: remove redundant "How It Works" section from iApp documentation
Le-Caignec Aug 7, 2025
5aad044
fix: enhance iApp documentation with new trust benefits section
akugone Aug 7, 2025
3f56df6
fix: remove trust benefits section from iApp documentation
akugone Aug 7, 2025
0febd40
fix: improve clarity in iApp documentation
akugone Aug 7, 2025
28a655e
fix: update iApp documentation for clarity and structure
akugone Aug 7, 2025
6f44adf
fix: enhance iApp documentation for improved clarity and user experience
akugone Aug 7, 2025
4de4349
fix: update iApp documentation for improved accuracy and clarity
akugone Aug 7, 2025
332e7ad
feat: build iapp by martin (#15)
akugone Aug 7, 2025
446026d
Merge branch 'main' into feature/build-iapp
Le-Caignec Aug 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions .vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,15 +348,14 @@ export function getSidebar() {
{ text: '❓ What Is an iApp?', link: '/build-iapp/what-is-iapp' },
{
text: '📖 Guides',
link: '/build-iapp/guides',
items: [
{
text: 'Manage Your iApps',
link: '/build-iapp/guides/manage-iapps',
text: 'Build and Deploy your iApps',
link: '/build-iapp/guides/build-&-deploy-iapp',
},
{
text: 'Orders (how they work, how to manage them)',
link: '/build-iapp/guides/orders',
text: 'Manage your iApps',
link: '/build-iapp/guides/manage-iapp',
},
{
text: 'Inputs and Outputs (types, differences, formats)',
Expand All @@ -374,20 +373,11 @@ export function getSidebar() {
text: 'How to Get and Decrypt Results',
link: '/build-iapp/guides/how-to-get-and-decrypt-results',
},
{
text: 'AI Frameworks',
link: '/build-iapp/guides/ai-frameworks',
},
{
text: 'Other Emerging Trends',
link: '/build-iapp/guides/other-emerging-trends',
},
],
},
{
text: '🤖 iApp Generator',
link: '/build-iapp/iapp-generator',
collapsed: true,
items: [
{
text: 'Getting Started',
Expand All @@ -397,20 +387,8 @@ export function getSidebar() {
text: 'Building Your iApp',
link: '/build-iapp/iapp-generator/building-your-iexec-app',
},
{
text: 'References',
link: '/build-iapp/iapp-generator/references',
},
{
text: 'Advanced Creation',
link: '/build-iapp/iapp-generator/advanced-creation',
},
],
},
{
text: '🔧 Protocol-Level Guides',
link: '/build-iapp/iapp-generator/protocol-level-guides',
},
],
},
],
Expand Down
10 changes: 0 additions & 10 deletions src/build-iapp/guides/ai-frameworks.md

This file was deleted.

115 changes: 115 additions & 0 deletions src/build-iapp/guides/build-&-deploy-iapp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: Build and Deploy an iApp?
description:
How to build an confidential iexec application and deploy it on iexec protocol
---

## iApp Generator: Your Development Tool

Bootstrap TEE-compatible applications in minutes without any hardcoding skills,
iApp Generator handles all the low-level complexity for you.

- **Access to TEEs easily** - No need to dive into low-level requirements, build
iApps that connect to TEEs in minutes.
- **Check and deploy iApps quickly** - iApp Generator checks that your iApp
complies with the iExec Framework and streamlines its deployment.
- **Select your project mode & language** - Get started with either a basic or
advanced setup, depending on your experience with the iExec framework. You can
use Python or JavaScript—whichever you prefer!

```bash
# Create your iApp (Python or Node.js supported)
iapp init my-privacy-app
cd my-privacy-app

# Develop and test locally (simulates TEE environment)
iapp test
# Deploy to the network
iapp deploy
```

<div class="bg-gradient-to-r from-blue-400/10 to-blue-400/5 rounded-[6px] p-4 border-l-4 border-blue-600 mb-6">
<p class="m-0! text-sm"><strong>Note:</strong> iApp Generator currently supports Python and Node.js, but iApps can be built in any language that runs in Docker.</p>
</div>

## Real Examples

Here are some real-world examples of iApps to help you understand how they work
in practice.

**Email Notification iApp**

This iApp lets you send updates to your contacts without ever seeing their email
addresses, privacy is preserved by design.

::: code-group

```python [Python]
# User runs: "Send updates to my contacts about my project"
contacts = load_protecteddata() # User's protected contact list
for contact in contacts:
send_email(contact, project_update_message)
# → Emails sent directly, you never see the addresses
```

```js [Node.js]
/* User runs: "Send updates to my contacts about my project" */
const contacts = loadProtectedData(); // User's protected contact list
contacts.forEach((contact) => {
sendEmail(contact, projectUpdateMessage);
});
// → Emails sent directly, you never see the addresses
```

:::

**Oracle Update iApp**

This iApp securely updates a price oracle using private trading data, ensuring
sensitive information stays confidential.

::: code-group

```python [Python]
# User runs: "Update price oracle with my private trading data"
trading_data = load_protecteddata() # User's protected trading history
average_price = calculate_weighted_average(trading_data)
update_oracle_contract(average_price)
# → Oracle updated with real data, trading history stays private
```

```js [Node.js]
/* User runs: "Update price oracle with my private trading data" */
const tradingData = loadProtectedData(); // User's protected trading history
const averagePrice = calculateWeightedAverage(tradingData);
updateOracleContract(averagePrice);
// → Oracle updated with real data, trading history stays private
```

:::

**Automated Transactions iApp**

This iApp automates monthly payments using protected payment details, so
financial information remains private.

::: code-group

```python [Python]
# User runs: "Automate payments every month"
payment_info = load_protecteddata() # User's payment details
for month in range(12):
process_payment(payment_info)
# → Payments processed, payment details stay private
```

```js [Node.js]
/* User runs: "Automate payments every month" */
const paymentInfo = loadProtectedData(); // User's payment details
for (let month = 0; month < 12; month++) {
processPayment(paymentInfo);
}
// → Payments processed, payment details stay private
```

:::
173 changes: 169 additions & 4 deletions src/build-iapp/guides/debugging-your-iapp.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,175 @@
---
title: Debugging Your iApp
description: Debugging Your iApp
description:
Troubleshoot and optimize your iApp execution in the TEE environment
---

# Debugging Your iApp
# 🐛 Debugging Your iApp

This page is under development.
**When your iApp doesn't work as expected, debugging in the TEE environment
requires specific techniques.** This guide helps you identify issues and
optimize your iApp's performance.

<!-- TODO: Add the debugging guide -->
## Task Execution Lifecycle

Understanding how your task progresses through the iExec network:

### Key Stages

1. **Deal Creation** - Orders matched, funds locked
2. **Task Initialization** - Workers selected for execution
3. **iApp Execution** - Your code runs inside TEE
4. **Result Processing** - Results encrypted and uploaded
5. **Task Completion** - Results available for download

**Most failures happen during stages 2-4**

## Monitoring Your Tasks

### iExec Explorer

Track your tasks at [explorer.iex.ec](https://explorer.iex.ec):

- Search by `taskId` or deal ID
- Check status: `PENDING` → `ACTIVE` → `COMPLETED/FAILED`
- View error messages if execution fails

### Status in Code

```ts twoslash
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';

const web3Provider = getWeb3Provider('PRIVATE_KEY');
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
// ---cut---
const response = await dataProtectorCore.processProtectedData({
protectedData: '0x123abc...',
app: '0x456def...',
onStatusUpdate: ({ title, isDone }) => {
console.log(`Status: ${title} - Done: ${isDone}`);
},
});
```

## Debug Commands

### Local Testing

```bash
# Test your iApp locally
iapp test --args "model=bert threshold=0.8"
iapp test --secrets "key1=value1,key2=value2"

# Mock protected data for testing
iapp mock protectedData
iapp test --protectedData "mock_name"
```

### Remote Debugging

```bash
# Deploy and run
iapp deploy
iapp run <iapp-address>

# Debug failed executions
iapp debug <taskId>
```

### Task Information

```bash
# View task details
iexec task show <taskId>

# Download results (if completed)
iexec task show <taskId> --download
```

## Common Issues

### ⏱️ **Task Timeout**

- **Cause**: Code takes too long to execute
- **Solution**: Optimize algorithms, reduce input sizes, use appropriate task
category

### 💾 **Memory Issues**

- **Cause**: Loading large files, memory leaks, TEE constraints
- **Solution**: Process data in chunks, use streaming, optimize memory usage

### 📁 **Input/Output Problems**

- **Cause**: Wrong file paths, missing `computed.json`
- **Solution**: Always create `computed.json`, verify environment variables

```python
# Always create computed.json
import json, os
computed = {"deterministic-output-path": f"{os.environ['IEXEC_OUT']}/result.json"}
with open(f"{os.environ['IEXEC_OUT']}/computed.json", 'w') as f:
json.dump(computed, f)
```

### ⚠️ **Dataset type unmatching**

- **Cause**: The dataset type specified in the frontend (protectData) does not
match with the dataset type specified in the iApp
- **Solution**: Check both dataset types

## Best Practices

### 🔍 **Input Validation**

```python
import os, sys

# Check required environment variables
if not os.environ.get('IEXEC_IN') or not os.environ.get('IEXEC_OUT'):
print("ERROR: Missing IEXEC_IN or IEXEC_OUT")
sys.exit(1)

# Validate arguments
if len(sys.argv) < 2:
print("ERROR: Missing required arguments")
sys.exit(1)
```

### 📝 **Clear Error Messages**

```python
try:
# Your processing logic
result = process_data(data)
except Exception as e:
print(f"ERROR: Processing failed: {str(e)}")
sys.exit(1)
```

### 🔒 **Safe File Operations**

```python
import os, json

# Always ensure output directory exists
iexec_out = os.environ['IEXEC_OUT']
os.makedirs(iexec_out, exist_ok=True)

# Write results safely
try:
with open(f"{iexec_out}/result.json", 'w') as f:
json.dump(result_data, f)
except Exception as e:
print(f"ERROR: Failed to write results: {e}")
sys.exit(1)
```

## What's Next?

Continue improving your iApps:

- **[Inputs and Outputs](/build_iapp/guides/inputs-and-outputs)** - Handle data
in TEE
- **[How to Get and Decrypt Results](/build_iapp/guides/how-to-get-and-decrypt-results)** -
Retrieve results
Loading