$ show linera-io/linera-protocol
Linera is a decentralized blockchain infrastructure implementing a microchain architecture with WebAssembly (Wasm) and EVM smart contract execution. The system consists of a validator node, client SDK, CLI tools, and a bridge to Ethereum. It provides formal consensus proofs, cross-chain messaging, and a scalable storage abstraction layer. Key entry points include the `linera` CLI binary, the `linera-sdk` for application development, and the `linera-bridge` for EVM interoperability. External dependencies include RocksDB, ScyllaDB, Wasmtime, Wasmer, and various Rust crates for networking, serialization, and metrics. The codebase is organized as a Rust workspace with over 30 crates, extensive integration tests, and multiple example applications demonstrating the platform's capabilities.
The LLM identified 5 files worth highlighting for reuse:
Provides a generic key-value store abstraction with composable views (MapView, RegisterView, LogView, etc.) and multiple backends (Memory, RocksDB, ScyllaDB, IndexedDB). Used by all Linera applications for persistent state management. The trait-based design allows easy swapping of storage backends and is isolated enough to be extracted for other projects needing a similar abstraction.
Implements WIT (WebAssembly Interface Types) generation and runtime support for Wasmer and Wasmtime. Provides derive macros for WitType, WitLoad, WitStore, and a WIT interface writer. This framework is self-contained and can be reused in any Rust project that needs to generate WIT bindings for Wasm modules.
Implements a hash-consing cache for content-addressed data (blocks, blobs, certificates) that allows move-in/move-out without cloning. The cache is thread-safe and uses a simple API. This pattern is reusable for any system that needs deduplication of immutable objects by hash.
Provides macros `bcs_scalar!` and `doc_scalar!` for defining GraphQL scalars that serialize via BCS (Binary Canonical Serialization) and display as hex strings. These macros are small, self-contained, and can be reused in any Rust project using async-graphql that needs custom scalar types with BCS encoding.
Defines a `Persist` trait for loading and saving data to files or memory, with implementations for common types. This is a minimal, reusable persistence abstraction that can be extracted for any project needing simple file-based or in-memory persistence.