i n e r t i a
- the natural tendency of objects in motion to stay in motion
- an object’s resistance to changes in its motion
- an object with more inertia will also have a greater potential to maintain its momentum
a novel WASM-based smart contract framework, purpose-built for the Network of Momentum.
URL: GitHub - EovE7Kj/inertia: smart contracts for momentum
Team: EovE7Kj and Co.
- ACTIVELY SEEKING ADDITIONAL DEVELOPERS.
Funding
PHASE 1/?
Total Requested Funding for phase 1 : 5000 ZNN and 50000 QSR
So far, we’ve made progress integrating key components for blockchain interaction, WASM contract handling, and a gas metering mechanism. Here’s a summary of what we’ve done:
1. WASM Runtime Integration
- We’ve built the foundational logic for loading and executing WebAssembly (WASM) contracts. This is done using the
wasmer-go
library, which allows us to load WASM modules and execute functions from these modules. - A
WASMRuntime
struct was implemented to manage the WASM engine, store, and module. - We added methods to load and execute contracts (
LoadContract
andExecuteContract
), which interface with the WASM runtime.
2. Gas Metering
- To prevent infinite execution and ensure fair resource usage, we’ve added a simple gas metering mechanism through the
QasMeter
struct. This tracks gas usage and ensures that a contract cannot exceed a predefined limit. - The
ConsumeQas
method withinQasMeter
is responsible for checking if the contract execution exceeds the gas limit and throws an error if it does.
3. Contract Execution with Gas Consumption
- We’ve modified the contract execution flow to track the gas consumption associated with each contract execution. Each function call in the contract deducts gas from the
QasMeter
. - In the
ExecuteContract
method, we first check if the contract has enough gas to proceed. If not, an error is thrown, and the operation is aborted.
4. API Exposure and Contract Invocation
- The
ExposeAPI
method was introduced to allow interaction between the blockchain environment and the contract. This method registers functions that the WASM module can call, such aswrite_state
, which interacts with the blockchain’s state. - We’ve created a function to handle the full contract invocation cycle, from loading the contract to executing the functions and interacting with the blockchain API (
HandleContractInvocation
).
5. Testing
- A
test/
directory was established with a trivialcontract.wasm
file and a Go test file (test.go
). This will allow us to test the WASM contract handling and gas metering mechanisms in a controlled environment.
Roadmap
- WASM Runtime Interface: Integrate a WASM runtime library into
go-zenon
to handle smart contract execution. The runtime should include sandboxing for security and gas metering for performance. - Develop a Contract API: Expose network functionalities (e.g., state storage, transactions) to WASM contracts via APIs, enabling them to interact with the NoM.
- Update Node Logic: Extend transaction processing logic to validate and execute WASM contracts, ensuring consensus mechanisms are updated accordingly.
- Tooling for Developers: Provide SDKs or compilers that support compiling smart contracts from languages like Rust or AssemblyScript into WASM, along with debugging and deployment tools.
- Governance and Upgrades: Ensure proper governance around smart contract execution, potentially requiring changes to the consensus rules or protocol.