> For the complete documentation index, see [llms.txt](https://docs.oncompute.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oncompute.ai/on-mcp/walkthrough-from-connect-to-paid-compute.md).

# Walkthrough: From Connect to Paid Compute

## Walkthrough: From Connect to Paid Compute

This walkthrough follows a single real session. We analyse Shakespeare's texts for **"rare words"**  words that appear unusually often compared to standard English and run that algorithm three ways: free against a public URL, free against a private file in node storage, and paid against the complete works on a high-end node.

Each step shows the **prompt** you type, the **tools** the agent invokes, and the **result**.

{% hint style="info" %}
Before starting, connect the server to your AI client. This session uses Claude with the hosted endpoint.
{% endhint %}

### 1. Connect and discover

> I just connected the ON MCP. What can you do with it? Can you create a diagram for me? Walk me through the main flows.

The agent searches the available tools and reads the live protocol, no guessing. It explains that the MCP connects to Ocean Network, a decentralized compute-to-data stack with \~80 tools, renders a C2D flow diagram, and lays out the three flows: **demand** (run a job), **supply** (publish), and **node operation**.

It also notes the security model up front: on-chain tools hand back **unsigned transactions,** your keys stay with you.

### 2. Write and validate a C2D algorithm

> I want to find "rare words" that characterize a body of text, words that appear unusually often compared to standard English. Write me a compute to data algo for ON that does this against text files. Keep it stdlib-only Python.

The agent:

1. Loads the **authoring guide** resource to match the exact filesystem contract, inputs under `/data/inputs/`, outputs to the results path, and expected exit codes.
2. Writes the algorithm: it walks `/data/inputs/`, scoring each word by how much it's overused versus a baseline English frequency table.
3. Runs a **local smoke test** on a Moby-Dick snippet before touching the network, `whale` and `leviathan` surface, while `the` is correctly demoted.
4. Runs `validate_algo_structure` → clean, **zero errors**.

{% hint style="success" %}
The algorithm is validated against the C2D contract *before* any compute runs, so the first real job isn't where you discover a structural mistake.
{% endhint %}

### 3. Survey free compute on the network

> Before we run anything, what free compute envs are available on the network right now? List them for me.

The agent resolves the default node's multiaddr and queries it. It reports **four environments**, but only one accepts free jobs: 1 CPU / 10 GB RAM / 10 GB disk, open access, up to 10 concurrent free jobs. The other three are paid or gated.

> Hmmm ok, list more for me please

Now it scans the wider network with `find_provider` over the DHT and finds **eight peers** advertising free-tier C2D capacity. One P2P call drops; it retries and polls three responding nodes:

* **Node A** — Ocean default, open free environment (Tesla T4 on its paid tier).
* **Node B** —  open but lower reliability.
* **Node C** — an **8× H200** node, but its free tier is **allowlist-gated** to a handful of addresses.

It concludes Node A is the best free target and is explicit that this is a **snapshot of 3 of 8 peers**, with some P2P calls dropping. No overclaiming.

### 4. Run free against a URL

> Now run the algo on Shakespeare's sonnets. URL: `https://www.gutenberg.org/cache/epub/1041/pg1041.txt`. Use the free env that you found first.

Tool by tool:

| Tool                | What it does                                                                  |
| ------------------- | ----------------------------------------------------------------------------- |
| `create_auth_token` | Mints a throwaway JWT, **no wallet, no funds**.                               |
| `freeComputeStart`  | Dataset = the Gutenberg URL; algorithm runs inline against the `py-lite` env. |
| `computeStatus`     | `pulling → running → exit 0` in \~10 seconds.                                 |
| `getComputeResult`  | Pulls `outputs.tar` + logs, unpacked locally.                                 |

**Result:** 20,187 tokens, 3,602 distinct words.

```
thy 267 (2204×) · thou 235 · thee 162 · beauty 70 · heart 58 · sweet 57 · ...
```

Archaic grammar (`thy`, `thou`, `thee`) plus the Sonnets' themes (`beauty`, `heart`, `sweet`) — fingerprinted in \~10 seconds with no dataset to publish and no NFT to mint.

{% hint style="info" %}
The agent also flags its own noise: Gutenberg license boilerplate leaked into the text, and the small baseline table mislabels a few words. Real limitations, stated plainly.
{% endhint %}

### 5. Run against a private file (persistent storage)

A private local file can go into **node-local persistent storage** so the job mounts it directly, the data never gets a public URL.

> Now let's add another file to the node's persistent storage.

(Here the file is `more_text.txt`, a short lighthouse-keeper passage.)

| Tool                             | What it does                                         |
| -------------------------------- | ---------------------------------------------------- |
| `node_status`                    | Confirms persistent storage is enabled, access open. |
| `createPersistentStorageBucket`  | Creates a bucket owned by your consumer key.         |
| `upload_persistent_storage_file` | Uploads `more_text.txt` (2016 bytes).                |
| `listPersistentStorageFiles`     | Confirms the file is in the bucket.                  |

The bucket is node-local and owned by your key, **no public URL; the file lives on the node.** Then:

> yes *(run the algorithm against the stored file)*

`freeComputeStart` reuses the same JWT (the bucket is scoped to that consumer) and exits 0 in \~11 seconds. The log confirms it read the file directly from:

```
/data/persistentStorage/<bucketId>/more_text.txt
```

**Result:** `keeper` and `lamp` surface immediately from a file that never left the node.

{% hint style="info" %}
The agent is upfront that the text is tiny (329 tokens), so the signal is thin and explains exactly why and how to fix it.
{% endhint %}

### 6. Run paid compute you hold the keys

Paid jobs settle through **on-chain escrow**. The agent prices the job and prepares it, but **refuses to touch your funds or keys,** you authorize and deposit yourself, then hand back a token.

> Now let's run the same algo on the complete works of Shakespeare using paid compute. URL: `https://www.gutenberg.org/files/100/100-0.txt`. Use the paid env on the `…kjuzr` node and let's pay with COMPY.

**Pricing first, no transaction moved:**

* The agent resolves the paid node and runs `initializeCompute` to get real pricing.
* It reports the cost: **0.15 COMPY** for the job (COMPY on Base), an escrow lock requirement (\~24.5h), and the payee + escrow contract addresses.
* It states clearly that it **cannot fund wallets, sign, or broadcast** that's your part, done on the Ocean Network Dashboard.

You authorize and deposit on the dashboard, then return with an auth token:

> I managed to get the authorization token, deposited the money and authorized. Let's start the job. Here is my auth token, it expires in 2 hours: `[token]`

| Tool               | What it does                                                                                              |
| ------------------ | --------------------------------------------------------------------------------------------------------- |
| `computeStart`     | `isFree: false` the escrow lock transaction confirms funds locked, and the job fires on the 8× H200 node. |
| `computeStatus`    | `running → exit 0` in \~14 seconds.                                                                       |
| `getComputeResult` | Full-canon results unpacked.                                                                              |

**Result:** 5,359,444 chars · 928,853 tokens · 24,439 distinct words.

```
thou · thy · shall · thee · hath · doth · enter · exeunt · scene · falstaff · caesar · brutus · ...
```

The cleanest signal of all three runs and notice `enter`, `exeunt`, `scene`. The algorithm fingerprinted not just the author but the **medium**: this is drama.

### Recap

* **One URL** to install.
* The agent **reads the live protocol** and writes & validates real C2D algorithms.
* It **surveys the network** for free compute and is honest about what's gated.
* It runs **free** against a URL and against a **private file that never leaves the node**.
* **Paid** jobs settle through escrow the agent never touches your keys.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.oncompute.ai/on-mcp/walkthrough-from-connect-to-paid-compute.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
