How blessnetwork/bls-runtime works
Core Runtime Components
• "blockless" crate: This is the primary library that provides the underlying execution, context management, error handling, and module linking.
• "bls-runtime" crate: Implements the command-line interface and configuration loading. It parses the configuration file (manifest) and initiates the runtime, using environment variables and standard input as further inputs.
Driver Infrastructure and Extendibility
• "crates/blockless-drivers" directory: Contains sub-modules for various drivers. These drivers (e.g., cdylib, HTTP, CGI, IPFS, LLM, memory, S3, TCP, and WASI variants) abstract external interactions. They enable the runtime to communicate with external systems and provide extended functionalities.
• The “witx” files serve as interface definitions that detail how the external calls are structured and enforced between the runtime and driver modules.
Auxiliary Libraries and WASI Components
• "crates/blockless-env", "crates/blockless-multiaddr", and "crates/wasi-common": Offer system level utilities, networking/multiaddress parsing and proper integration with WASI (WebAssembly System Interface). These are critical for ensuring efficient resource access, safe environment interaction, and portability.
Configuration & Logging
• The runtime is highly configurable – driven by an external JSON configuration file example described in the README. This configuration sets paths, fuel limits, memory limits, logging, permissions, and module details to control the environment in which the Wasm code executes.
• Logging is centralized and configured (via the "runtime_logger" parameter) to monitor fuel consumption and runtime errors (such as "Permission Deny" or "wasm unreachable" errors).
Supported Languages
• Core Runtime Engine: Represent the "blockless" library as the heart of the system. Show its interaction with module management, code generation, and runtime execution.
• CLI/Configuration Loader: Represent the "bls-runtime" which handles command-line interactions, configuration parsing, and acts as the system entry point.
• Driver Modules: Enumerate the individual driver components (HTTP, CGI, IPFS, LLM, Memory, S3, TCP, WASI) located under “crates/blockless-drivers”. Group them or list them separately according to their functions.
• Supported Language Modules: Create a distinct section or label indicating modules compiled from Rust, Go, and AssemblyScript – showing that the runtime receives “Wasm modules” as input irrespective of their language origin.
• That the core runtime instantiates and links the Wasm modules (provided by users and compiled from the supported languages) to the various driver modules.
• A feedback loop or logging channel connecting the runtime engine to the logging component (configured by runtime_logger) which records events like fuel consumption, errors, or permission violations.
• External communication flows (e.g., network calls via HTTP or file system access) abstracted by the respective drivers.
C. Architectural Patterns and Design Principles:
• Modular Design: The entire system is designed as a collection of self-contained crates/modules (runtime core, drivers, supporting environment modules).
• Configurable & Extensible: The use of external JSON configuration files and clearly defined interface files (witx) support extensibility and customization.
• Isolation & Safety: Note the constraints like fuel and memory limits and permission lists which implement safety and sandboxing principles.
• Multi-language Support Integration: Clearly denote that the system is designed to interoperate with modules from Rust, Go, and AssemblyScript.
• You include every major driver and sub-component from the "blockless-drivers" crate.
• You incorporate all critical pieces including WASI support libraries and the multiaddress parsing component, so that no supported feature is left out.