bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 12쪽 중 7쪽
for the
linux/amd64
platform. On a
Mac
with an
Apple Silicon
chip, the default platform is
linux/arm64
. Use buildx to produce the image for
linux/amd64
.
bash
brew
install
buildkit
# ARM64 variant for local testing only
docker
buildx
build
--platform
linux/arm64
--tag
<
docker-hub-use
r
>
/hello-world
.
# AMD64 variant to deploy on iExec
docker
buildx
build
--platform
linux/amd64
--tag
<
docker-hub-use
r
>
/hello-world:1.0.0
--load
.
bash
docker
build
--tag
<
docker-hub-use
r
>
/hello-world:1.0.0
.
TIP
docker build
produces an image id; using
--tag <name>:<version>
is a convenient way to name the image for the next steps.
Test your iApp locally
Basic test
Create local volumes to simulate input and output directories.
bash
mkdir
-p
./tmp/iexec_in
mkdir
-p
./tmp/iexec_out
Run your application locally (container volumes bound with local volumes).
bash
docker
run
--rm
\
-v
./tmp/iexec_in:/iexec_in
\
-v
./tmp/iexec_out:/iexec_out
\
-e
IEXEC_IN=/iexec_in
\
-e
IEXEC_OUT=/iexec_out
\
<
docker-hub-use
r
>
/hello-world:1.0.0
arg1
arg2
arg3
Docker run [options] image [args]
docker run usage:
docker run [OPTIONS] IMAGE [COMMAND] [ARGS...]
Use
[COMMAND]
and
[ARGS...]
to simulate the requester arguments.
Useful options for iExec:
-v
: Bind mount a volume. Use it to bind input and output directories (
/iexec_in
and
/iexec_out
)
-e
: Set environment variable. Use it to simulate iExec runtime variables
Test with input files
Starting with the basic test, you can simulate input files.
For each input file:
Copy it in the local volume bound to
/iexec_in
.
Add
-e IEXEC_INPUT_FILE_NAME_x=NAME
to docker run options (
x
is the index of the file starting at 1 and
NAME
is the name of the file)
Add
-e IEXEC_INPUT_FILES_NUMBER=n
to docker run options (
n
is the total number of input files).
Example with two input files:
bash
touch
./tmp/iexec_in/file1
&&
\
touch
./tmp/iexec_in/file2
&&
\
docker
run
\
-v
./tmp/iexec_in:/iexec_in
\
-v
./tmp/iexec_out:/iexec_out
\
-e
IEXEC_IN=/iexec_in
\
-e
IEXEC_OUT=/iexec_out
\
-e
IEXEC_INPUT_FILE_NAME_1=file1
\
-e
IEXEC_INPUT_FILE_NAME_2=file2
\
-e
IEXEC_INPUT_FILES_NUMBER=
2
\
<
docker-hub-use
r
>
/hello-world:1.0.0
\
arg1
arg2
arg3
Build and push your Docker image for TDX
For
TDX
, you use the
same
image you built and tested: there is no enclave packaging step. Ensure the image is built for
linux/amd64
, then push it to Docker Hub (or another registry you reference in
iexec.json
).
bash
docker
login
docker
push
<
docker-hub-use
r
>
/hello-world:1.0.0
You are now ready to register and run this image as a TDX iApp on iExec.
Test your iApp on iExec
At this stage, your app is ready to be tested on iExec. The process is similar to testing a non-TEE app, with TDX-specific settings below.
Update
chain.json
Point the iExec client to the
TDX
Secret Management Service (SMS) for your target network. Edit
chain.json
as follows (or create it if missing):
Arbitrum Sepolia (testnet)
Arbitrum Mainnet
json
{
"default"
:
"arbitrum-sepolia-testnet"
,
"chains"
: {
"arbitrum-sepolia-testnet"
: {
"sms"
: {
"tdx"
:
"https://sms.labs.iex.ec"
}
}
}
}
json
{
"default"
:
"arbitrum-mainnet"
,
"chains"
: {
"arbitrum-mainnet"
: {
"sms"
: {
"tdx"
:
"https://sms.arbitrum-mainnet.iex.ec"
}
}
}
}
Deploy the TEE iApp on iExec
TEE apps require additional fields during deployment. Prepare the TEE app template and select the
TDX
framework:
bash
iexec
app
init
--tee-framework
tdx
Edit
iexec.json
and fill in the standard keys and the TDX
mrenclave
object:
json
{
...
"app"
: {
"owner"
:
"<your-wallet-address>"
,
// starts with 0x
"name"
:
"tee-tdx-hello-world"
,
// app name
"type"
:
"DOCKER"
,
"multiaddr"
:
"docker.io/<docker-hub-user>/hello-world:1.0.0"
,
// app image
"checksum"
:
"<checksum>"
,
// starts with 0x, update with your image digest
},
...
}
INFO
See
Deploy your iApp on iExec
to obtain your image
<checksum>
(digest).
Deploy the iApp:
bash
iexec
app
deploy
--chain
arbitrum-mainnet
List your last deployed app:
bash
iexec
app
show
--chain
arbitrum-mainnet
Run the iApp
iExec runs applications on decentralized infrastructure; execution is paid in
RLC
on Arbitrum networks.
INFO
To run an application you must have enough RLC staked on your iExec account to pay for the computing resources.
When you request an execution, the task cost is reserved from your account’s stake, then distributed to workers (see
Proof of Contribution
).
At any time you can:
view your balance
bash
iexec
account
show
--chain
arbitrum-mainnet
deposit RLC from your wallet to your iExec account
bash
iexec
account
deposit
--chain
arbitrum-mainnet
<
amoun
t
>
withdraw RLC from your iExec account to your wallet (only stake can be withdrawn)
bash
iexec
account
withdraw
--chain
arbitrum-mainnet
<
amoun
t
>
To run a
TDX
iApp, use the TEE
tee
and
tdx
tags and a
TDX workerpool
for the target network.
bash
iexec
app
run
--chain
arbitrum-mainnet
--tag
tee,tdx
--workerpool
0x8ef2ec3ef9535d4b4349bfec7d8b31a580e60244
--watch
Arbitrum Sepolia (testnet)
Arbitrum Mainnet
bash
iexec
app
run
--chain
arbitrum-sepolia-testnet
--tag
tee,tdx
--workerpool
0x2956f0cb779904795a5f30d3b3ea88b714c3123f
--watch
bash
iexec
app
run
--chain
arbitrum-mainnet
--tag
tee,tdx
--workerpool
0x8ef2ec3ef9535d4b4349bfec7d8b31a580e60244
--watch
Task execution on iExec is asynchronous.
Guarantees about completion times (fast/slow) are described in the
category section
: maximum deal/task time, maximum computing time, etc.
When the task completes, copy the
taskid
from the
iexec app run
output (a 32-byte hex string).
Download the result:
bash
iexec
task
show
--chain
arbitrum-mainnet
<
taski
d
>
--download
my-result
You can get the
taskid
for a
dealid
with:
bash
iexec
deal
show
--chain
arbitrum-mainnet
<
deali
d
>
INFO
A task result is a zip file containing the application output files.
For this hello-world app, the output includes
result.txt
. Unpack and read it:
bash
unzip
my-result.zip
-d
my-result
cat
my-result/result.txt
Congratulations! You have executed your application on iExec in a TDX Trust Domain.
Publish your app on the iExec Marketplace
Your app is deployed and you have completed an execution. To let others run it, publish an
apporder
(see
iApp access and pricing
for how orders work).
bash
iexec
app
publish
--chain
arbitrum-mainnet
INFO
iexec app publish
allows custom access rules (
iexec app publish --help
).
Check published app orders:
bash
iexec
orderbook
app
--chain
arbitrum-mainnet
<
your
app
addres
s
>
Next steps
In this tutorial you used
Intel TDX
on iExec to run a confidential workload. To go further with confidential data and result protection:
Access confidential assets from your iApp
Protect the result
Deeper TEE context:
Intel TDX Technology
Introduction to TEE technologies
Using iApp Generator
The
iApp Generator
can deploy and run
TDX
apps with less manual
iexec.json
editing.
Enabling TDX in iApp Generator
Enable TDX for deployment and execution:
bash
iapp
deploy
iapp
run
<
app-addres
s
>
Per command:
bash
iapp
deploy
iapp
run
<
app-addres
s
>
iapp
debug
<
taskI
d
>
Verify TEE tags on the app:
bash
iexec
app
show
<
app-addres
s
>
DataProtector SDK with TDX
To use
DataProtector
with TDX, point the SDK at the TDX SMS (same hosts as in
Update
chain.json
above).
Arbitrum Sepolia (testnet)
Arbitrum Mainnet
jsx
const
dataProtector
=
new
IExecDataProtector
(web3Provider, {
iexecOptions: {
smsURL:
'https://sms.labs.iex.ec'
,
},
});
jsx
const
dataProtector
=
new
IExecDataProtector
(web3Provider, {
iexecOptions: {
smsURL:
'https://sms.arbitrum-mainnet.iex.ec'
,
},
});
Pass the TDX
workerpool
in
processProtectedData
:
Arbitrum Sepolia (testnet)
Arbitrum Mainnet
jsx
await
dataProtector.core.
processProtectedData
({
protectedData: protectedData.address,
workerpool:
'0x2956f0cb779904795a5f30d3b3ea88b714c3123f'
,
app:
'0x456def...'
,
});
jsx
await
dataProtector.core.
processProtectedData
({
protectedData: protectedData.address,
workerpool:
'0x8ef2ec3ef9535d4b4349bfec7d8b31a580e60244'
,
app:
'0x456def...'
,
});
TDX iApps may require
TDX-compatible
protected data. Check the latest
DataProtector
documentation for requirements.
Local test (same as non-TEE):
bash
iapp
test
--protectedData
"mock_name"
Related resources
iApp Generator reference
Debugging your iApp
Inputs
/
Outputs
iApp access and pricing
## /guides/build-iapp/advanced/protect-the-result
Protect the result
Previous tutorials showed how to build
Confidential Computing applications
that run securely inside Trust Domains and combine them with confidential assets to get the most out of confidential computing advantages. This chapter pushes things further to protect the workflow in an end to end mode. That means the next step would be encrypting results.
Prerequisites:
Docker
17.05 or higher on the daemon and client.
iExec SDK
8.0.0 or higher.
INFO
You don't need to change your application's code or redeploy it to add this feature.
Assuming your application is deployed (if not please check how to do it
with the TDX guide
), before triggering an execution you need to generate an RSA key-pair, then push the public key to the
Secret Management Service
. The latter, in turn, will provide it, at runtime, to the Trust Domain running your Confidential Computing application.
To generate the key-pair, go to
~/iexec-projects
and use the following SDK command:
Make sure your
chain.json
content is correct.
bash
iexec
result
generate-encryption-keypair
This generates two files in
.secrets/beneficiary/
. Make sure to back up the private key in the file
<0x-your-wallet-address>_key
.
bash
.secrets
├──
beneficiary
│
├──
<
0x-you-wallet-addres
s
>
_key
│
└──
<
0x-you-wallet-addres
s
>
_key.pub
...
Now, push the public key to the SMS:
bash
iexec
result
push-encryption-key
--tee-framework
--chain
arbitrum-mainnet
And check it using:
bash
iexec
result
check-encryption-key
--tee-framework
--chain
arbitrum-mainnet
Now to see that in action, you'd need to trigger a task and specify yourself as the beneficiary in the command:
bash
iexec
app
run
<
0x-your-app-addres
s
>
\
--chain
arbitrum-mainnet
--workerpool
0x8ef2ec3ef9535d4b4349bfec7d8b31a580e60244
\
--tag
tee,tdx
\
--encrypt-result
\
--watch
Wait for the task to be
COMPLETED
and download the result:
bash
iexec
task
show
--chain
arbitrum-mainnet
<
0x-your-task-i
d
>
--download
If you extract the obtained zip and try to read the content of the file
iexec_out/result.zip.aes
you will find it encrypted:
bash
mkdir
/tmp/trash
&&
\
unzip
<
0x-your-task-i
d
>
.zip
-d
/tmp/trash
&&
\
cat
/tmp/trash/iexec_out/result.zip.aes
iexec_out/result.zip
:
bash
)3XqYvȿzEfRu<\ݵmm疞rc(a{{'ܼ͛q/[{Ht>hgD$g\.kj"s?"hJ_Q41_[{XԚa蘟vEr肽
Յ]9WTL*
tdzO
`
!
e
&
snoL3K6L9%
Now you should decrypt the result by running:
bash
iexec
result
decrypt
<
0x-your-task-id.zi
p
>
A new zip file appears in the current folder under the name
results.zip
. Eventually, unzip it:
bash
unzip
results.zip
-d
my-decrypted-result
And you can see the content of your result file:
bash
$
cat
my-decrypted-result/result.txt
Hello,
world!
Voilà! By finishing this part, you should be able to use confidential computing on iExec like a Ninja. All parts of the workflow are protected: the execution, the dataset, and the result.
You can go to the advanced section and learn more about managing orders on the iExec to effectively monetize your applications and datasets.
## /guides/build-iapp/advanced/result-callback
Result callback
This guide explains how to trigger a callback function at the end of a successful task on your smart contract.
Use a callback when your smart contract should:
Ingest off-chain computed data (API aggregation, ML inference, analytics) and persist it
React to an execution outcome (conditional trigger, state transition)
Store a timestamped record (price feed, score, KPI, proof hash)
Bridge logic between external systems and on-chain state
High-level flow
A requester deploys the smart contract that should receive the callback data.
The requester executes an iApp and specifies the callback address.
The iApp writes
${IEXEC_OUT}/computed.json
with a
callback-data
field (ABI‑encoded bytes you crafted).
After the task completes and is validated, the iExec protocol invokes your contract’s
receiveResult(bytes32,bytes)
.
Your contract decodes and processes those bytes if callback data have been provided.
Step-by-step implementation
Step 1: Implement the callback contract
Your contract must expose the function
receiveResult(bytes32,bytes)
ERC1154
. The protocol calls it with:
_callID
: This parameter represents the
taskId
, passed as the first argument
callback
: exactly the bytes you encoded as
callback-data
Decode using the same tuple. (Optional) Add protections: authorized caller check (iExec hub / proxy), replay guard, bounds checks.
solidity
contract
IExecCallbackReceiver
{
// Your business logic here ...
// ERC1154 - Callback processing
function
receiveResult
(
bytes32
_callID,
bytes
memory
callback
)
external
{
// Parse results
(
uint256
timestamp,
string
memory
pairAndPrecision,
uint256
scaledValue)
=
abi
.
decode
(callback, (
uint256
,
string
,
uint256
));
}
}
Important
The callback transaction is subject to a maximum gas limit of 200,000 enforced by the protocol.
Ensure your callback logic fits within this limit to avoid out-of-gas errors.
Step 2: Prepare the callback payload in the iApp
You only need to write
computed.json
containing the key
callback-data
.
That value must be the ABI‑encoded bytes your contract knows how to decode.
Example tuple schema we'll use:
(uint256 timestamp, string pairAndPrecision, uint256 scaledValue)
.
ts
async
function
main
() {
// Your business logic here ...
const
abiCoder
=
new
AbiCoder
();
const
abiPayload
=
abiCoder
.
encode
(
[
'uint256'
,
'string'
,
'uint256'
],
[
timestamp
,
pair
,
scaled
]
);
writeFileSync
(
`${
process
.
env
.
IEXEC_OUT
}/computed.json`
,
JSON
.
stringify
({
'callback-data'
:
abiPayload
,
})
);
}
Step 3: Run the iApp with a callback
When creating the request order, set the
callback
field to your callback contract address.
After completion, the protocol calls your contract, passing the
callback-data
bytes.
First install the iExec SDK if you have not already (see the
iExec SDK documentation
).
ts
// Basic arguments
const
requestorderToSign
=
await
iexec
.
order
.
createRequestorder
({
app
:
'0x456def...'
,
category
:
0
,
appmaxprice
:
10
,
workerpool
:
'0xa5de76...'
,
callback
:
'0x8e5bB6...'
,
// Callback contract address
});
const
requestOrder
=
await
iexec
.
order
.
signRequestorder
(
requestorderToSign
);
// Fetch app orders
const
appOrders
=
await
iexec
.
orderbook
.
fetchAppOrderbook
({
app
:
'0x456def...'
,
// Filter by specific app
});
if
(
appOrders
.
orders
.
length
===
0
) {
throw
new
Error
(
'No app orders found for the specified app'
);
}
// Fetch workerpool orders
const
workerpoolOrders
=
await
iexec
.
orderbook
.
fetchWorkerpoolOrderbook
({
workerpool
:
'0xa5de76...'
,
// Filter by specific workerpool
});
if
(
workerpoolOrders
.
orders
.
length
===
0
) {
throw
new
Error
(
'No workerpool orders found for the specified workerpool'
);
}
// Execute the task
const
taskId
=
await
iexec
.
order
.
matchOrders
({
requestorder
:
requestOrder
,
apporder
:
appOrders
.
orders
[
0
].
order
,
workerpoolorder
:
workerpoolOrders
.
orders
[
0
].
order
,
});
Other use cases
Use Case
Description
Price oracle
Multi-source API aggregation
Reputation / scoring
Off-chain ML / analytics pushed on-chain
Audit hash
Security scan or verification artifact
Automation
Workflow step completion signal
Dynamic parameters
Adjust rates / thresholds / quorums
Logical bridge
Sync external (IoT / legacy) state
## /guides/build-iapp/advanced/access-confidential-assets
Access confidential assets from your iApp
WARNING
Before going any further, make sure you managed to
Build your first TDX iApp
.
Secret Management Service (SMS)
You can use confidential assets on iExec thanks to the
iExec Secret Management Service
. This service verifies that the Trust Domain requesting secrets is authorized to do so. Any user - as a confidential asset provider - declares on the blockchain which Trust Domains are authorized to access it. For each task, the SMS will query the blockchain to determine if the Trust Domain requesting secrets is indeed whitelisted for it.
The SMS currently supports 3 types of secrets:
App developer secret
: This secret is directly accessible from the app as an environment variable. It is owned by the developer of the app. It can be any kind of data (API key, private key, token, ..) as long as it respects the size limit (max. 4096 kB).
Requester secrets
: These secrets are directly accessible from the app 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. 4096 kB). Before buying a task, a requester secret is pushed into the SMS and is not linked to any app. When a requester buys a task, the requester can declare which secrets can be accessed by the app. Doing so, a single requester secret can be shared with multiple apps.
Protected Data secret
: A protected data secret is not directly accessible from the app but its decrypted content is. If a Protected Data is requested and authorized to be used in it, its content will be automatically decrypted in the app enclave.
Here is a general overview of how iExec uses confidential assets:
Next step?
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/use-iapp/how-to-pay-executions
How to Pay for iApp Executions
iExec uses RLC tokens as the native currency for executing iApps. This guide covers how to acquire RLC, stake it on the protocol, and manage execution costs.
Getting RLC Tokens
To execute iApps, you need RLC tokens in your wallet. For detailed information on how to obtain RLC tokens, see our
RLC guide
.
Staking RLC
RLC tokens need to be staked on the iExec protocol to allow task payment. Use the
iExec SDK
to deposit and manage your RLC:
ts
// Check your balance
const
balance
=
await
iexec
.
account
.
checkBalance
(
'0xa0c15e...'
);
console
.
log
(
'Nano RLC staked:'
,
balance
.
stake
.
toString
());
console
.
log
(
'Nano RLC locked:'
,
balance
.
locked
.
toString
());
// Lock RLC in your account in the iExec protocol
await
iexec
.
account
.
deposit
(
1_000_000_000
);
// Deposit 1 RLC
Now you are ready to run a task on the iExec Protocol and pay for it. See our guide on
running iApp with ProtectedData
for detailed execution steps.
Understanding Pricing
Cost components
iApp execution costs consist of several components:
Application Fee
: Paid to the app developer
Data Fee
: Paid to the data owner (if using protected data)
Workerpool Fee
: Paid to the computation provider
Gas Fees
: Blockchain transaction costs
Setting maximum prices
You can control costs by setting maximum prices for each component:
ts
const
result
=
await
dataProtectorCore
.
processProtectedData
({
protectedData
:
'0x123abc...'
,
app
:
'0x456def...'
,
dataMaxPrice
:
5
,
// Maximum amount (in nRLC) to pay the protected data owner
appMaxPrice
:
3
,
// Maximum amount (in nRLC프로젝트로 돌아가기