Skip to content
oceanprotocolPublic

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

10 stars

Watchers

7 watching

Forks

Repository files navigation

banner

Ocean CLI

Publish, consume and run compute on data from your terminal, privately and securely.

npm license node code style: prettier

Ocean CLI is the command-line client for Ocean Protocol. It talks to an Ocean Node (which handles indexing, metadata caching, encryption, ordering and compute) and to an EVM chain through an RPC endpoint. With it you can:

  • Publish and edit data assets: downloadable files or compute-to-data.
  • Consume assets: order datatokens and download data.
  • Run compute-to-data (free or paid) on published datasets with a published or raw algorithm.
  • Run on-demand services: long-running containers (JupyterLab, inference servers, ...) on compute environments, paid via escrow.
  • Manage escrow payments, access lists, persistent-storage buckets and auth tokens.

Built on @oceanprotocol/lib (ocean.js ^9.0.0) and @oceanprotocol/ddo-js (^1.0.0). Problems? Open a new issue.

Contents

Requirements | Install | Quick start | Configuration | How the CLI works | Nodes and chains | Command guide | Start from a JSON file | Command reference | Sample metadata | Troubleshooting | Development | License

Requirements

  • Node.js >=22 (download)
  • Linux, macOS, or Windows via WSL
  • An RPC endpoint for the chain you target
  • A funded wallet (native gas token, plus datatokens / payment tokens as needed)
  • An Ocean Node to talk to (HTTP(S) URL, libp2p peer id, or multiaddr)

Install

npm install -g @oceanprotocol/cli
ocean-cli --version
ocean-cli h            # list all commands

--help, -h, --version and h work with no environment variables set. Every other command needs the configuration below. Contributors: see Development.

Quick start

export PRIVATE_KEY="0x..."                  # or MNEMONIC="word1 word2 ..." — the only secret, never stored

# One-time setup, saved to ~/.ocean/cli/config.json (so no RPC / NODE_URL env vars are needed again):
ocean-cli addChain 8453 https://your-rpc.example   # register a chain (each URL is verified)
ocean-cli setNode http://127.0.0.1:8001            # choose an Ocean Node (health-checked)

# Afterwards every run needs only PRIVATE_KEY exported:
# Publish a sample asset (edit chainId / serviceEndpoint in the file first)
ocean-cli publish metadata/simpleDownloadDataset.json

# Download it (prints the DID on publish)
ocean-cli download did:op:123 ./downloads

# See where you can run compute
ocean-cli getComputeEnvironments

Prefer environment variables? export RPC=... and export NODE_URL=... still work and take precedence over the saved file. See Configuration.

Configuration

Settings come from three places, in order of precedence: a command-line flag, an environment variable, then the configuration file (below). A built-in default applies when none of those set a value. The only secrets — PRIVATE_KEY / MNEMONIC — are read from the environment only and are never written to the file.

Configuration file

The CLI keeps one per-user file, by default ~/.ocean/cli/config.json (override the whole path with OCEANCLI_CONFIG_PATH). It holds every setting except the signer secret, so once it is set up you run ocean-cli <command> with only PRIVATE_KEY exported. Commands that change a setting (addChain, setChain, setNode, setNodeEnv, setConfig, and the favourites / subsidy commands) save it automatically — there is no separate "save" step. The file is written atomically with permissions 0600 (directory 0700); because RPC URLs may embed API keys, keep it private.

ocean-cli getConfig                             # alias showConfig; every setting with its source (env / file / default)
ocean-cli getConfig indexing.maxRetries         # one setting
ocean-cli setConfig indexing.maxRetries 200     # saved immediately
ocean-cli unsetConfig indexing.maxRetries       # remove it (falls back to env / default)

setConfig handles the plain settings in the Optional table below; nodeUrl, computeEnvId, rpc and defaultChainId are changed only through their dedicated commands (setNode, setNodeEnv, addChain/removeChain, setChain), which validate first. Example file:

{
  "version": 1,
  "nodeUrl": "https://node.example.com",
  "rpc": { "8453": ["https://base.a.example", "https://base.b.example"], "1": ["https://eth.example"] },
  "defaultChainId": 8453,
  "indexing": { "maxRetries": 120, "retryIntervalMs": 4000 },
  "favouriteNodes": [{ "node": "https://node.example.com", "description": "main GPU node" }],
  "subsidyProviders": { "8453": [{ "address": "0xAbC...0001", "enabled": true }] }
}

What auto-saves:

Command Saves
addChain / removeChain rpc[chainId] (and defaultChainId when it is the first chain)
setChain defaultChainId
setNode nodeUrl (clears computeEnvId)
setNodeEnv nodeUrl + computeEnvId
setConfig / unsetConfig the named key
addFavouriteNode / removeFavouriteNode favouriteNodes
addSubsidyProvider / removeSubsidyProvider / toggleSubsidyProvider subsidyProviders[chainId]

When an environment variable and the file both set the same thing, the env wins for that run and the file is left untouched; getConfig shows both so nothing looks silently ignored.

Environment variables

Every variable below (except the secrets) has a matching config key, so it can be saved to the file instead of exported.

Required

Variable Config key Description
PRIVATE_KEY or MNEMONIC — (never stored) Signer credentials. The private key is preferred.
RPC rpc Required unless the config file already has a chain (add one with addChain <chainId> <rpcUrl>, which saves it). Either a single URL (http://localhost:8545) or a JSON map keyed by chainId whose values are a URL or an ordered list of URLs: '{"1":"https://eth.example","8453":["https://a","https://b"]}'. Two or more URLs for a chain become an ethers v6 FallbackProvider (quorum: 1, declaration order = preference). Env RPC chains are merged with the file's and env wins per chainId. A malformed value fails at startup with the expected shape.

Recommended

Variable Config key Description
NODE_URL nodeUrl The initial Ocean Node: HTTP(S) URL, libp2p peer id, or full multiaddr. The CLI starts without it, but then only the node-free commands (setNode, setNodeEnv, getNode, help, searchComputeResources, the chain commands, and the configuration / favourites / subsidy commands) work; everything else fails with No Ocean Node set until you run setNode. Saved by setNode, so you normally set it once.

Optional — each can be set via the env var or saved with setConfig <config key> <value>:

Variable Config key Default Description
OCEANCLI_CONFIG_PATH — ~/.ocean/cli/config.json Full path to the config file (overrides the default location; relative paths resolve against the cwd).
CHAIN_ID defaultChainId resolved automatically Default (active) chain for the session. Change with setChain. See Nodes and chains.
COMPUTE_ENV_ID computeEnvId none Default compute environment id for the current node (set by setNodeEnv).
ADDRESS_FILE addressFile ocean.js bundled addresses Path to a contracts address.json for Barge / custom deployments. Without it, escrow, access-list and Ocean-token addresses come from the multi-chain set bundled with ocean.js.
DISABLE_P2P disableP2P false true skips libp2p. Fatal at startup if combined with a P2P NODE_URL (peer id / multiaddr). Use it only if you exclusively use HTTP nodes. searchComputeResources needs libp2p.
BOOTSTRAP_PEERS bootstrapPeers none Comma-separated extra libp2p multiaddrs, added to the built-in Ocean bootstrap list.
AVOID_LOOP_RUN avoidLoopRun false true = one-shot: run the command and exit (use for CI and scripts). Unset = interactive. (AVOID_LOOP_RUN=false in the env also overrides a saved avoidLoopRun: true.)
INDEXING_MAX_RETRIES indexing.maxRetries 120 Max retries while waiting for an asset to be indexed.
INDEXING_RETRY_INTERVAL indexing.retryIntervalMs 4000 Milliseconds between indexing retries.
SEARCH_TIMEOUT_MS searchTimeoutMs 60000 Timeout for node search requests, in milliseconds.
SSI_WALLET_API, SSI_WALLET_ID, SSI_WALLET_DID ssi.walletApi, ssi.walletId, ssi.walletDid none SSI wallet settings for v5 DDOs (credentialSubject / SSI policy flows).

mintOcean additionally needs an Ocean token address, from the chain's configured oceanTokenAddress or --token <address> (some chains, e.g. Base, ship none).

How the CLI works

  • Interactive vs one-shot. By default the CLI runs the command you pass (if any) and then stays in a prompt (REPL). Leave with exit, quit, ESC or CTRL-C. In the prompt you can type the bare command or paste a full ocean-cli ... line. With AVOID_LOOP_RUN=true it runs once and exits. setNode (and the other setting commands) persist to the configuration file, so a node selected even in one-shot mode is remembered and reused by later runs.
  • Positional and named arguments. Named options may come in any order and override the matching positional when both are given. But a required positional (<x>) must still be supplied positionally — passing only its named option fails with Commander's missing required argument (e.g. publish --file metadata.json errors; use publish metadata.json, and publish metadata.json --file other.json lets the option win). Optional positionals ([x]) may be omitted or supplied via their named option. A few commands (e.g. downloadJobResults) are positional-only.
  • JSON arguments. Single-quote JSON on the shell and put -- before the arguments so option parsing stops: ocean-cli startCompute -- '["did:op:a",{"fileObject":{...}}]' did:op:algo ....
  • Help. ocean-cli h or ocean-cli help prints the grouped command list (the help command takes no argument). For a specific command's arguments and options, add --help / -h after it: ocean-cli publish --help.

Nodes and chains

Choosing the node (works inside the interactive prompt, no restart):

ocean-cli setNode http://127.0.0.1:8001      # alias useNode; also a peer id, multiaddr, or --node
ocean-cli getNode                            # alias currentNode: active node, version, chains served
ocean-cli setNodeEnv '16Uiu2HAm...|0xff10...-0xc92e...'   # alias useNodeEnv (quote: the token contains a '|')

setNode health-checks the node first; if unreachable, nothing changes. setNodeEnv takes the Node+env: token printed by searchComputeResources, switches node like setNode and remembers the compute env so startCompute / startFreeCompute need no --env. Notes:

  • Compute jobs live on the node that started them; after a switch, getJobStatus / downloadJobResults query the new node.
  • For a node on your own machine prefer the full multiaddr (/ip4/127.0.0.1/tcp/9001/ws/p2p/<peerId>); a bare peer id needs DHT lookup, which may not advertise localhost.
  • chainId always comes from RPC, never from the node. setNode warns if the node does not serve your chain; getNode flags served chains with no RPC configured.

Favourite nodes (saved in the config file; node-free, work offline):

ocean-cli addFavouriteNode https://node.example.com main GPU node   # alias addFavoriteNode; no node arg = the current node
ocean-cli listFavouriteNodes                                        # aliases listFavoriteNodes, favourites, favorites
ocean-cli setNode 2                                                 # switch to favourite #2 (validated like any setNode)
ocean-cli removeFavouriteNode 2                                     # alias removeFavoriteNode; by number or by URL / peer id

Each entry is a node URL / peer id / multiaddr plus an optional description. The format is checked when saving, but reachability is not (a favourite may be offline at save time); re-adding an existing node updates its description instead of duplicating it. setNode <number> resolves the favourite then health-checks it like any other switch. The numbers are list positions and shift after a removal, so re-run listFavouriteNodes before using one.

Managing chains (node-free; work before a node is set):

ocean-cli addChain 137 https://polygon-rpc.com [https://backup...]   # alias addRpc; each URL is verified
ocean-cli removeChain 137                                            # alias removeRpc
ocean-cli listChains                                                 # aliases getRpcs, chains
ocean-cli setChain 137                                               # alias useChain; persisted default
ocean-cli getChain                                                   # alias currentChain

Added chains persist to the configuration file (~/.ocean/cli/config.json). The active default chain is: setChain / CHAIN_ID -> persisted default -> the only configured chain. If none of those resolve, commands that target a specific chain require an explicit --chainId. (The display-only listChains additionally reports the single chain the node and your registry both know, but that intersection is not used to auto-select a chain for commands.)

How each command picks its chain:

Category Commands Chain used
Chain-agnostic reads, jobs, storage, auth tokens, node/chain management Default (or any registered) chain; node/chain management does not sign
DDO-implied publish, publishAlgo, editAsset, allowAlgo, download The DDO's own chainId
Explicit mintOcean, all escrow, all access-list, startService, extendService, startTemplate, saveTemplate, startCompute, startFreeCompute --chainId <id>, else the default chain, else an error listing configured chains

For startCompute, --chainId is the payment/escrow chain only; each asset is ordered on its own DDO chain, so one job can span chains. Every chain involved must be a registered RPC. For startFreeCompute it only selects the signing chain.

Command guide

Each section shows the common usage; run ocean-cli <command> --help for every option, or see the reference table.

Assets

ocean-cli getDDO did:op:123                                  # or --did
ocean-cli publish metadata.json                              # or --file; add --encrypt false to skip DDO encryption
ocean-cli publishAlgo algorithm.json                         # same options as publish
ocean-cli editAsset did:op:123 metadata.json                 # alias edit; or --did / --file
ocean-cli download did:op:123 ./custom-folder [serviceId]    # or --did --folder --service
ocean-cli allowAlgo did:op:dataset did:op:algo               # dataset NFT owner only; --encrypt true|false

download defaults to services[0]; a serviceId not present in the DDO fails fast. For v5 DDOs (version >= 5.0.0) it first runs a provider-initialize step, and with SSI_WALLET_API set it performs the SSI / policy-server verification (skipped automatically when the node has no policy server).

Compute

ocean-cli getComputeEnvironments [nodeUrlOrPeerId]           # alias getC2DEnvs; prints a payment + host-port summary per env
ocean-cli searchComputeResources --cpu 4 --ram 16 --paid --chain 8996 --order-by price   # alias findComputeNodes
ocean-cli startCompute --accept true -- did1,did2 algoDid env1 3600 0xPaymentToken '[{"id":"cpu","amount":1}]'
ocean-cli startFreeCompute did1,did2 algoDid env1

ocean-cli startCompute --from-json ./job.json               # all parameters from a file, see below
ocean-cli getJobStatus job-123                    

ocean-cli downloadJobResults job-123 0 ./results             # positional only (jobId, index, folder)
ocean-cli stopCompute job-123                                # or --job; only a jobId is needed
ocean-cli computeStreamableLogs <jobId>                      # or --job

startCompute details:

  • maxJobDuration (seconds) is required and drives the payment.
  • paymentToken is required: a token the environment accepts on the payment chain (see getComputeEnvironments).
  • resources is required: stringified JSON within the environment's limits, e.g. '[{"id":"cpu","amount":3},{"id":"ram","amount":16772672536},{"id":"disk","amount":0}]'.
  • --accept true auto-confirms payment (mandatory when stdin is not a TTY); false prompts.
  • --services (comma-separated dataset service ids, mapped by position to the datasets) and --algo-service (the algorithm's service id) are optional; the first available service is used when omitted.
  • --output is an optional stringified JSON remote-storage backend for results (S3, FTP, URL, Arweave, IPFS); omitted means results stay on the node's disk. Example: '{"remoteStorage":{"type":"s3","s3Access":{"endpoint":"https://s3.amazonaws.com","region":"us-east-1","bucket":"my-results","objectKey":"jobs/result.tar","accessKeyId":"AKIA...","secretAccessKey":"..."}}}'.
  • --subsidyProviders optionally picks which subsidy providers back the escrow claim (see Subsidy providers).

startFreeCompute takes the same dataset/algo/--services/--algo-service/--output arguments, targets a free environment and does no ordering or payment.

Raw (unpublished) datasets and algorithms. Instead of a DID, pass a full ComputeAsset (datasets) or ComputeAlgorithm JSON object with a fileObject. Raw entries have no DID and no datatoken order, and can be mixed with DIDs (the value must then be valid JSON, DIDs quoted). Works for both startCompute and startFreeCompute:

# Raw algorithm on a dataset that sets allowRawAlgorithm: true
ocean-cli startCompute --accept true -- did:op:dataset '{"fileObject":{"type":"url","url":"https://example.com/algo.py","method":"GET"},"meta":{"container":{"entrypoint":"python $ALGO","image":"oceanprotocol/algo_dockers","tag":"python-branin","checksum":"sha256:..."}}}' env1 900 paymentToken resources

# Raw dataset on a published algorithm
ocean-cli startCompute --accept true -- '[{"fileObject":{"type":"url","url":"https://example.com/data.csv","method":"GET"}}]' did:op:algo env1 900 paymentToken resources

# Mixed: published DID plus raw IPFS file
ocean-cli startCompute --accept true -- '["did:op:dataset",{"fileObject":{"type":"ipfs","hash":"Qm..."}}]' did:op:algo env1 900 paymentToken resources

Finding a node. searchComputeResources is a P2P/DHT search (needs libp2p, so not with DISABLE_P2P=true; works before setNode). Run it with no filters for an interactive wizard, or script it with flags: --cpu --ram --disk --gpu --gpu-model --resource name:amount (repeatable) --free|--paid|--both --chain <ids> --token <addrs> --max-price --duration --order-by price|freeCapacity|resources|leastBusy. --chain and --token take comma-separated lists; a paid env pricing on several requested chains is listed once per chain. Each match starts with a ready-to-run setNodeEnv <node>|<env> line. Environments that fall short of the request are filtered out, with a note on how many.

Services on demand

An on-demand service is a long-running container that stays up until it expires, is stopped, or is extended, reachable at http://<nodeHost>:<hostPort>. Escrow must be funded and authorized first.

ocean-cli getServiceTemplates                              # catalogue; --category llm, --kind bundle, --all, --raw
ocean-cli getServiceTemplate <templateId>                  # full detail of one template (--full for command/Dockerfile)
ocean-cli startTemplate <templateId>                       # start it; env, token, duration, resources chosen for you
ocean-cli startTemplate <templateId> --set HF_TOKEN=hf_xxx --duration 7200 --dry-run
ocean-cli startTemplate <templateId> '{"duration":7200,"userData":{"HF_TOKEN":"hf_xxx"}}'
ocean-cli saveTemplate <templateId> ./my-service.json      # write a file for startService --from-json
ocean-cli startService --from-json ./my-service.json

# Fund escrow and authorize the env's consumer address (maxLockSeconds >= duration + 3600)
ocean-cli depositEscrow 0x<token> 100
ocean-cli authorizeEscrow 0x<token> 0x<envConsumerAddress> 100 90000 100

# From an operator template, or your own image (tag goes in --tag, not --image)
ocean-cli startService <envId> 3600 0x<token> --template jupyter-cpu --user-data '{"JUPYTER_TOKEN":"secret"}'
ocean-cli startService <envId> 3600 0x<token> --image nginxinc/nginx-unprivileged --tag alpine --ports 8080
ocean-cli startService <envId> 3600 0x<token> --image myrepo/app --ports 8888,8080:30010   # pin host port 30010

ocean-cli getServiceStatus <serviceId>                     # alias myServices; YOUR services, full detail
ocean-cli getServices --status 40                          # alias listServices; ALL owners on the node
ocean-cli serviceLogs <serviceId> --since 10m              # alias computeServiceLogs
ocean-cli extendService <serviceId> 1800 --accept true
ocean-cli restartService <serviceId>                       # reuse stored spec
ocean-cli restartService <serviceId> --image myrepo/algo --tag v2   # rebuild on a new image
ocean-cli restartService <serviceId> --ports 8080:30011             # re-pin exposed ports
ocean-cli restartService <serviceId> --ports none                   # clear all ports
ocean-cli stopService <serviceId>
  • Duration is in seconds. The CLI prints an estimated cost; the authoritative cost is shown as Node-computed cost: after start.
  • Start is asynchronous: it returns a serviceId in status Starting (10), then the CLI polls until Running (40) (unless --wait false; --timeout defaults to 600 s). If interrupted, resume with getServiceStatus <serviceId>.
  • Escrow shortfalls do not fail the HTTP call; they surface as the job ending in Error. The CLI pre-verifies funds and authorization and aborts with the exact remediation commands.
  • Image spec: at most one of --tag, --checksum, --dockerfile. Keep the tag out of --image, otherwise the node builds an invalid image:tag:latest.
  • Containers run with CapDrop ALL and cannot bind ports below 1024; listen on a high port such as 8080.
  • --ports takes container[:hostPort] tokens, comma-separated (e.g. 8888,8080:30010). A bare port auto-allocates its host port; container:hostPort pins it. Note the order is container:host — the reverse of Docker's -p host:container — to match the node's {containerPort, hostPort} field order. A node that supports Service-on-Demand advertises the valid host-port range and the ports already in use under getComputeEnvironments (host ports: …); pick any in-range port not listed as in use. getServiceStatus shows the resolved host port on each endpoint line and a requested host ports: line confirming the pins. Older nodes ignore pins silently. On startService, pins are pre-checked against the env's advertised range / in-use list / per-service limit before any escrow deposit, so an out-of-range, already-taken, or over-limit pin fails fast instead of costing gas and a deposit only to be rejected by the node.
  • --user-data is a JSON object of container env vars, encrypted to the node's key. Values are never logged.
  • A --template <id> start labels the service for the dashboard automatically (metadata {"appType":"template"|"service","appId":"<id>"}, the same labels the dashboard stamps on its own launches: template for a bundle or curated model, service for a bare one), so it shows that exact template instead of a generic "vLLM"/"ComfyUI" row and can be edited/extended there. An --image start carries no labels.
  • --metadata adds owner labels or overrides the automatic ones (your keys win). They are stored as-is and in clear, so never put secrets in them: a flat JSON object of string/number/boolean values, at most 1024 characters as JSON. On restartService, --metadata replaces the stored labels; omit it to keep them.
  • getServiceStatus shows your services in full; getServices lists all owners' services with the image spec stripped and supports --status, --include-all, --from.
  • restartService with no spec flags bounces the container unchanged (REUSE). Any of --image --tag --checksum --dockerfile --additional-docker-files rebuilds it on the new spec (RESPEC), keeping expiry and payment window at no extra charge. --cmd / --entrypoint replace the stored command (empty array clears). --ports replaces the exposed ports (container[:hostPort], comma-separated); --ports '' or --ports none clears all ports, and omitting --ports keeps the current ones. A port change applies independently of the REUSE/RESPEC rule, like --cmd. exposedPorts is never sent on restart.

Templates

A node publishes service templates: predefined services (image, ports, command, recommended resources, and the variables you may set). startTemplate resolves everything startService needs from the template and the node, in this order:

  1. Offline checks: [params] (an inline JSON object or a path to a JSON file, using the startService --from-json keys — but not the image-defining ones: template, image, tag, checksum, dockerfile and additionalDockerFiles are rejected, since the image comes from the template. The supported overrides are env, duration, paymentToken, resources, userData/userDataFile, ports, cmd, entrypoint, outputBucketId, chainId, subsidyProviders, accept, wait, timeout), --set, --user-data, --user-data-file, --resources, --subsidyProviders. Any problem stops before the network.
  2. Payment chain: --chainId → params.chainId → the active chain.
  3. Variables (userData), merged later-wins: params.userData/userDataFile → --user-data-file → --user-data → --set.
  4. Fetch templates and environments from the node.
  5. Work out which environments the wallet may use (environment access lists are checked client-side).
  6. Pick environment, token, duration, resources, fill the GPU-count variable, validate variables and required ones.
  7. Print the plan (variable keys only, never values) and the estimated cost, then pay (unless --dry-run).

The defaults, when you do not pass them:

  • Environment (--env): the one chosen by setNodeEnv, else the cheapest environment that can run the template on the payment chain and that this wallet is allowed to use (ties: lowest id). If the setNodeEnv environment no longer fits (it is gone or unusable on this node), resolution prints a note and falls back to automatic selection; pass --env <id> to require a specific environment — an explicit --env that does not fit is a hard error, not a fallback. "Cheapest" compares the raw per-environment cost numbers as-is: when eligible environments price in different tokens those values are not converted, so the ranking is only meaningful within one token — inspect the listed candidates and pin one with --env when they differ. The choice is printed; other candidates are listed.
  • Access: an environment restricted by an access list is skipped when this wallet is not allowed (an address allow-list or an on-chain balance of a listed access-list contract). A list that cannot be read (no RPC configured for its chain, or the read fails) is not checked: the environment stays usable, ranks after every verified one, and a note is printed. The node remains the authority: if you are not allowed it rejects the start — but, depending on the node, this can happen after the CLI has already submitted the escrow deposit and authorization for the service. Those funds stay in your escrow balance and can be withdrawn (withdrawFromEscrow); do not assume rejection happens before any on-chain payment step.
  • Payment token (--token): the environment's only token on the payment chain. Several tokens → error asking for --token.
  • Duration (--duration): 3600 s, clamped into the environment's service duration bounds.
  • Resources (--resources): cpu/ram/disk sized from the template's recommendation; GPU from the cheapest layout that fits. If the template names a GPU-count variable, it is set to the booked GPU count (or, when you set it, it forces the layout). If you pass --resources yourself, those exact resources are used and the GPU-count variable is left as-is — unset unless you set it, never auto-filled; a GPU count in --resources that conflicts with a GPU-count variable you did set is rejected.
  • Required variables: a required variable with no value is an error for startTemplate (before any payment). There is no interactive prompting.

startTemplate --dry-run prints the resolved plan and the estimated cost and stops — no escrow check, no payment. The estimate is the environment's full price for the chosen resources and duration (it does not apply any prepaid-subsidy reduction, which is computed only on a real start); --subsidyProviders does not change this dry-run figure.

saveTemplate <templateId> [file] runs the same resolution and writes a startService --from-json file (default ./<templateId>.service.json, mode 0600, never overwritten without --force). It is self-contained by default (image, tag/checksum, ports, command, entrypoint copied); --reference writes "template": "<id>" instead. Missing required variables are written as "REPLACE_ME" with a warning; startService refuses to start while a value still equals REPLACE_ME. A template that builds from an inline Dockerfile writes the Dockerfile next to the JSON and references it by a relative path. The generated file is validated before writing, so it is guaranteed to load with startService --from-json. Nothing is paid.

getServiceTemplates no longer prints the full JSON by default; pass --raw for the Service templates: [...] line.

Start from a JSON file

startCompute, startFreeCompute and startService accept --from-json <path> and read every parameter from that file instead of the command line:

ocean-cli startCompute --from-json ./job.json
ocean-cli startCompute --from-json ./job.json --env <otherEnv> --accept true   # override single values
ocean-cli startService --from-json ./jupyter.json
  • Values are native JSON (arrays, objects, numbers), not stringified JSON.
  • The whole file is validated before anything is sent; every problem is listed at once and the command exits with status 1. Unknown keys are errors.
  • A named option on the command line overrides the matching value from the file. The file is still validated as a complete spec on its own before the command line is merged in, so every key marked Required below must be present in the file even when you also pass its option — an option overrides a value, it does not fill in a missing required one. Positional arguments cannot be used together with --from-json.
  • Paths inside the file (dockerfile, additionalDockerFiles, userDataFile) are relative to the JSON file's folder. These files are read and their contents sent to the node, so only run --from-json on a job file you trust — a file authored by someone else could point a path field at a local secret (e.g. ~/.ssh/id_rsa, a .env).
  • The file may contain secrets (userData, storage credentials in output); keep it out of version control.
  • A top-level $schema string is allowed and ignored. A key set to null counts as absent.

Ready-to-edit examples are in metadata/jobs/.

startCompute

Key Type Required Rules
datasets array yes May be []. Each entry: a DID string, or an object with a fileObject object (raw dataset)
algorithm string or object yes A DID string, or an object with a fileObject object or a meta.rawcode string
env string no Non-empty. Falls back to the env selected via setNodeEnv
maxJobDuration number yes Integer >= 1 (seconds)
paymentToken string yes EVM address
resources array yes May be []. Entries { "id": string, "amount": number >= 0 }, no duplicate id
chainId number no Integer >= 1, the payment/escrow chain
output object no Remote-storage backend object
serviceIds array no Strings or null; length must equal datasets
algoServiceId string no Non-empty
subsidyProviders array or "none" no Addresses (may be []) or "none"; absent = node defaults
accept boolean no Skip the payment prompt

startFreeCompute allows datasets, algorithm, env, output, serviceIds, algoServiceId and chainId (same rules). maxJobDuration, paymentToken, resources, subsidyProviders and accept are rejected: a free job has no payment.

startService

Key Type Required Rules
env string yes Non-empty
duration number yes Integer >= 1 (seconds)
paymentToken string yes EVM address
template string one of template / image Non-empty
image string one of template / image Non-empty
tag string no At most one of tag / checksum / dockerfile
checksum string no Non-empty
dockerfile string (path) no File must exist
additionalDockerFiles string (path) or object no Path: file must exist. Object: {filename: content} strings
cmd array of strings no
entrypoint array of strings no
ports array no Each a port number (auto-allocate) or {"containerPort": n, "hostPort"?: m} (pin); mix allowed; ports integers 1-65535
resources array no Same entry rules as startCompute
userData object no Not together with userDataFile
userDataFile string (path) no File must exist
metadata object no Flat object of string/number/boolean values, at most 1024 characters as JSON
chainId number no Integer >= 1
subsidyProviders array or "none" no As startCompute
outputBucketId string no Non-empty
accept boolean no
wait boolean no
timeout number no Integer >= 1 (seconds)

Escrow

ocean-cli depositEscrow 0xToken 100                        # or --token --amount
ocean-cli getUserFundsEscrow 0xToken
ocean-cli withdrawFromEscrow 0xToken 50
ocean-cli authorizeEscrow 0xToken 0xPayee 1000 3600 10     # token payee maxLockedAmount maxLockSeconds maxLockCounts
ocean-cli getAuthorizationsEscrow 0xToken 0xPayee
ocean-cli getEscrowInfo [0xToken]                          # alias escrowInfo; read-only capability report

All accept --chainId. authorizeEscrow flags: --token --payee --maxLockedAmount --maxLockSeconds --maxLockCounts.

Escrow v2. The escrow contracts support lock-time pre-funded sponsorship (a subsidy provider can back part or all of a lock at creation, so a fully-sponsored user can transact with no deposit) and authorization expiry (a payee key can be time-boxed or revoked). The CLI reflects this:

  • authorizeEscrow takes -e, --expiry <unixSeconds> (0 = indefinite, default). Re-running it overwrites the record (renew/shorten), and an --expiry in the past revokes it; claim and cancel are never gated by expiry, so existing locks stay claimable. Example — revoke then re-grant for 1h: ocean-cli authorizeEscrow 0xToken 0xPayee 1000 3600 10 --expiry 1 then ... --expiry $(( $(date +%s) + 3600 )).
  • getAuthorizationsEscrow prints the authorization's expiryTimestamp, and getEscrowInfo [token] reports the escrow's capabilities (version, escrowKind, IEscrowLockSubsidy/IEscrowEnterprise support, maxSponsorsPerLock) via ERC-165, plus the sponsored-bucket total and your reclaimable amount when a token is given.
  • Reading state: getUserFunds().locked and Current Locked Amount now count only the payer's own locked funds; provider-sponsored tokens live in a separate sponsored bucket (getEscrowInfo <token>).

These commands require the Escrow v2 deployment; they degrade gracefully against a legacy escrow.

Subsidy providers

Subsidy providers are on-chain contracts that sponsor part or all of a job's cost (a subsidy released back to the payer, plus an optional bonus paid to the node), subject to allow-lists, job-type restrictions and per-period caps. The Ocean Node is the source of truth for which subsidy providers are usable (a node may not support them at all), so the CLI reads provider addresses from the node's status, never from bundled contract addresses.

ocean-cli getNodeSubsidyProviders                          # alias subsidyProviders; per-chain providers the node advertises
ocean-cli getNodeSubsidyStatus 0xToken                     # alias subsidyStatus; your limits / remaining credit
ocean-cli getSubsidyStatus 0xProvider 0xToken              # alias getSubsidyProviderStatus; one provider by address
ocean-cli getSubsidyStatus 0xProvider 0xToken 8453         # ...with an explicit chainId
  • getNodeSubsidyStatus discovers the provider contract(s) from the node, then prints each one's kind, per-window buckets (limit / used / remaining / reset), claimable amount, contract balance and your eligibility. Flags: --token --chainId --node --jobType --amount --subsidy 0xA[,0xB]. --node <url|peerId> queries a specific Ocean Node (default: the active node) and uses that node's on-chain address for the isNodeAllowed check; adding --jobType and --amount also prints a subsidy quote ({subsidy, bonus}). --subsidy depends on the node's provider filter: with the filter off the node accepts any provider named per request, so the listed addresses are queried as-is (even when the node advertises none; the ones it does not advertise are flagged as not node defaults); with the filter on the list is narrowed to what the node advertises.
  • getSubsidyStatus <subsidyProviderAddress> <tokenAddress> [chainId] (alias getSubsidyProviderStatus) reports on one provider contract you name directly — the same report (kind, buckets, claimable amount, balance, eligibility, rolling-window / one-time detail) as getNodeSubsidyStatus prints per provider, but independent of the node's advertised list. The chain is resolved as --chainId (or the [chainId] positional) → the chain your saved subsidy providers (addSubsidyProvider / listSubsidyProviders) record that provider on → error asking for a chainId. So for a provider you have saved you can omit the chain; for any other provider pass it explicitly. Node-free: no node is consulted to resolve the chain, only an RPC for that chain is needed. Optional --node supplies the node address for the isNodeAllowed line, and --jobType + --amount add a quote (needs a node address).
  • startCompute, startService and extendService take --subsidyProviders <list>: omit for the node's defaults, none (or empty) to claim with no subsidy, or 0xA,0xB to claim against exactly those contracts. startFreeCompute ignores it (a free job does no escrow claim).
  • Zero-deposit paid compute. Before a paid startCompute the CLI asks the subsidy providers how much of the job they would pre-fund at lock time and deposits only your share; the payment prompt shows the total cost and what you pay. A fully sponsored job needs no payment tokens for the compute lock — only gas for a single authorize transaction, which lets the node create the lock (with a ceiling of 0, i.e. the lock can never take your own funds). Refund-only providers pre-fund nothing, so you still front the full cost and are reimbursed at claim. Sponsorship and that ceiling cover the compute lock only: each DID-based dataset or algorithm is still ordered on its own chain before the job starts, which can cost a datatoken and/or provider fees (plus gas) that no subsidy covers. The quote is advisory: if a provider's budget runs out before the node creates the lock, the node rejects the job and nothing is locked or deposited for it, but orders already placed for its assets are not reversed. startService and extendService apply the same rule to the service lock.

Saved subsidy providers. You can keep a per-chain list of subsidy-provider contracts in the configuration file so paid jobs use them without a flag each time. These commands are node-free and need no RPC (the chainId is an explicit argument), so they work on a fresh install:

ocean-cli addSubsidyProvider 8453 0xProvider OPF subsidy   # alias addSubsidy; enabled by default, optional description
ocean-cli listSubsidyProviders [8453]                      # alias listSubsidy; all chains, or one
ocean-cli toggleSubsidyProvider 8453 1 off                 # alias toggleSubsidy; enable/disable (omit on|off to flip)
ocean-cli removeSubsidyProvider 8453 1                      # alias removeSubsidy; by per-chain number or by address

When startCompute, startService or extendService run with no --subsidyProviders flag, your enabled saved providers for the payment chain are merged with the node's advertised providers (node advertised ∪ your enabled saved) and used for the job; a note names any that were added. If the node runs a provider filter, saved providers it does not advertise are dropped with a note rather than rejected. Passing --subsidyProviders (including none) overrides the saved list entirely. Numbers are per-chain positions and shift after a removal; a newly added provider is enabled, and re-adding one never silently re-enables a disabled entry or erases its description (only toggleSubsidyProvider changes the flag). Saved entries are not checked on-chain when saved — the node validates them at job time. This is distinct from getNodeSubsidyProviders, which shows what the node advertises, not your saved list.

Access lists

ocean-cli createAccessList "My Access List" "MAL" "0xUser1,0xUser2" false   # name symbol [initialUsers] [transferable, default false]
ocean-cli addToAccessList 0xListAddress "0xUser1,0xUser2"
ocean-cli checkAccessList 0xListAddress "0xUser1,0xUser2"
ocean-cli removeFromAccessList 0xListAddress "0xUser1,0xUser2"

Named forms: --name --symbol --initial-users --transferable, and --address --users. All accept --chainId.

Persistent storage

ocean-cli createBucket [accessListAddress]                 # omit for owner-only access
ocean-cli addFileToBucket <bucketId> ./file.csv [fileName] # name defaults to the file's basename
ocean-cli listBuckets [--owner 0xOwner]                    # defaults to the signer
ocean-cli listFilesInBucket <bucketId>
ocean-cli getFileObject <bucketId> <fileName>              # file-object descriptor
ocean-cli downloadBucketFile <bucketId> <fileName> [destPath] [offset]  # pull the file to disk; offset resumes/appends
ocean-cli deleteFile <bucketId> <fileName>

downloadBucketFile (alias downloadFromBucket) streams the file to destPath (default: current dir) under the file's basename. With offset 0 (the default) it writes the whole file, truncating any existing file of the same name. A positive offset resumes a partial download: the bytes from that offset are appended to the existing file, which must already be exactly offset bytes (otherwise the command refuses, to avoid corrupting it). Resume requires the Ocean Node to honor HTTP Range requests (answer 206); against a node that doesn't, the command reports the error and keeps the partial file.

# Resume: a 6-byte partial ("hello ") is already on disk; fetch the rest from byte 6
ocean-cli downloadBucketFile <bucketId> alice-bob.txt ./out 6

Auth tokens

generateAuthToken mints a scoped, self-expiring JWT (ocean.js v11 / scoped-auth-tokens). By default the token is node-scoped (usable only at the current node) and the CLI gives it a 1-hour lifetime (capped to the node's advertised maxTokenLifetime). Before signing, ocean.js verifies the node's identity (OJ-03 challenge-response).

# node-scoped, 1h default lifetime
ocean-cli generateAuthToken

# custom lifetime
ocean-cli generateAuthToken --ttl 900                      # 15 minutes
ocean-cli generateAuthToken --valid-until 1990000000000    # absolute epoch-ms expiry (future)

# restrict the commands the token may perform
ocean-cli generateAuthToken --scope download,getDDO

# multi-node / unrestricted audience
ocean-cli generateAuthToken --audience 16Uiu2HA...,16Uiu2HB...
ocean-cli generateAuthToken --audience any                 # reusable, network-wide (warned)

# talk to a node that predates OJ-03 (insecure)
ocean-cli generateAuthToken --allow-unverified-issuer

ocean-cli invalidateAuthToken myAuthToken123               # or --token

# inspect / discover
ocean-cli getNodeAuthTokenPolicy                           # node's max lifetime, cross-node, revocation
ocean-cli listScopableCommands                             # commands valid in --scope (node-free)
ocean-cli decodeAuthToken myAuthToken123                   # decode claims locally (node-free)

Breaking change: v2 tokens require an expiry. If you call ocean.js directly, pass { validUntil }; the CLI supplies a default. An --audience any token is a reusable bearer — use HTTPS/Noise transport and a short lifetime.

generateAuthToken prints the token to stdout; the expiry/audience/scope summary and any warnings go to stderr, so ocean-cli generateAuthToken | … captures only the token. Note that decodeAuthToken only decodes a token locally — it does not verify its signature, so treat the printed claims as untrusted.

Admin

Admin commands act on the Ocean Node itself (not on assets). They work on both transports (HTTP and P2P).

Who is an admin. Every admin command is signed by your wallet (PRIVATE_KEY / MNEMONIC); auth tokens are not accepted. The node authorizes the signing address if it is listed in the node's ALLOWED_ADMINS, or holds a token on one of the node's ALLOWED_ADMINS_LIST access-list contracts (checked on-chain). The CLI runs a pre-flight check against the node's public status before every signed admin call: it stops locally if you are definitely not an admin, and warns (but still tries) if authorization can only be decided on-chain via an access list. The chain the CLI signs on is irrelevant to admin auth.

# Status (public; no admin needed)
ocean-cli getNodeStatus                                    # alias: nodeStatus
ocean-cli getNodeStatus --detailed                         # drain state, C2D clusters

# Logs
ocean-cli downloadNodeLogs ./logs --last 24                # or: ./logs 24
ocean-cli downloadNodeLogs ./logs --from 1700000000000 --to 1700086400000 \
  --module http --level error --page 1                     # filters + pagination
ocean-cli downloadNodeLogs ./logs --all                    # fetch every page
ocean-cli getNodeLog --id <logId>                          # one entry by id

# Maintenance (drain) mode
ocean-cli setMaintenance on                                # alias: maintenance; also: --enabled true
ocean-cli setMaintenance off

# Node config (private key is masked in the output)
ocean-cli getNodeConfig ./node-config.json                 # alias: fetchConfig; omit file to print
ocean-cli setNodeConfig --set httpPort=9000 --accept true  # alias: pushConfig

# Indexer
ocean-cli reindexTx 8996 0x<64-hex-tx-hash>
ocean-cli reindexChain 8996 --accept true                  # optional [block]; omit = deployment block
ocean-cli indexer stop 8996 --accept true                  # or: indexer start 8996 (omit chain = all)

# Compute jobs / funds / lifecycle (destructive — confirm or pass --accept true)
ocean-cli adminStopJob <clusterHash>-<jobId> --accept true
ocean-cli collectFees 8996 0x<token> 0x<destination> 0.5 --accept true
ocean-cli stopNode --accept true

Notes and warnings:

  • downloadNodeLogs writes <output>/logs.json (the directory is created if missing). Use either --last (hours from now) or --from/--to (epoch ms); --maxLogs defaults to 100 (max 1000). --all pages through everything (capped at 100 pages, even if the last page is full, so a very large export may be partial); --page fetches one page.
  • setMaintenance on rejects new compute/service requests while letting running jobs finish; a MAINTENANCE_MODE env var on the node overrides this at the node's next boot.
  • setNodeConfig shallow-merges the top-level keys you send over the node's config file — each key you pass replaces that key as a whole. There is no server-side undo, so a bad value (e.g. supportedNetworks) can break the node. A keys object from getNodeConfig holds a masked private key and is dropped unless you pass --allowKeys true. --allowKeys true is for an intentional key replacement with real key material; a saved keys.privateKey still carrying the HIDDEN placeholder is refused even with the flag, so you never overwrite the node's key with the mask.
  • collectFees moves the node wallet's funds. There is no default destination and the amount is never defaulted: omitting the amount sweeps the whole balance of that token (use the zero address for the native token). It asks for confirmation.
  • stopNode stops the node process; it only comes back if a supervisor (docker restart policy, systemd) restarts it.
  • Destructive commands (stopNode, collectFees, setNodeConfig, reindexChain, adminStopJob, indexer stop) prompt for confirmation; pass --accept true to skip it (required when there is no TTY).

Development and testing helpers

ocean-cli mintOcean [--token 0xOcean] [--chainId 8996]     # mint test Ocean tokens (Barge / test chains)

Command reference

82 commands, as registered in src/cli.ts. <x> is required, [x] optional. A named option overrides its positional when both are passed. Every positional that has a matching named option is declared [x], so it can be supplied either positionally or by its option alone (the command itself errors if a needed value is missing from both). The remaining <x> positionals have no named-option equivalent and must be given positionally — these are setNodeEnv, downloadJobResults, restartService, and the bucket commands (addFileToBucket, listFilesInBucket, getFileObject, downloadBucketFile, deleteFile). Commands with no Options entry are positional-only. <command> --help is authoritative.

Command Aliases Arguments Options
help h
setNode useNode [nodeUrl] -n, --node
setNodeEnv useNodeEnv <nodeEnv>
getNode currentNode
addChain addRpc [chainId] [rpcUrl...] -c, --chainId, -u, --url
removeChain removeRpc [chainId] -c, --chainId
listChains getRpcs, chains
setChain useChain [chainId] -c, --chainId
getChain currentChain
getConfig showConfig [key] -k, --key
setConfig [key] [value...] -k, --key, -v, --value
unsetConfig [key] -k, --key
addFavouriteNode addFavoriteNode [node] [description...] -n, --node, -d, --description
listFavouriteNodes listFavoriteNodes, favourites, favorites
removeFavouriteNode removeFavoriteNode [node] -n, --node
getDDO [did] -d, --did
publish [file] -f, --file, -e, --encrypt [bool] (default true)
publishAlgo [file] -f, --file, -e, --encrypt [bool]
editAsset edit [did] [file] -d, --did, -f, --file, -e, --encrypt [bool]
download [did] [folder] [serviceId] -d, --did, -f, --folder (default .), -s, --service
allowAlgo [datasetDid] [algoDid] -d, --dataset, -a, --algo, -e, --encrypt [bool]
startCompute [datasets] [algo] [env] [maxJobDuration] [paymentToken] [resources] [output] [serviceIds] [algoServiceId] -d, --datasets, -a, --algo, -e, --env, --maxJobDuration, -t, --token, --resources, --chainId, --accept, -o, --output, -s, --services, -x, --algo-service, --subsidyProviders, --from-json
startFreeCompute [datasets] [algo] [env] [output] [serviceIds] [algoServiceId] -d, --datasets, -a, --algo, -e, --env, -o, --output, -s, --services, -x, --algo-service, --chainId, --from-json
getComputeEnvironments getC2DEnvs [node] -n, --node
searchComputeResources findComputeNodes --cpu --ram --disk --gpu --gpu-model --resource --free --paid --both --chain --token --max-price --duration --order-by
computeStreamableLogs [jobId] -j, --job
stopCompute [jobId] -j, --job
getJobStatus [jobId] -j, --job
downloadJobResults <jobId> <index> [folder]
getServiceTemplates serviceTemplates [node] -n, --node, --category, --kind, --all, --raw
getServiceTemplate serviceTemplate, showTemplate <templateId> -n, --node, --full
startTemplate runTemplate <templateId> [params] -e, --env, -d, --duration, -t, --token, -r, --resources, -s, --set, -u, --user-data, --user-data-file, --output-bucket, --dry-run, --accept, --wait, --timeout, --chainId, --subsidyProviders
saveTemplate exportTemplate <templateId> [file] -o, --output, -e, --env, -d, --duration, -t, --token, -r, --resources, -s, --set, -u, --user-data, --user-data-file, --output-bucket, --chainId, --reference, --force
startService [computeEnvId] [duration] [paymentToken] --template, -i, --image, --tag, --checksum, --dockerfile, --additional-docker-files, --cmd, --entrypoint, -p, --ports, -r, --resources, -u, --user-data, --user-data-file, --metadata, --accept, --wait, --timeout, --chainId, --subsidyProviders, --output-bucket, -e, --env, --from-json
getServiceStatus myServices [serviceId] -s, --service, -v, --verbose
getServices listServices [node] -n, --node, --status, --include-all, --from, -v, --verbose
serviceLogs computeServiceLogs [serviceId] -s, --service, --since
extendService [serviceId] [additionalDuration] [paymentToken] -s, --service, --duration, -t, --token, --accept, --chainId, --subsidyProviders
restartService <serviceId> -u, --user-data, --user-data-file, --cmd, --entrypoint, --image, --tag, --checksum, --dockerfile, --additional-docker-files, -p, --ports, --metadata, --wait, --timeout
stopService [serviceId] -s, --service
mintOcean -t, --token, --chainId
generateAuthToken --ttl, --valid-until, --audience, --scope, --allow-unverified-issuer
invalidateAuthToken [token] -t, --token
getNodeAuthTokenPolicy authTokenPolicy
listScopableCommands scopableCommands
decodeAuthToken decodeToken [token] -t, --token
depositEscrow [token] [amount] -t, --token, -a, --amount, --chainId
getUserFundsEscrow [token] -t, --token, --chainId
withdrawFromEscrow [token] [amount] -t, --token, -a, --amount, --chainId
authorizeEscrow [token] [payee] [maxLockedAmount] [maxLockSeconds] [maxLockCounts] -t, --token, -p, --payee, -m, --maxLockedAmount, -s, --maxLockSeconds, -c, --maxLockCounts, -e, --expiry, --chainId
getAuthorizationsEscrow [token] [payee] -t, --token, -p, --payee, --chainId
getEscrowInfo escrowInfo [token] -t, --token, --chainId
getNodeSubsidyProviders subsidyProviders --chainId
getNodeSubsidyStatus subsidyStatus [token] -t, --token, --chainId, --node, --jobType, --amount, --subsidy
getSubsidyStatus getSubsidyProviderStatus <subsidyProviderAddress> <tokenAddress> [chainId] --chainId, --node, --jobType, --amount
addSubsidyProvider addSubsidy [chainId] [address] [description...] -c, --chainId, -a, --address, -d, --description
listSubsidyProviders listSubsidy [chainId] -c, --chainId
removeSubsidyProvider removeSubsidy [chainId] [ref] -c, --chainId, -r, --ref
toggleSubsidyProvider toggleSubsidy [chainId] [ref] [state] -c, --chainId, -r, --ref, -s, --state
createAccessList [name] [symbol] [initialUsers] [transferable] -n, --name, -s, --symbol, -u, --initial-users, -t, --transferable, --chainId
addToAccessList [address] [users] -a, --address, -u, --users, --chainId
checkAccessList [address] [users] -a, --address, -u, --users, --chainId
removeFromAccessList [address] [users] -a, --address, -u, --users, --chainId
createBucket [accessListAddress]
addFileToBucket <bucketId> <filePath> [fileName]
listBuckets -o, --owner
listFilesInBucket <bucketId>
getFileObject <bucketId> <fileName>
downloadBucketFile (alias downloadFromBucket) <bucketId> <fileName> [destPath] [offset]
deleteFile <bucketId> <fileName>
getNodeStatus nodeStatus -d, --detailed
setMaintenance maintenance [state] -e, --enabled
downloadNodeLogs [output] [last] [from] [to] [maxLogs] -o, --output, -l, --last, -f, --from, -t, --to, -m, --maxLogs, --module, --level, --page, --all
getNodeLog [logId] -i, --id
getNodeConfig fetchConfig [file] -f, --file
setNodeConfig pushConfig [file] -f, --file, -s, --set, --allowKeys, --accept
reindexTx [chainId] [txId] -c, --chainId, -t, --tx
reindexChain [chainId] [block] -c, --chainId, -b, --block, --accept
indexer [action] [chainId] -a, --action, -c, --chainId, --accept
adminStopJob [jobId] -j, --job, --accept
collectFees [chainId] [token] [destination] [amount] -c, --chainId, -t, --token, --to, -a, --amount, --accept
stopNode --accept

Sample metadata files

The metadata/ folder holds ready-to-publish DDOs. They default to chain 8996 (Barge); edit chainId and serviceEndpoint to match your network before publishing. metadata/jobs/ holds example --from-json files for startCompute, startFreeCompute and startService.

File DDO What it is
simpleDownloadDataset.json v4.1.0 Dataset with an access service (URL file); the basic publish + download example
simpleDownloadDatasetV5.json v5.0.0 Same, as a v5 DDO (credentialSubject / SSI flows; see SSI_WALLET_*)
downloadAssetPaymentUSDC.json v4.1.0 Download dataset priced in USDC instead of the default token
simpleComputeDataset.json v4.1.0 Dataset with a compute service (URL file)
simpleIPFSComputeDataset.json v4.1.0 Compute dataset whose file is stored on IPFS
jsAlgo.json v4.1.0 Node.js algorithm (URL file) for compute
jsAlgoV5.json v5.0.0 Node.js algorithm as a v5 DDO
jsIPFSAlgo.json v4.1.0 Node.js algorithm stored on IPFS
pythonAlgo.json v4.1.0 Python algorithm (oceanprotocol/algo_dockers image)

Troubleshooting

  • No Ocean Node set: NODE_URL is unset. Export it, or run setNode <url> in the interactive prompt.
  • Node unreachable: setNode keeps your current node when the health check fails. Check the URL/peer id and port; for a local P2P node use the full multiaddr. Over P2P a bare peer id can take up to 30 s (DHT lookup); HTTP times out at 10 s.
  • Fails at startup with a DISABLE_P2P message: DISABLE_P2P=true and a P2P NODE_URL contradict each other. Unset one.
  • Wrong chain / chainId errors: the chain must be a registered RPC. Run listChains, then addChain <chainId> <rpcUrl>. getNode shows which chains the node serves. Pass --chainId on chain-explicit commands, or set a default with setChain. For DDO-implied commands the chain is the DDO's chainId, so fix it in your metadata file.
  • Escrow shortfall / service ends in Error: deposit and authorize before starting (depositEscrow, then authorizeEscrow with maxLockSeconds >= duration + 3600). getUserFundsEscrow and getAuthorizationsEscrow show the current state.
  • Asset not indexed yet: the CLI waits up to INDEXING_MAX_RETRIES x INDEXING_RETRY_INTERVAL (default 120 x 4 s). Raise them for slow chains.
  • Script hangs after the command: set AVOID_LOOP_RUN=true for one-shot runs.
  • mintOcean asks for --token: the chain has no bundled Ocean token address.
  • A saved setting seems ignored: an environment variable with the same meaning is set and takes precedence for this run. Run getConfig — it shows the source (env / file / default) of every value, and flags a file value that the env overrides.
  • Upgrading from RPC_CONFIG_FILE / rpc.json: RPC_CONFIG_FILE is no longer supported (a one-line warning prints if it is still set). Chains in the default ~/.ocean/cli/rpc.json are imported automatically into config.json on first run (the old file is left in place, no longer used). A file at a custom RPC_CONFIG_FILE path is not imported — re-add its chains with addChain, or convert it to the new { "version": 1, "rpc": { ... } } shape and point OCEANCLI_CONFIG_PATH at it.

Development

git clone https://github.com/oceanprotocol/ocean-cli.git
cd ocean-cli
nvm use            # .nvmrc pins Node 22.23.1 (needed for lint and release tooling)
npm install
npm run cli h      # runs from TypeScript source via tsx, no build step; same as `ocean-cli h`
npm run build

npm run cli <command> is equivalent to ocean-cli <command>. Tests (npm test) are mostly end-to-end and need a running Barge stack (RPC, Ocean Node, deployed contracts). Architecture notes and contributor guidance are in CLAUDE.md. Release history: CHANGELOG.md.

License

Copyright (C) 2026 Ocean Protocol Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

10 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages