What is GenLayer
Trust Infrastructure for the AI Age
GenLayer is a blockchain where validator nodes powered by diverse AI models reach consensus on subjective decisions — a synthetic jurisdiction on-chain.
Intelligent Contracts interpret language, process unstructured data, and pull live web inputs. No oracles, no intermediaries.
- Bitcoin — Trustless Money
- Ethereum — Trustless Computation
- GenLayer — Trustless Decision-Making
What Intelligent Contracts Can Do
Subjective Decisions
Evaluate context and nuance. Turn judgment calls into enforceable on-chain outcomes — content moderation, claim assessment, quality evaluation.
Internet Access
Fetch live web data directly on-chain. Contracts can read websites, call APIs, and verify real-world information without oracles or intermediaries.
Natural Language Processing
Interpret human-readable inputs via LLMs. Contracts can analyze text, extract meaning, and make decisions based on qualitative criteria.
Image & Visual Processing
Pass images to LLMs for analysis — screenshot a webpage and verify its content, check visual evidence for claims, analyze receipts or documents. Contracts can capture screenshots via gl.nondet.web.render() and send them to LLMs via gl.nondet.exec_prompt(images=[...]).
Unstructured Data
Process text, images, audio transcripts, and qualitative evidence. Handle real-world complexity that traditional smart contracts cannot.
How It Compares
| Feature | Traditional Smart Contracts | Intelligent Contracts |
|---|---|---|
| Language | Solidity, Rust | Python |
| Data sources | On-chain only (or oracles) | On-chain + live web data |
| Decision logic | Deterministic only | Deterministic + subjective |
| AI integration | Not possible | Native LLM access (text + images) |
| Consensus | All nodes must agree on exact output | Validators assess equivalence of results |
Architecture: Two Layers
GenLayer operates as two integrated layers:
GenLayer Chain — an EVM-compatible L2 (zkSync Elastic Chain). Holds account balances via ghost contracts, handles standard Ethereum operations (eth_* methods), and anchors to Ethereum's security model.
GenVM — the execution environment for Intelligent Contracts. A WebAssembly-based VM (built on Wasmtime (opens in a new tab)) that runs a Python interpreter with native access to LLMs, web data, and non-deterministic operations. Can also execute compiled native code.
Every Intelligent Contract has a corresponding ghost contract on the chain layer at the same address. Ghost contracts hold the contract's GEN balance, relay transactions to consensus, and execute external messages. See Messages for details.
Transactions enter via addTransaction on the chain layer. GenVM executes the contract logic. Results settle back on-chain.
Develop in Python
Intelligent Contracts are Python classes extending gl.Contract:
# { "Depends": "py-genlayer:1jb45aa8ynh2a9c9xn3b7qqh8sm5q93hwfp7jqmwsfhh8jpz09h6" }
from genlayer import *
import json
class WizardOfCoin(gl.Contract):
has_coin: bool
def __init__(self):
self.has_coin = True
@gl.public.write
def ask_for_coin(self, request: str) -> None:
if not self.has_coin:
raise gl.vm.UserError("I don't have a coin!")
prompt = f"""
You are a wizard guarding a gold coin.
An adventurer says: {request}
Should you give them the coin?
Respond as JSON: {{"give_coin": true/false}}
"""
def leader_fn():
return gl.nondet.exec_prompt(prompt, response_format="json")
def validator_fn(leaders_res) -> bool:
if not isinstance(leaders_res, gl.vm.Return):
return False
my_result = leader_fn()
return my_result["give_coin"] == leaders_res.calldata["give_coin"]
result = gl.vm.run_nondet_unsafe(leader_fn, validator_fn)
if result["give_coin"]:
self.has_coin = False
@gl.public.view
def get_has_coin(self) -> bool:
return self.has_coinFull SDK available: genlayer-js (TypeScript), genlayer-py (Python), CLI.