Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions .vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ export function getSidebar() {
link: '/guides/build-iapp/manage-access',
},
{
text: 'Inputs and Outputs',
link: '/guides/build-iapp/inputs-and-outputs',
text: 'Inputs',
link: '/guides/build-iapp/inputs',
},
{
text: 'Outputs',
link: '/guides/build-iapp/outputs',
},

{
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,13 @@ for input parameters:
- Add link to the new explorer feature Asset_Types in the guide =>
`handle-schemas-dataset-types`
- Add link to remix for deploying whitelist
- Maybe split input and output in two diff sub section in build your iapp guide
- Explorer l'intégration de codeSpace
- Add a Development workflow section (1 - ProtectData, 2- ...)
- Update context7 when doc will be deployed (Martin)
- Check theGraph Images with design Team
- Update the Dune Dashboard to the final version
- Add new section in `iexec-explorer.md` file to talk about: available chain on
the UI + SRLC/RLC on account section feature of the protocol
- framework AI supporté
- check glossary
- migrate pay-per-task page into a guide
- check pages (introduction & getting-started) for use-iapp guide
Expand All @@ -248,7 +246,7 @@ for input parameters:
- Refactor "advanced" section in build-iapp
- Rework src\get-started\protocol\iexec-doracle.md (transfer to guide or
rewrite)
- Talk about encrypting results in use-iapp
- Talk about encrypting results in use-iapp (link in outputs, iapp generator...)
- Rework src\get-started\protocol\oracle.md (transfer to guide or rewrite)
- Talk about iApp secret
- Improve Guide in build-iapp section - be more clear for builder ( how to
Expand Down
4 changes: 2 additions & 2 deletions src/guides/build-iapp/advanced/access-confidential-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The SMS currently supports 3 types of secrets:
variable. It is owned by the developer of the application. It can be any kind
of data (API key, private key, token, ..) as long as it respects the size
limit (max. 4096 kB).
2. [Requester secrets](/guides/build-iapp/inputs-and-outputs#access-requester-secrets):
2. [Requester secrets](/guides/build-iapp/inputs#access-requester-secrets):
These secrets are directly accessible from the application as environment
variables, as long as the requester has decided to share them with it. These
secrets can be any kind of data as long as they respect the size limit (max.
Expand Down Expand Up @@ -63,4 +63,4 @@ graph TD
You now understand how these three kinds of confidential assets work on iExec,
you can go one step further by learning how to manipulate them:

- [Access to a Protected Data](/guides/build-iapp/inputs-and-outputs)
- [Access to a Protected Data](/guides/build-iapp/inputs#protected-data)
5 changes: 3 additions & 2 deletions src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,9 @@

- **[Debugging Your iApp](/guides/build-iapp/debugging)** - Troubleshoot
execution issues and TDX-specific problems
- **[Inputs and Outputs](/guides/build-iapp/inputs-and-outputs)** - Handle data
in TEE environment with TDX
- **[Inputs](/guides/build-iapp/inputs)** - Handle data inputs
- **[Outputs](/guides/build-iapp/outputs)** - Handle data outputs in TEE

Check notice on line 280 in src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md#L280

[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.", "location": {"path": "src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md", "range": {"start": {"line": 280, "column": 70}}}, "severity": "INFO"}
environment with TDX

Check notice on line 281 in src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md#L281

[Google.Acronyms] Spell out 'TDX', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'TDX', if it's unfamiliar to the audience.", "location": {"path": "src/guides/build-iapp/advanced/build-your-first-tdx-iapp.md", "range": {"start": {"line": 281, "column": 20}}}, "severity": "INFO"}
- **[iApp Access Control and Pricing](/guides/build-iapp/manage-access)** -
Configure access control for your TDX applications

Expand Down
6 changes: 2 additions & 4 deletions src/guides/build-iapp/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,5 @@

Continue improving your iApp:

- **[Inputs and Outputs](/guides/build-iapp/inputs-and-outputs)** - Handle data
in TEE
- **[How to Get and Decrypt Results](/guides/build-iapp/inputs-and-outputs)** -
Retrieve results
- **[Inputs](/guides/build-iapp/inputs)** - Handle data inputs
- **[Outputs](/guides/build-iapp/outputs)** - Handle data outputs in TEE

Check notice on line 173 in src/guides/build-iapp/debugging.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/debugging.md#L173

[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.", "location": {"path": "src/guides/build-iapp/debugging.md", "range": {"start": {"line": 173, "column": 70}}}, "severity": "INFO"}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
title: Inputs and Outputs
title: Inputs
description:
Understand the different input types and output formats for iApp in the TEE
Understand the different input types available to your iApp in the TEE
environment
---

# 📥📤 Inputs and Outputs
# 📥 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 generate
proper outputs that users can retrieve and decrypt.
This guide covers all input types available to your iApp and how to access them
within the TEE environment.

Check notice on line 16 in src/guides/build-iapp/inputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/inputs.md#L16

[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.", "location": {"path": "src/guides/build-iapp/inputs.md", "range": {"start": {"line": 16, "column": 12}}}, "severity": "INFO"}

## Two Perspectives on Inputs

Expand Down Expand Up @@ -356,124 +356,6 @@
});
```

## Creating Outputs

Your iApp must generate outputs in the `IEXEC_OUT` directory. **Every iApp must
create a `computed.json` file** with metadata about the computation.

### Basic Output Structure

::: code-group

```python [Python]
import os
import json

# Get output directory
iexec_out = os.environ['IEXEC_OUT']

# Create your result file
result_data = {
"analysis": "positive sentiment",
"confidence": 0.92,
"processed_at": "2024-01-15T10:30:00Z"
}

# Save main result
with open(f"{iexec_out}/result.json", 'w') as f:
json.dump(result_data, f)

# REQUIRED: Create `computed.json` metadata
computed_metadata = {
"deterministic-output-path": f"{iexec_out}/result.json",
"execution-timestamp": "2024-01-15T10:30:00Z",
"app-version": "1.0.0"
}

with open(f"{iexec_out}/computed.json", 'w') as f:
json.dump(computed_metadata, f)
```

```javascript [JavaScript]
const fs = require('fs');
const path = require('path');

// Get output directory
const iexecOut = process.env.IEXEC_OUT;

// Create your result file
const resultData = {
analysis: 'positive sentiment',
confidence: 0.92,
processed_at: '2024-01-15T10:30:00Z',
};

// Save main result
fs.writeFileSync(
path.join(iexecOut, 'result.json'),
JSON.stringify(resultData, null, 2)
);

// REQUIRED: Create computed.json metadata
const computedMetadata = {
'deterministic-output-path': path.join(iexecOut, 'result.json'),
'execution-timestamp': '2024-01-15T10:30:00Z',
'app-version': '1.0.0',
};

fs.writeFileSync(
path.join(iexecOut, 'computed.json'),
JSON.stringify(computedMetadata, null, 2)
);
```

:::

### Output Best Practices

1. **Always create `computed.json`** - This is mandatory
2. **Use descriptive filenames** - `analysis_result.json`, not `output.txt`
3. **Include metadata** - Timestamps, versions, parameters used
4. **Structure your data** - Use JSON for structured results
5. **Keep files reasonable** - Large outputs increase retrieval time and may hit
memory limits
6. **Memory awareness** - TEE enclave memory is limited, avoid generating
multi-GB outputs

### Example: Multi-file Output

```python
import os
import json

iexec_out = os.environ['IEXEC_OUT']

# Create multiple output files
summary = {"total_processed": 1000, "success_rate": 0.95}
with open(f"{iexec_out}/summary.json", 'w') as f:
json.dump(summary, f)

# Create a detailed report
with open(f"{iexec_out}/detailed_report.txt", 'w') as f:
f.write("Detailed analysis results...\n")

# Create visualization data
chart_data = {"labels": ["A", "B", "C"], "values": [10, 20, 30]}
with open(f"{iexec_out}/chart_data.json", 'w') as f:
json.dump(chart_data, f)

# Required metadata file
computed = {
"deterministic-output-path": f"{iexec_out}/summary.json",
"additional-files": [
f"{iexec_out}/detailed_report.txt",
f"{iexec_out}/chart_data.json"
]
}
with open(f"{iexec_out}/computed.json", 'w') as f:
json.dump(computed, f)
```

## Testing Inputs Locally

Use iApp Generator to test different input types:
Expand Down Expand Up @@ -595,13 +477,13 @@

## What's Next?

**You now understand all input types and output requirements!**
**You now understand all input types available to your iApp!**

Continue building with these guides:

- **[Outputs](/guides/build-iapp/outputs)** - Learn how to generate and
structure your iApp outputs
- **[App Access Control and Pricing](/guides/build-iapp/manage-access)** -
Control who can use your iApp
- **[Debugging Your iApp](/guides/build-iapp/debugging)** - Troubleshoot
execution issues
- **[How to Get and Decrypt Results](/guides/build-iapp/inputs-and-outputs)** -
User-side result handling
149 changes: 149 additions & 0 deletions src/guides/build-iapp/outputs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
title: Outputs
description:
Learn how to generate and structure outputs from your iApp in the TEE
environment
---

# 📤 Outputs

**Your iApp must generate outputs that users can retrieve and decrypt.**
Understanding how to structure your outputs, create the required metadata, and
follow best practices is essential for building effective privacy-preserving
applications.

This guide covers how to generate outputs from your iApp and ensure they can be
properly retrieved by users.

## Creating Outputs

Check warning on line 18 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L18

[Google.Headings] 'Creating Outputs' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Creating Outputs' should use sentence-style capitalization.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 18, "column": 4}}}, "severity": "WARNING"}

Your iApp must generate outputs in the `IEXEC_OUT` directory. **Every iApp must
create a `computed.json` file** with metadata about the computation.

### Basic Output Structure

Check warning on line 23 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L23

[Google.Headings] 'Basic Output Structure' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Basic Output Structure' should use sentence-style capitalization.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 23, "column": 5}}}, "severity": "WARNING"}

::: code-group

```python [Python]
import os
import json

# Get output directory
iexec_out = os.environ['IEXEC_OUT']

# Create your result file
result_data = {
"analysis": "positive sentiment",
"confidence": 0.92,
"processed_at": "2024-01-15T10:30:00Z"
}

# Save main result
with open(f"{iexec_out}/result.json", 'w') as f:
json.dump(result_data, f)

# REQUIRED: Create `computed.json` metadata
computed_metadata = {
"deterministic-output-path": f"{iexec_out}/result.json",
"execution-timestamp": "2024-01-15T10:30:00Z",
"app-version": "1.0.0"
}

with open(f"{iexec_out}/computed.json", 'w') as f:
json.dump(computed_metadata, f)
```

```javascript [JavaScript]
const fs = require('fs');
const path = require('path');

// Get output directory
const iexecOut = process.env.IEXEC_OUT;

// Create your result file
const resultData = {
analysis: 'positive sentiment',
confidence: 0.92,
processed_at: '2024-01-15T10:30:00Z',
};

// Save main result
fs.writeFileSync(
path.join(iexecOut, 'result.json'),
JSON.stringify(resultData, null, 2)
);

// REQUIRED: Create computed.json metadata
const computedMetadata = {
'deterministic-output-path': path.join(iexecOut, 'result.json'),
'execution-timestamp': '2024-01-15T10:30:00Z',
'app-version': '1.0.0',
};

fs.writeFileSync(
path.join(iexecOut, 'computed.json'),
JSON.stringify(computedMetadata, null, 2)
);
```

:::

### Output Best Practices

Check warning on line 91 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L91

[Google.Headings] 'Output Best Practices' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Output Best Practices' should use sentence-style capitalization.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 91, "column": 5}}}, "severity": "WARNING"}

1. **Always create `computed.json`** - This is mandatory
2. **Use descriptive filenames** - `analysis_result.json`, not `output.txt`
3. **Include metadata** - Timestamps, versions, parameters used
4. **Structure your data** - Use JSON for structured results

Check failure on line 96 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L96

[Vale.Terms] Use 'json' instead of 'JSON'.
Raw output
{"message": "[Vale.Terms] Use 'json' instead of 'JSON'.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 96, "column": 34}}}, "severity": "ERROR"}
5. **Keep files reasonable** - Large outputs increase retrieval time and may hit
memory limits
6. **Memory awareness** - TEE enclave memory is limited, avoid generating

Check notice on line 99 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L99

[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'TEE', if it's unfamiliar to the audience.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 99, "column": 27}}}, "severity": "INFO"}

Check notice on line 99 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L99

[Google.Passive] In general, use active voice instead of passive voice ('is limited').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is limited').", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 99, "column": 46}}}, "severity": "INFO"}
multi-GB outputs

### Example: Multi-file Output

Check warning on line 102 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L102

[Google.Headings] 'Example: Multi-file Output' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'Example: Multi-file Output' should use sentence-style capitalization.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 102, "column": 5}}}, "severity": "WARNING"}

```python
import os
import json

iexec_out = os.environ['IEXEC_OUT']

# Create multiple output files
summary = {"total_processed": 1000, "success_rate": 0.95}
with open(f"{iexec_out}/summary.json", 'w') as f:
json.dump(summary, f)

# Create a detailed report
with open(f"{iexec_out}/detailed_report.txt", 'w') as f:
f.write("Detailed analysis results...\n")

# Create visualization data
chart_data = {"labels": ["A", "B", "C"], "values": [10, 20, 30]}
with open(f"{iexec_out}/chart_data.json", 'w') as f:
json.dump(chart_data, f)

# Required metadata file
computed = {
"deterministic-output-path": f"{iexec_out}/summary.json",
"additional-files": [
f"{iexec_out}/detailed_report.txt",
f"{iexec_out}/chart_data.json"
]
}
with open(f"{iexec_out}/computed.json", 'w') as f:
json.dump(computed, f)
```

## What's Next?

Check warning on line 136 in src/guides/build-iapp/outputs.md

View workflow job for this annotation

GitHub Actions / vale

[vale] src/guides/build-iapp/outputs.md#L136

[Google.Headings] 'What's Next?' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'What's Next?' should use sentence-style capitalization.", "location": {"path": "src/guides/build-iapp/outputs.md", "range": {"start": {"line": 136, "column": 4}}}, "severity": "WARNING"}

**You now understand how to generate proper outputs from your iApp!**

Continue building with these guides:

- **[Inputs](/guides/build-iapp/inputs)** - Learn about the different input
types available to your iApp
- **[App Access Control and Pricing](/guides/build-iapp/manage-access)** -
Control who can use your iApp
- **[Debugging Your iApp](/guides/build-iapp/debugging)** - Troubleshoot
execution issues
- **[How to Get and Decrypt Results](/guides/use-iapp/getting-started)** -
User-side result handling
Loading