### 01-core-architecture/01-components.txt *GenVM* Components Overview *************************** Introduction ============ *GenVM* is a WebAssembly-based virtual machine that enables "Intelligent Contracts" - smart contracts capable of performing non- deterministic operations (AI inference, web scraping, real-world data access) while maintaining blockchain consensus. This document provides an architectural overview of *GenVM*'s major components and how they work together. High-Level Architecture ======================= [graph] *GenVM* Executor ================ The *GenVM* Executor is the heart of the system, providing a modified WebAssembly runtime with blockchain-specific capabilities. Executor itself is a supervisor of *sub-VM*s. **Key Responsibilities:** * Contract execution in deterministic and non-deterministic modes * RAM management (memory) * State management and storage operations * Communication with *Module*s and the *host* **Major Subcomponents:** * **VM Core**: Dual-mode WebAssembly execution engine * **WASI Implementation**: Standard and GenLayer-specific system interfaces * **:term:`Host` Functions**: Bridge between contracts and the *host* environment * **Caching System**: Module compilation and execution optimization *Sub-VM* -------- *GenVM*'s unique dual execution model is implemented by using multiple wasm *sub-VM*s. **Deterministic Mode:** - Executes blockchain consensus logic - Provides reproducible results across all validators - Handles storage operations, message passing, and standard computation **Non-Deterministic Mode:** - Executes AI inference, web scraping, and external data access - Results are validated through consensus mechanisms - Isolated from deterministic state to prevent contamination WASI Interfaces --------------- *GenVM* exposes two WebAssembly System Interfaces: **WASI Preview 1 (``wasip1``)** - Standard WASI interface with deterministic modifications - File system operations, environment access, time functions - Modified to ensure reproducible behavior across validators **:term:`GenLayer WASI SDK` (``genlayer_sdk``)** - Blockchain-specific operations and primitives - Storage access, message passing, contract deployment - Non-deterministic operation triggers and validation Runners (libraries) ------------------- Language runtimes provide the execution environment for different programming languages: **Python Runtime** - Custom CPython build compiled to WebAssembly with software floating point implementation for deterministic mode * GenLayer Python SDK for blockchain primitives * Curated standard library for deterministic execution * Support for some necessary libraries (NumPy, PIL) GenVM requires some built-in runners to be accessible by contracts. They are identified by hashes of their "tar" contents *Host* Interface ---------------- The *Host* Interface manages communication between *GenVM* and the blockchain node. Host is responsible for providing blockchain state to *GenVM* and updating it. *Module*s ========= *Module*s provide non-deterministic capabilities through isolated services: **LLM :term:`Module`** - Large Language Model inference capabilities - Supports multiple AI providers and models - Configurable prompts and response processing - Support for *greyboxing* **Web :term:`Module`** - Web scraping and HTTP request capabilities - Webpage rendering and content extraction - Domain filtering and security controls They are separated from executor for following reasons: * replace-ability * privileges containment *Manager* ========= The *Manager* oversees *Module*s and is responsible for correct *gvm- executor* version selection ### 01-core-architecture/02-host-interface.txt *Host* Interface Protocol ************************* Overview ======== The *Host* Interface defines the communication protocol between GenVM and the blockchain node. GenVM launches with "--host" (socket address) and "--message" (JSON data) parameters and communicates via a binary protocol over TCP or Unix domain sockets. Process Management ================== GenVM Execution --------------- **Launch Parameters**: * "--host": TCP address or "unix://" prefixed Unix domain socket * "--message": Message data as JSON following message schema **Process Control**: * **Graceful Shutdown**: Send "SIGTERM" signal * **Force Termination**: Send "SIGKILL" if not responding * **Crash Detection**: Process exit before sending result indicates crash (should be reported as bug) **Node Responsibilities**: Node decides how to receive code and messages from users. GenVM only knows about calldata and message data. Communication Protocol ====================== Pseudocode is available in Host Loop Pseudocode Binary Protocol Design ---------------------- Data Types and Results ====================== VM Result Codes --------------- **Result Types**: * "Return": Successful execution * "VMError": VM-produced error that usually can't be handled * "UserError": User-produced error Result Encoding --------------- **Non-deterministic Blocks and Sandbox Encoding**: * 1 byte of result code * Result data: calldata for "Return", string for "VMError" or "UserError" **Parent VM Result Encoding**: * 1 byte of result code * Data format: * "Return": calldata * "VMError" / "UserError": "{ "message": "string", "fingerprint": ... }" **Host Responsibility**: Calculating storage updates, hashes, and state management (similar to Ethereum's dirty storage override pattern). Method ID Reference =================== Method IDs are available as JSON in the build system for code generation. Error Handling ============== * **Protocol Errors**: Most methods return error codes, with "json/errors/ok" indicating success * **Communication Failures**: Socket communication errors indicate protocol violations * **Process Termination**: Unexpected process exit indicates GenVM crash and should be reported ### 01-core-architecture/03-modules.txt *Module*s ********* Overview ======== *Module*s provide GenVM with non-deterministic capabilities that extend beyond traditional blockchain operations. These modules enable intelligent contracts to interact with AI services, access web content, and process real-world data while maintaining consensus through specialized validation mechanisms. Module Architecture =================== Design Principles ----------------- * **Isolation**: *Module*s run in separate processes to prevent contamination of deterministic execution * **Extensibility**: Lua scripting support * **Security**: Controlled access Communication Protocol ---------------------- * **WebSocket Interface**: * Asynchronous communication between GenVM and modules * Message serialization using Calldata Encoding * Request-response pattern with timeout handling * Connection lifecycle management and reconnection * **Message Structure**: * Standardized request/response envelope * Type-safe parameter encoding * Error handling and status reporting Module Lifecycle ---------------- * **Initialization**: * Module process startup * Configuration loading and validation * Initial health check * Binding listening address * **Operation**: * Accepting GenVM connections * Request processing and external service interaction * Result validation and transformation * Resource monitoring and usage tracking * Error handling and recovery procedures * **Termination**: * Graceful shutdown and resource cleanup Large Language Model (LLM) Module ================================= Capabilities ------------ * **AI Inference**: * Text generation * Image recognition * **Multi-Provider Support**: * Integration with various AI service providers * Load balancing across multiple endpoints * Failover mechanisms for service availability * Cost optimization through provider selection * **:term:`Greyboxing` Support**: * Exposing temperature * Using different providers * Providing built-in functions for text and image manipulation Configuration ------------- * **Model Parameters**: * Model selection and version specification * Temperature and sampling parameter control * Maximum token limits and constraints * Custom prompt templates and formatting * **Provider Settings**: * API endpoint configuration and authentication * Timeout and retry policy specification * Cost tracking and budget controls * **Security Controls**: * Content filtering and safety measures * Input validation and sanitization * Output monitoring and compliance checking * Privacy protection and data handling Web *Module* ============ Web Scraping Capabilities ------------------------- * HTML parsing and data extraction * JavaScript execution and dynamic content handling via webdriver HTTP Request Handling --------------------- * **Protocol Support**: * HTTP/HTTPS request execution * Custom header specification and management * Authentication mechanism support via RFC9421 * Proxy and routing configuration * **Error Handling**: * Network timeout and retry mechanisms * HTTP error code interpretation * Connection failure recovery Security and Compliance ----------------------- * Whitelist top-level domain filtering * Whitelist port filtering * URL pattern matching and validation * Execution time limits and timeouts ### 01-core-architecture/04-manager.txt Manager ******* The GenVM *Manager* is a HTTP server that provides an API for managing GenVM instances, modules, and related operations. HTTP API Endpoints ================== Status and Health ----------------- GET /status Get the current status of the manager and its modules. Response JSON Object: * **llm_module** (*object*) -- Status of the LLM module * **web_module** (*object*) -- Status of the web module **Example response**: { "llm_module": "running", "web_module": "stopped" } Module Management ----------------- POST /module/start Start a module with the specified configuration. Request JSON Object: * **module_type** (*string*) -- Type of module to start (e.g., "llm", "web") * **config** (*object*) -- Module-specific configuration Response JSON Object: * **result** (*string*) -- Result status ("module_started") **Example request**: { "module_type": "llm", "config": { "host": "localhost", "port": 8080 } } POST /module/stop Stop a running module. Request JSON Object: * **module_type** (*string*) -- Type of module to stop Response JSON Object: * **result** (*string*) -- Result status ("module_stopped" or "module_not_running") **Example request**: { "module_type": "llm" } GenVM Execution --------------- POST /genvm/run Start a new GenVM instance for contract execution. Request JSON Object: * **major** (*int*) -- Major version specification * **message** (*object*) -- Contract execution message * **is_sync** (*bool*) -- Whether execution is synchronous * **capture_output** (*bool*) -- Whether to capture execution output * **max_execution_minutes** (*int*) -- Maximum execution time in minutes * **host_data** (*string*) -- Host-specific data as JSON string * **timestamp** (*string*) -- Execution timestamp in RFC3339 format * **host** (*string*) -- Host identifier * **extra_args** (*array*) -- Additional arguments for execution Response JSON Object: * **result** (*string*) -- Result status ("started") * **id** (*int*) -- Unique identifier for the GenVM instance **Example response**: { "result": "started", "id": 12345 } POST /genvm/run/readonly Execute a contract in read-only mode (not yet implemented). Request Headers: * *Deployment-Timestamp* -- Contract deployment timestamp in RFC3339 format ", ""], ["", ""] ] } Configuration Management ------------------------ POST /log/level Set the logging level for the manager. Request JSON Object: * **level** (*string*) -- Log level ("trace", "debug", "info", "warn", "error") Response JSON Object: * **result** (*string*) -- Result status ("log_level_set") * **level** (*string*) -- The new log level **Example request**: { "level": "debug" } POST /manifest/reload Reload the executor version manifest. Response JSON Object: * **result** (*string*) -- Result status ("manifest_reloaded") POST /env Set an environment variable in the manager process. Request JSON Object: * **key** (*string*) -- Environment variable name * **value** (*string*) -- Environment variable value Response JSON Object: * **result** (*string*) -- Result status ("env_var_set") * **key** (*string*) -- The environment variable name **Example request**: { "key": "DEBUG_MODE", "value": "true" } Resource Management ------------------- GET /permits Get the current number of execution permits available. Response JSON Object: * **permits** (*int*) -- Number of available permits POST /permits Set the number of execution permits. Request JSON Object: * **permits** (*int*) -- New number of permits to allocate Response JSON Object: * **result** (*string*) -- Result status ("permits_set") * **permits** (*int*) -- The new number of permits **Example request**: { "permits": 10 } LLM Testing ----------- POST /llm/check Test availability and functionality of LLM provider configurations. Request JSON Object: * **configs** (*array*) -- Array of LLM provider configurations * **test_prompts** (*array*) -- Array of test prompts to execute Response JSON Object: * **results** (*array*) -- Array of availability test results **Example request**: { "configs": [ { "host": "https://api.openai.com", "provider": "openai-compatible", "model": "gpt-4o", "key": "${ENV[OPENAIKEY]}", } ], "test_prompts": [ { "system_message": null, "user_message": "Respond with exactly two letters 'OK' and nothing else", "temperature": 0.2, "images": [], "max_tokens": 200, "use_max_completion_tokens": true } ] } **Example response**: [ { "config_index": 0, "prompt_index": 0, "available": true, "error": null, "response": "Hello! How can I help you today?" } ] Error Responses =============== All endpoints may return error responses in the following format: { "error": "Description of the error" } HTTP status codes used: * "200 OK": Successful operation * "404 Not Found": Endpoint not found * "500 Internal Server Error": Server error or request processing failure ### 01-core-architecture/index.txt Core Architecture ***************** Overview of GenVM's core architectural components and design patterns. * *GenVM* Components Overview * Introduction * High-Level Architecture * *GenVM* Executor * *Module*s * *Manager* * *Host* Interface Protocol * Overview * Process Management * Communication Protocol * Data Types and Results * Method ID Reference * Error Handling * *Module*s * Overview * Module Architecture * Large Language Model (LLM) Module * Web *Module* * Manager * HTTP API Endpoints * Error Responses ### 02-vm/01-wasm-runtime.txt Modified *Wasmtime* Runtime *************************** GenVM is based on Wasmtime, the reference WebAssembly runtime, with specific modifications for blockchain use: * **Deterministic Execution**: Modified for reproducible results across validators * **Resource Limits**: Integrated memory constraints * **Error fingerprinting**: Capturing VM state on errors * **Floating Point Handling**: Floating point operations ban in deterministic mode ### 02-vm/index.txt VM and Supervisor Architecture ****************************** * Modified *Wasmtime* Runtime ### appendix/host-loop.txt Host Loop Pseudocode ******************** **Constants**: ACCOUNT_ADDR_SIZE = 20 SLOT_ID_SIZE = 32 **Data Encoding Functions**: write_byte_slice(arr): write_u32_le len(arr) write_bytes arr read_slice(): len := read_u32_le data := read_bytes(len) return data Protocol Loop ============= The *host* processes requests in a loop until "consume_result": loop: method_id := read_byte match method_id json/methods/get_calldata: calldata, err := host_get_calldata() if err != json/errors/ok: write_byte err else: write_byte json/errors/ok write_byte_slice calldata json/methods/storage_read: read_type := read_byte as json/storage_type address := read_bytes(ACCOUNT_ADDR_SIZE) slot := read_bytes(SLOT_ID_SIZE) index := read_u32_le len := read_u32_le data, err := host_storage_read(read_type, address, slot, index, len) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok write_bytes data # must be exactly len in size json/methods/storage_write: slot := read_bytes(SLOT_ID_SIZE) index := read_u32_le len := read_u32_le data := read_bytes(len) err := host_storage_write(slot, index, data) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok json/methods/consume_result: host_result := read_slice() # this is needed to ensure that genvm doesn't close socket before all data is read write_byte 0x00 break json/methods/get_leader_nondet_result: call_no := read_u32_le data, err := host_get_leader_nondet_result(call_no) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok write_byte_slice data json/methods/post_nondet_result: call_no := read_u32_le result := read_slice() err := host_post_nondet_result(call_no, result) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok json/methods/post_message: address := read_bytes(ACCOUNT_ADDR_SIZE) calldata := read_slice() message_data := read_slice() # JSON string err := host_post_message(address, calldata, message_data) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok json/methods/consume_fuel: gas := read_u64_le host_consume_fuel(gas) # note: this method doesn't send any response json/methods/deploy_contract: calldata := read_slice() code := read_slice() message_data := read_slice() # JSON string err := host_deploy_contract(calldata, code, message_data) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok json/methods/eth_call: address := read_bytes(ACCOUNT_ADDR_SIZE) calldata := read_slice() result, err := host_eth_call(address, calldata) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok write_byte_slice result json/methods/eth_send: address := read_bytes(ACCOUNT_ADDR_SIZE) calldata := read_slice() message_data := read_slice() # JSON string err := host_eth_send(address, calldata, message_data) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok json/methods/post_event: read_byte topics_len topics := [] for i in range(topics_len): topic := read_bytes(32) # 32 bytes each topics.append(topic) blob := read_slice err := host_post_event(topics, blob) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok json/methods/get_balance: address := read_bytes(ACCOUNT_ADDR_SIZE) balance, err := host_get_balance(address) if err != json/errors/ok: write_byte err else: write_byte json/errors/ok write_bytes balance.to_le_bytes(32) # 256-bit integer json/methods/remaining_fuel_as_gen: fuel, err := host_remaining_fuel_as_gen() if err != json/errors/ok: write_byte err else: write_byte json/errors/ok write_bytes fuel.to_le_bytes(8) # 64-bit integer, must be safe integer (fits in double) json/methods/notify_nondet_disagreement: call_no := read_u32_le host_notify_nondet_disagreement(call_no) ### appendix/index.txt Appendix ******** * Host Loop Pseudocode * Protocol Loop * Message Argument JSON Schema * Runners Versions ### appendix/message-schema.txt Message Argument JSON Schema **************************** { "$id": "https://raw.githubusercontent.com/yeagerai/genvm/refs/heads/main/doc/schemas/message.json", "$schema": "http://json-schema.org/draft-07/schema#", "title": "GenVM message", "$ref": "#/definitions/body", "definitions": { "body": { "type": "object", "properties": { "$schema": { "type": "string" }, "contract_address": { "type": "string", "description": "20-byte account address", "contentEncoding": "base64", "minLength": 28, "maxLength": 28 }, "sender_address": { "type": "string", "description": "20-byte account address", "contentEncoding": "base64", "minLength": 28, "maxLength": 28 }, "origin_address": { "type": "string", "description": "20-byte account address", "contentEncoding": "base64", "minLength": 28, "maxLength": 28 }, "chain_id": { "type": "string", "description": "chain id number, must be a parsable u256" }, "value": { "oneOf": [{ "type": "null" }, { "type": "integer", "minimum": 0 }], "description": "amount of GEN attached to message (u64)" }, "is_init": { "type": "boolean", "description": "whenever contract is being instantiated" }, "datetime": { "type": "string", "format": "date-time", "description": "RFC3339 timestamp, defaults to 2024-11-26T06:42:42.424242Z if not provided" } }, "required": ["contract_address", "sender_address", "origin_address", "chain_id", "is_init"] } } } ### appendix/runners-versions.txt Runners Versions **************** { "v0.1.0": { "cpython": [ "1s66bd44b80habdw2ayf4hyncvpkmmjwva0h6nkk738flsd5nis0" ], "models-all-MiniLM-L6-v2": [ "1sfhqijjsnsf6ik1zvdv4vxjidrjhsbnk1vgs1c5ksgv193flyqb" ], "py-genlayer": [ "15qfivjvy80800rh998pcxmd2m8va1wq2qzqhz850n8ggcr4i9q0" ], "py-genlayer-multi": [ "0cwifyzi3956f9yxdpq5kk3ihazv2llsxfj626zbadrg4cizwhq5" ], "py-lib-cloudpickle": [ "1pqxan7lxsjrvs66b4a7k81w7rrgbsqi3hxhp7b4bn4gks1b64rb" ], "py-lib-genlayer-embeddings": [ "09h0i209wrzh4xzq86f79c60x0ifs7xcjwl53ysrnw06i54ddxyi" ], "py-lib-genlayer-std": [ "0asq35p8mzlzwgxcrx5v51srnsqyj72cq7993way1vqddwxcvkq4" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0m4yvkrbqnyygs4g3mmp11kprylks23q9m0pxnkpm1fg4kpck3qq" ], "softfloat": [ "17b5yad9r9jzcflawqi12r5llhgklfr6lp75r915r99l4wg8ni4n" ] }, "v0.1.3": { "cpython": [ "1s66bd44b80habdw2ayf4hyncvpkmmjwva0h6nkk738flsd5nis0" ], "models-all-MiniLM-L6-v2": [ "1sfhqijjsnsf6ik1zvdv4vxjidrjhsbnk1vgs1c5ksgv193flyqb" ], "py-genlayer": [ "1j12s63yfjpva9ik2xgnffgrs6v44y1f52jvj9w7xvdn7qckd379" ], "py-genlayer-multi": [ "0xn02qjjqlpxadhs124cwrr5ddqs7dxcc6m5a7c6801hv54l66p0" ], "py-lib-cloudpickle": [ "1pqxan7lxsjrvs66b4a7k81w7rrgbsqi3hxhp7b4bn4gks1b64rb" ], "py-lib-genlayer-embeddings": [ "09h0i209wrzh4xzq86f79c60x0ifs7xcjwl53ysrnw06i54ddxyi" ], "py-lib-genlayer-std": [ "1mds1jiy7phn7b7irqviwbl8lp026dsxfkzv88gj0lkmvcqk5aak" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0m4yvkrbqnyygs4g3mmp11kprylks23q9m0pxnkpm1fg4kpck3qq" ], "softfloat": [ "17b5yad9r9jzcflawqi12r5llhgklfr6lp75r915r99l4wg8ni4n" ] }, "v0.1.8-runner-hash___": { "cpython": [ "1s66bd44b80habdw2ayf4hyncvpkmmjwva0h6nkk738flsd5nis0" ], "models-all-MiniLM-L6-v2": [ "1sfhqijjsnsf6ik1zvdv4vxjidrjhsbnk1vgs1c5ksgv193flyqb" ], "py-genlayer": [ "132536jbnxkd1axfxg5rpfr5b60cr11adm2y4r90hgn0l59qsp9w" ], "py-genlayer-multi": [ "0iddpsb7hsrqv10xf4sjdiknba0m3fkm2x9xldy7ci3gj1fpkpjy" ], "py-lib-cloudpickle": [ "1pqxan7lxsjrvs66b4a7k81w7rrgbsqi3hxhp7b4bn4gks1b64rb" ], "py-lib-genlayer-embeddings": [ "09h0i209wrzh4xzq86f79c60x0ifs7xcjwl53ysrnw06i54ddxyi" ], "py-lib-genlayer-std": [ "0mmsw09shx3613jzkhbmqyqw60h6b27hy7bjdbb1msfp40g2idi6" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0m4yvkrbqnyygs4g3mmp11kprylks23q9m0pxnkpm1fg4kpck3qq" ], "softfloat": [ "17b5yad9r9jzcflawqi12r5llhgklfr6lp75r915r99l4wg8ni4n" ] }, "v0.2.1": { "cpython": [ "1bk9g3zgym0rrpd9lk584cxfaa4rg0cz36w6xhzkqdj1m2p4xa9n" ], "models-all-MiniLM-L6-v2": [ "0d1skbkxl1ij1sfm0jvnh18ih5a9mxfiny0myqnyf0wa5jc50mis" ], "py-genlayer": [ "1jb45aa8ynh2a9c9xn3b7qqh8sm5q93hwfp7jqmwsfhh8jpz09h6" ], "py-genlayer-multi": [ "06zyvrlivjga0d5jlpdbprksc0pa6jmllxvp8s20hq1l512vh5yk" ], "py-lib-cloudpickle": [ "1dlk6mnfabi0z7r39635amyfzw8xb6rm8bv4pmgv6ji1bfx9hghd" ], "py-lib-genlayer-embeddings": [ "0bmbm3cyfwxsyh454z53vxqjf47wz2q7smcqp1q4g4a6k2kidnyk" ], "py-lib-genlayer-std": [ "11rhn002yfajawsz7fai6mykznbxkxs6l91iskj5cm82c92qhy3v" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0vjc9x1qqv7bgkf9aldqsi708892vzh2w7mwzhq6w1174qan4bas" ], "softfloat": [ "08g85lmbfjngvvjyx1gr1pyk61nqba0y42gba8wrb1qd3zkv2gmd" ] }, "v0.2.4": { "cpython": [ "1bk9g3zgym0rrpd9lk584cxfaa4rg0cz36w6xhzkqdj1m2p4xa9n" ], "models-all-MiniLM-L6-v2": [ "0d1skbkxl1ij1sfm0jvnh18ih5a9mxfiny0myqnyf0wa5jc50mis" ], "py-genlayer": [ "1jb45aa8ynh2a9c9xn3b7qqh8sm5q93hwfp7jqmwsfhh8jpz09h6" ], "py-genlayer-multi": [ "06zyvrlivjga0d5jlpdbprksc0pa6jmllxvp8s20hq1l512vh5yk" ], "py-lib-cloudpickle": [ "1dlk6mnfabi0z7r39635amyfzw8xb6rm8bv4pmgv6ji1bfx9hghd" ], "py-lib-genlayer-embeddings": [ "0bmbm3cyfwxsyh454z53vxqjf47wz2q7smcqp1q4g4a6k2kidnyk" ], "py-lib-genlayer-std": [ "11rhn002yfajawsz7fai6mykznbxkxs6l91iskj5cm82c92qhy3v" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0vjc9x1qqv7bgkf9aldqsi708892vzh2w7mwzhq6w1174qan4bas" ], "softfloat": [ "08g85lmbfjngvvjyx1gr1pyk61nqba0y42gba8wrb1qd3zkv2gmd" ] }, "v0.2.5": { "cpython": [ "1bk9g3zgym0rrpd9lk584cxfaa4rg0cz36w6xhzkqdj1m2p4xa9n" ], "models-all-MiniLM-L6-v2": [ "0d1skbkxl1ij1sfm0jvnh18ih5a9mxfiny0myqnyf0wa5jc50mis" ], "py-genlayer": [ "1jb45aa8ynh2a9c9xn3b7qqh8sm5q93hwfp7jqmwsfhh8jpz09h6" ], "py-genlayer-multi": [ "06zyvrlivjga0d5jlpdbprksc0pa6jmllxvp8s20hq1l512vh5yk" ], "py-lib-cloudpickle": [ "1dlk6mnfabi0z7r39635amyfzw8xb6rm8bv4pmgv6ji1bfx9hghd" ], "py-lib-genlayer-embeddings": [ "0bmbm3cyfwxsyh454z53vxqjf47wz2q7smcqp1q4g4a6k2kidnyk" ], "py-lib-genlayer-std": [ "11rhn002yfajawsz7fai6mykznbxkxs6l91iskj5cm82c92qhy3v" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0vjc9x1qqv7bgkf9aldqsi708892vzh2w7mwzhq6w1174qan4bas" ], "softfloat": [ "08g85lmbfjngvvjyx1gr1pyk61nqba0y42gba8wrb1qd3zkv2gmd" ] }, "vTEST": { "cpython": [ "1bk9g3zgym0rrpd9lk584cxfaa4rg0cz36w6xhzkqdj1m2p4xa9n" ], "models-all-MiniLM-L6-v2": [ "0d1skbkxl1ij1sfm0jvnh18ih5a9mxfiny0myqnyf0wa5jc50mis" ], "py-genlayer": [ "1jb45aa8ynh2a9c9xn3b7qqh8sm5q93hwfp7jqmwsfhh8jpz09h6" ], "py-genlayer-multi": [ "06zyvrlivjga0d5jlpdbprksc0pa6jmllxvp8s20hq1l512vh5yk" ], "py-lib-cloudpickle": [ "1dlk6mnfabi0z7r39635amyfzw8xb6rm8bv4pmgv6ji1bfx9hghd" ], "py-lib-genlayer-embeddings": [ "0bmbm3cyfwxsyh454z53vxqjf47wz2q7smcqp1q4g4a6k2kidnyk" ], "py-lib-genlayer-std": [ "11rhn002yfajawsz7fai6mykznbxkxs6l91iskj5cm82c92qhy3v" ], "py-lib-protobuf": [ "0riri6vk1ma3cnmlwls3d4771y0cf3c44afsl6gwfmnl2cpcbdl1" ], "py-lib-word_piece_tokenizer": [ "0vjc9x1qqv7bgkf9aldqsi708892vzh2w7mwzhq6w1174qan4bas" ], "softfloat": [ "08g85lmbfjngvvjyx1gr1pyk61nqba0y42gba8wrb1qd3zkv2gmd" ] } } ### glossary.txt Glossary ******** Greyboxing A set of techniques to prevent forcing LLMs to do unintended by contract creator actions. Host The blockchain node that runs GenVM and communicates with it. Module External service providing non-deterministic capabilities. Manager The GenVM component responsible for managing modules and GenVM versions. ### index.txt GenVM Implementation Specification ********************************** Note: Single text file docs for AI This is a specification of this implementation of GenVM. The specification has been split into multiple sections for better organization and maintainability. Contents: ^^^^^^^^^ * Glossary * Core Architecture * *GenVM* Components Overview * Introduction * High-Level Architecture * *GenVM* Executor * *Module*s * *Manager* * *Host* Interface Protocol * Overview * Process Management * Communication Protocol * Data Types and Results * Method ID Reference * Error Handling * *Module*s * Overview * Module Architecture * Large Language Model (LLM) Module * Web *Module* * Manager * HTTP API Endpoints * Error Responses * VM and Supervisor Architecture * Modified *Wasmtime* Runtime * Appendix * Host Loop Pseudocode * Protocol Loop * Message Argument JSON Schema * Runners Versions