Skip to content

Contexts & Applications

An application is a WASM bundle on a node; a context is a running instance of its shared state. This guide walks the lifecycle install → create context → join, all on mero.admin. Every method is a suspend fun. The full surface is in the admin API reference.

From a hosted bundle URL (metadata is a byte list — pass emptyList() if none):

val installed = mero.admin.installApplication(
InstallApplicationRequest(url = "https://example.com/app.wasm", metadata = emptyList())
)
val applicationId = installed.applicationId

From a registry package — mero-kotlin resolves the manifest, derives the bundle artifact URL, and installs it:

val versions = mero.admin.getRegistryVersions(registryUrl, packageName = "my-package") // newest first
val app = mero.admin.installFromRegistry(
registryUrl, packageName = "my-package", version = versions.first()
)

During development, install from a path with installDevApplication(request).

Inspect and manage:

val apps = mero.admin.listApplications().apps
val app = mero.admin.getApplication(applicationId)
mero.admin.uninstallApplication(applicationId)
val created = mero.admin.createContext(
CreateContextRequest(applicationId = applicationId, groupId = groupId)
)
val contextId = created.contextId
val memberKey = created.memberPublicKey

For a multi-service application, name the service:

val ctx = mero.admin.createContext(
CreateContextRequest(applicationId = applicationId, groupId = groupId, serviceName = "chat")
)

List and inspect:

val contexts = mero.admin.getContexts().contexts // List<ContextWithGroup>
val one = mero.admin.getContext(contextId) // Context
val forApp = mero.admin.getContextsForApplication(applicationId)
val storage = mero.admin.getContextStorage(contextId).sizeInBytes

A context identity is your keypair within a context. Generate one, then join:

val identity = mero.admin.generateContextIdentity() // .publicKey
mero.admin.joinContext(contextId)
val all = mero.admin.getContextIdentities(contextId).identities
val mine = mero.admin.getContextIdentitiesOwned(contextId).identities
r.resyncStarted
mero.admin.syncContext(contextId) // request a sync
val r = mero.admin.resyncContext(contextId, ResyncContextRequest(force = true))