⚙️Data Structures

Pop(plæ)r.network version 1.0.1

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:

    • name: human-readable name (str)

    • script_id: identifier starting 'sc_' (str)

    • inputs: array of port_objects

    • outputs: array of port_objects

    • functions: array of function_objects

    • connections: array of connection_objects

    • 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 (str)

    • execution_params: object with keys defined in the Execution Method Table based on execution_method

    • environment: execution environment chosen from the Environment Table understood to be a default environment for running the script (examples: 'anaconda', 'docker'; str)

    • environment_params: object with keys defined in the Environment Table 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

    • timestamp: timestamp (int)

  • script_content_string: stringified version of the script_content object

  • cid: of the script_content_string

  • version: version_object of the script

  • provenance: array of Liquicert provenance objects 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

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

  • inputs: array of port_objects

  • outputs: array of port_objects

  • definition: Object with keys

    • method: str chosen from Function Table

    • 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

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.

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.

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

Last updated