Specifications (Specs)
🔍 Overview
Specifications (specs) are the foundational blueprints for Lava's multichain support. Presented in JSON format, they detail the bare minimum requirements for an API to run on Lava. Through these specs, Lava determines which chains and methods are supported and enabled, as well as establishes the costs, requirements, and verifications for them.
Whenever the ecosystem demands a new API, a new spec is integrated. This dynamic approach incorporates modularity and extensibility directly into the protocol and ensures Lava remains current and adaptable.
📖 Key Concepts
Index 📑
An index
is the name of the spec. Any time a spec is referenced it will be through its index
.
Example
Imports ⬇️
imports
are references to borrowed functions from other sources. APIs/Chains of the same or similar architecture can import methods from an existing spec using its index
and implementing any new logic. imports
improve efficiency by eliminating the need to repeatedly integrate identical APIs.
Example
API Collection 🛠️
A specification always contains an api_collection
. The api_collection
contains the list of available methods or APIs that are activated and their respective api_interfaces
(e.g. "rest"
,"grpc"
,"jsonrpc"
,"tendermintrpc"
, etc.). In other words, it outlines all the APIs or methods that must be active and operational to support a specific chain/API. Each method listed here must be served by providers and answerable to consumers.
Example
Compute Units (CU) 🔢
Every API call has a computational overhead. To quantify this, Lava employs "compute_units"
or CUs. They act as a metric, assigning a nominal "cost" to each API call. This ensures transparent resource allocation and utilization, allowing consumers to gauge the intensity of their calls, and providers, in turn, to be rewarded based upon the intensity of compute.
Example
Add-Ons ➕
Add-Ons ("add-on"
) introduce optional new methods and APIs which are beyond the basic requirements for a chain/API. They are akin to plugins or modules that specific consumers may time-to-time request and providers may choose to serve for additional rewards. This allows for supplementary functionalities to be outlined inside a spec, giving both providers and consumers flexibility in customizing their experiences.
Example
Extensions 〰️
"extensions"
allow for the adjustment or enhancement of existing methods and APIs within a spec for special use cases. They provide the means to tweak, optimize, or expand current functions based on the needs of a subset of consumers who require more functionality from specified method calls. This allows for alternative functionalities to be outlined inside a spec, giving both providers and consumers flexibility to serve / request special functions.
Example
💡 Examples
Blockchains ⛓️
- [Lava](https://github.com/lavanet/lava/blob/main/cookbook lava.json)
- [Ethereum](https://github.com/lavanet/lava/blob/main/cookbook ethereum.json)
- [Axelar](https://github.com/lavanet/lava/blob/main/cookbook axelar.json)
- [Evmos](https://github.com/lavanet/lava/blob/main/cookbook evmos.json)
Rich APIs 🌟
- [IBC](https://github.com/lavanet/lava/blob/main/cookbook ibc.json)
- [CosmWasm](https://github.com/lavanet/lava/blob/main/cookbook cosmoswasmjson)
- Web3 P2P DNS Resolution (Outdated)