> For the complete documentation index, see [llms.txt](https://docs.cherty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cherty.io/reusable-computation/data-structures.md).

# Data Structures

## Script Object

A JSON object with the keys below. This is divided into two parts: the **script content** which is meant to be cryptographically verifiable, and **script metadata** such as version and provenance information. While the metadata may affect the interpretation of the script content, it does not affect its execution.

* **script\_content** : object with keys:&#x20;
  * **name**: human-readable name (str)
  * **script\_id**: identifier starting 'sc\_' (str)
  * **inputs**: array of [port\_objects](#port-object)
  * **outputs**: array of [port\_objects](#port-object)
  * **functions**: array of [function\_objects](#function-object)
  * **connections**: array of [connection\_objects](#connection-object)
  * **git\_info**: object with keys
    * **commit\_hash** (str)
    * **diffs**: array of strings
    * **remote\_url** (str)
    * **repo\_name** (str)
    * **branch\_name** (str)
    * **commit\_message** (str)
    * **commit\_author** (str)
    * **commit\_date**: timestamp (int)
  * **script\_path**: path to the script file from the repository root (str)
  * **entry\_point**: command to run script (str)
  * **execution\_method**: default method where this script is expected to be run chosen from the [Execution Method Table](#execution-method) (str)
  * **execution\_params**: object with keys defined in the [Execution Method Table](#execution-method) based on execution\_method&#x20;
  * **environment**: execution environment chosen from the [Environment Table](#environment) understood to be a default environment for running the script (examples: 'anaconda', 'docker'; str)
  * **environment\_params**: object with keys defined in the [Environment Table](#environment) based on environment value
  * **resource\_type**: 'script'
  * **protocol\_name**: 'poplar.network' or 'Pop(plæ)r.network'
  * **protocol\_version**: '1.0.1'
  * **description**: human-readable long description (str)
  * **preview\_image**: object with keys
    * **img\_cid**: content identifier of a preview image
    * **mime\_type**: type of this image (str)
  * **author**: array of objects with keys
    * **name**: str
    * **id\_cid**: [CID of an id\_object](/authentication.md#identity-representation)
  * **timestamp**: timestamp (int)
* **script\_content\_string:** stringified version of the script\_content object
* **cid:** of the script\_content\_string
* **version**: [version\_object](/reusable-computation/versioning.md) of the script
* **provenance:** array of [Liquicert provenance objects](https://docs.liquicert.io/) with attestations matching the cid above
* **local\_path:** in the context of a given machine, the local path to the script file. Should not be published, in general.
* **increment**: default version increment, 'major' / 'minor' / 'patch'

## Port Object

An object with keys:

* **id**: randomly generated id for this port object; must be a string that is unique within the namespace of input and output ports for this script
* **name**: human readable string
* **type**: [type\_object](#type-object)

## Function Object

Extensible object for defining a function, which may or may not be a wrapper for a script. Has keys:

* **id**: str starting with a '#'
* **name**: str&#x20;
* **inputs**: array of [port\_objects](#port-object)&#x20;
* **outputs**: array of [port\_objects](#port-object)&#x20;
* **definition**: Object with keys
  * **method**: str chosen from [Function Table](#function-table)&#x20;
  * **content**: definition of the function based on method value

The id labels of all input and output ports for a single function form a name space, and must be chosen to avoid collisions.

### Function Table

Ways of defining transformations in Pop(plæ)r

| Definition Method | Definition Content                                                     |
| ----------------- | ---------------------------------------------------------------------- |
| `'script'`        | CID of a script\_content object,  [script\_object.cid](#script-object) |

## Connection Object

A connection object connects two ports in the context of a script. The ports may be script input ports, script output ports, or the ports of functions contained in the script. The connection object has keys:

* **from:** id of a port
* **to:** id of a port
* **data:** CID of a data\_object

The id of a port will be prefaced with the function id if it is a port of a function. For example, "#prt\_globalInput" might be the name of an input port in this script, while "#myfn\_id.#prt\_functionIn" might be the id of a input port.

## Execution Method

A representation of an execution method used for this function. Used to signal to the user whether this function is expected to be run locally, in a compute cluster, in a browser, on a blockchain, or in another context. The schema for execution\_params depends on the value chosen.

| Execution Method Value | Description                                                          | Execution Parameters |
| ---------------------- | -------------------------------------------------------------------- | -------------------- |
| `'child_process'`      | Expected to be run on a desktop or laptop computer in the Cherty app | {}                   |

An execution method should be interpreted as a recommendation to the user, which may be necessary to follow if your computation needs to be reproduced efficiently or exactly. It should be possible in principle to run any given script using other methods, but it might crash your browser or use an unsupported VM.

## Environment

Definition of the recommended computing environment for a script.&#x20;

<table><thead><tr><th width="221">Environment Value</th><th>Description</th><th></th></tr></thead><tbody><tr><td><pre class="language-python"><code class="lang-python">conda_explicit
</code></pre></td><td>Runs in an anaconda environment defined by explicit list of conda dependencies</td><td>Environment output with "--explicit" flag</td></tr></tbody></table>

## Type Object

Extensible object for defining data types. Has keys:

* **type:** str
* **method:** str

Example #1:  {method: ‘mime\_type’, type: ‘application/json’} for MIME types

Example #2: {method: ‘poplar\_type’, type: ‘float’} for primitive types


---

# 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.cherty.io/reusable-computation/data-structures.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.
