Contexts & Applications
An application is a WASM bundle installed on a node; a context is a
running instance of that application’s shared state. This guide walks the
lifecycle: install → create a context → join it. Everything here is on
sdk.admin — see the admin API reference for the full
surface.
The lifecycle
Section titled “The lifecycle”Install an application
Section titled “Install an application”From a URL (a hosted .wasm/.mpk bundle):
const { applicationId } = await sdk.admin.installApplication({ url: 'https://example.com/app.wasm', hash: '…', // optional integrity hash metadata: [], // bytes; [] for none});From a registry package — the SDK resolves the manifest, derives the bundle artifact URL, and installs it:
// newest firstconst versions = await sdk.admin.getRegistryVersions(registryUrl, 'my-package');
const app = await sdk.admin.installFromRegistry( registryUrl, 'my-package', versions[0],);During local development, install straight from a path with
installDevApplication({ path, metadata: [] }).
Inspect and manage installed apps:
const { apps } = await sdk.admin.listApplications();const app = await sdk.admin.getApplication(applicationId);await sdk.admin.uninstallApplication(applicationId);Create a context
Section titled “Create a context”const { contextId, memberPublicKey } = await sdk.admin.createContext({ applicationId,});For a multi-service application, name the service to run:
const ctx = await sdk.admin.createContext({ applicationId, serviceName: 'chat',});List and inspect contexts:
const { contexts } = await sdk.admin.getContexts(); // ContextWithGroup[]const one = await sdk.admin.getContext(contextId); // Contextconst forApp = await sdk.admin.getContextsForApplication(applicationId);const storage = await sdk.admin.getContextStorage(contextId); // { sizeInBytes }Identities & joining
Section titled “Identities & joining”A context identity is your keypair within a context. Generate one, then join:
const identity = await sdk.admin.generateContextIdentity();await sdk.admin.joinContext(contextId);
// Who's in the context?const ids = await sdk.admin.getContextIdentities(contextId);const mine = await sdk.admin.getContextIdentitiesOwned(contextId);Keeping state in sync
Section titled “Keeping state in sync”A node syncs context state peer-to-peer. You can nudge or force it:
await sdk.admin.syncContext(contextId); // request a syncawait sdk.admin.resyncContext(contextId, { force: true }); // { contextId, resyncStarted }- Executing methods — run WASM methods in a context.
- Subscriptions — stream a context’s events.
- Groups & governance — namespaces, members, capabilities.