Guides
Practical, copy‑pasteable walkthroughs using the Treza SDK.
Prereqs: Node 18+,
npm i @treza/sdk, and environment vars:export TREZA_BASE_URL=https://app.trezalabs.com export WALLET_ADDRESS=0x4B0897b0513fdc7C541B6d9D7E929C4e5364D2dB export GITHUB_ACCESS_TOKEN=gho_xxxxxxxxxxxxxxxxxxxx # optional
Deploy your first enclave
Pick a provider & region
import { TrezaClient } from '@treza/sdk';
const client = new TrezaClient();
const WALLET = process.env.WALLET_ADDRESS!;
const providers = await client.getProviders();
const provider = providers[0];
const region = provider.regions[0];Create the enclave
const enclave = await client.createEnclave({
name: 'hello-enclave',
description: 'First run',
region,
walletAddress: WALLET,
providerId: provider.id,
providerConfig: {
dockerImage: 'hello-world:latest',
cpuCount: 1,
memoryMiB: 256,
},
});
console.log('Enclave:', enclave.id, enclave.status);Tail logs (optional)
Manage lifecycle (pause / resume / terminate)
Tips
If transitions hang, check
getEnclaveLogs(enclaveId, 'all')and ensure image/resources are valid.
Guide: View and filter logs
Common sources: all, ecs, stepfunctions, lambda, application, errors.
Schedule a task inside an enclave
Cron basics
0 9 * * *→ 9am daily*/15 * * * *→ every 15 minutes
Create least‑privilege API keys
Good defaults
Separate keys per environment (dev/stage/prod)
Narrow permissions; rotate regularly
Connect a GitHub repo (optional)
Notes
Store
access_tokensecurely; do not hardcode.
Use Docker images & tags
Gotchas
Official images often require the
library/prefix.Ensure the tag exists; otherwise deployments will fail early.
Troubleshooting
401/403: wallet doesn’t own the resource
404: wrong
enclaveIdor different wallet scopeLifecycle stuck: check provider logs and
providerConfigDocker image not found: verify repo & tag via Docker helpers
See also
Examples – copy‑paste runnable snippets
API Reference – complete type & method docs
Concepts → Providers, Enclaves, Lifecycle
Last updated