This document provides feedback on our experience using iExec tools while building ShadowSwap - a confidential batch auction DEX.
| Tool | Purpose in Our Project |
|---|---|
| iExec DataProtector | Encrypting order data before on-chain submission |
| iExec SDK | Integration with DataProtector APIs |
The @iexec/dataprotector SDK has a clean, intuitive API:
import { IExecDataProtector } from '@iexec/dataprotector';
const dataProtector = new IExecDataProtector(provider);
const protectedData = await dataProtector.protectData({
data: orderData,
name: 'ShadowSwap Order',
});Feedback: The SDK abstraction makes it simple to integrate confidential computing without deep knowledge of TEE (Trusted Execution Environment) internals. This significantly reduces the learning curve for developers.
DataProtector's encryption model fits perfectly with our MEV protection use case:
- Order details (amounts, prices) are encrypted client-side
- Only authorized parties can decrypt
- Prevents front-running and sandwich attacks
Feedback: The privacy guarantees are exactly what DeFi needs. Being able to hide transaction details from validators/miners is a game-changer for fair trading.
The iExec tools work across multiple chains, which aligns with our multi-chain deployment plans.
Feedback: Cross-chain compatibility is essential for modern DeFi. Appreciate that iExec isn't locked to a single ecosystem.
The iExec documentation covers:
- Getting started guides
- API references
- Use case examples
- Troubleshooting
Feedback: Documentation quality is above average compared to other Web3 tools. The examples are practical and easy to follow.
Challenge: Setting up the full iExec environment (sidechain, worker nodes, etc.) for local development requires multiple steps.
Suggestion: A "quick start" Docker container with pre-configured iExec environment would help developers prototype faster.
Challenge: During development, we occasionally experienced delays when interacting with iExec testnet services.
Suggestion: Consider providing a "dev mode" that simulates iExec functionality locally without network calls, similar to how we implemented our fallback encryption.
Challenge: The DataProtector SDK internally calls eth_sendTransaction for protectData() without sufficient maxFeePerGas for Arbitrum Sepolia. This causes "max fee per gas less than block base fee" errors because the base fee fluctuates on L2s.
Our Solution: We built a proxy provider (createGasBoostedProvider) that wraps window.ethereum and intercepts eth_sendTransaction calls to inject proper EIP-1559 gas parameters (baseFee * 2 buffer) before they reach MetaMask.
// Our gas-boosted provider wrapper (frontend/src/lib/encryption.ts)
const boostedProvider = createGasBoostedProvider(window.ethereum);
const dataProtector = new IExecDataProtector(boostedProvider);Suggestion: The SDK should handle L2 gas estimation internally, or at least provide a configuration option for custom gas parameters. A gasOptions parameter in the constructor would help:
const dataProtector = new IExecDataProtector(provider, {
gasOptions: { maxFeePerGasMultiplier: 2.0 } // Suggested API
});Challenge: When something goes wrong with encrypted data, debugging is difficult because you can't inspect the payload.
Suggestion: A debug mode that logs encryption/decryption steps (without exposing actual data) would help developers troubleshoot issues.
Challenge: Finding DeFi-specific integration examples took some searching.
Suggestion: A dedicated "DeFi Recipes" section in documentation with examples for:
- Order book privacy
- Private auctions
- Confidential voting (for DAOs)
- Hidden collateral positions
For DEXs processing many orders, a batch encryption endpoint would reduce API calls:
// Current: Multiple calls
const encrypted1 = await dataProtector.protectData({ data: order1 });
const encrypted2 = await dataProtector.protectData({ data: order2 });
// Requested: Single batch call
const [encrypted1, encrypted2] = await dataProtector.protectDataBatch([
{ data: order1 },
{ data: order2 },
]);For auction use cases, time-locked decryption would be powerful:
const protectedData = await dataProtector.protectData({
data: bidData,
decryptAfter: auctionEndTimestamp, // New feature
});This would guarantee no one can decrypt until the auction ends.
For multi-party scenarios, requiring N-of-M parties to authorize decryption:
const protectedData = await dataProtector.protectData({
data: sensitiveData,
threshold: { required: 3, total: 5 }, // 3 of 5 must approve
});A way to verify on-chain that data was encrypted with DataProtector without decrypting:
function verifyEncryption(bytes memory encryptedData)
external view returns (bool isValid);┌─────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ User Order │────▶│ DataProtector │────▶│ ShadowPool │
│ (Plain) │ │ (Encrypt) │ │ (On-chain) │
└─────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
▼ ▼ ▼
- tokenIn - encryptedData - Store encrypted
- tokenOut - datasetAddress - Execute batch
- amountIn - Settle trades
- limitPrice
| Data | Visibility |
|---|---|
| Token addresses | Public (needed for routing) |
| Order amount | Encrypted |
| Limit price | Encrypted |
| Order owner | Public (on-chain) |
| Execution time | Public (block timestamp) |
For testing without iExec infrastructure:
// frontend/src/lib/encryption.ts
export async function encryptOrderData(orderData: OrderData) {
try {
// Try real DataProtector
return await realEncryption(orderData);
} catch {
// Fallback for testing
return mockEncryption(orderData);
}
}| Aspect | Rating | Comments |
|---|---|---|
| SDK Usability | ⭐⭐⭐⭐ | Clean API, easy integration |
| Documentation | ⭐⭐⭐⭐ | Comprehensive, could use more DeFi examples |
| Performance | ⭐⭐⭐ | Good, batch operations would help |
| Developer Experience | ⭐⭐⭐⭐ | Smooth once set up |
| Use Case Fit | ⭐⭐⭐⭐⭐ | Perfect for MEV protection |
Yes, absolutely. The privacy guarantees are essential for fair DeFi, and iExec DataProtector provides a practical way to achieve confidential computing without building TEE infrastructure from scratch.
Thanks to the iExec team for:
- Building powerful privacy tools for Web3
- Responsive community support
- Comprehensive documentation
- Hosting this hackathon
For questions about our iExec integration:
- GitHub Issues: ShadowSwap/issues
- Repository: github.com/cryptoeights/ShadowSwap
This feedback was written as part of our hackathon submission to help improve the iExec developer experience.