Skip to main content

Acurast SDK

Which tool should I use?
  • CLI — interactive local workflow. Best for getting started and day-to-day deployments.
  • SDK — programmatic deploys from your own TypeScript/JavaScript code. Best for CI, backends, and custom flows.
  • Deploy Agent — pay with USDC on Base via x402. Best for AI agents and services without ACU accounts.

Introduction

@acurast/sdk is the programmatic entry point for developers who want to deploy and manage deployments on Acurast from TypeScript/JavaScript. It bundles everything needed to upload a project to IPFS, register a job on-chain, match it with processors, and manage deployments.

npm · GitHub · Examples

Installation

npm install @acurast/sdk

The SDK relies on @polkadot/* packages as peer dependencies:

npm install @polkadot/api @polkadot/api-augment @polkadot/keyring \
@polkadot/types @polkadot/types-codec @polkadot/util \
@polkadot/util-crypto @polkadot/wasm-crypto

Which module do I need?

The SDK is split into subpath exports so you import only the parts you need.

ImportPurpose
@acurast/sdk/deployHigh-level deployment: zip a project, upload to IPFS, register a job — in one call
@acurast/sdk/chainDirect chain access: wallets, balances, job registration, assignments, env vars
@acurast/sdk/ipfsUpload deployment scripts to IPFS
@acurast/sdk/matcherPricing and processor matching helpers
@acurast/sdk/typesShared TypeScript types

@acurast/sdk/deploy

High-level deployment utilities. Zip a local project, upload it to IPFS, and register the job on the Acurast chain in a single call.

import { deployProject, loadAcurastConfig } from '@acurast/sdk/deploy'

const config = await loadAcurastConfig('./acurast.json')
await deployProject({ config /* ... */ })

Also exports zipFolder, createManifest, checkIsFolder, and a Logger interface with a NOOP_LOGGER default.

@acurast/sdk/chain

Direct access to the Acurast chain: wallets, balances, job registration, assignments, environment variables, and app versions.

import {
walletFromMnemonic,
getBalance,
registerJob,
jobAssignments,
AcurastService,
setEnvVars
} from '@acurast/sdk/chain'

Helpers include convertConfigToJob, duration constants (second, minute, hour, day), sensible defaults (DEFAULT_REWARD, DEFAULT_REPLICAS, ...), the JobEnvironmentService for encrypted env vars, and an InMemoryKeyStore.

For the list of environment variables available at runtime on the processor, see Runtime Environment.

@acurast/sdk/ipfs

Upload deployment scripts to IPFS.

import { uploadScript } from '@acurast/sdk/ipfs'

const cid = await uploadScript({
/* IpfsUploadOptions */
})

@acurast/sdk/matcher

Pricing and matching helpers for jobs: check whether a job has matching processors, analyze fees, and get pricing advice.

import {
checkMatch,
checkMatchWithReward,
getAveragePrice,
getPriceDistribution,
getProcessorCount,
suggestCostPerExecution,
getFeeAnalysis,
analyzePricing,
fetchPricingAdvice
} from '@acurast/sdk/matcher'

@acurast/sdk/types

Shared TypeScript types used across the SDK.

Examples

See the examples/ folder for end-to-end usage.