搜索

PythonReactSEOPDF
OpenClaw

Genlayer Dev

GenLayer Intelligent Contracts

acastellana0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install acastellana/genlayer-dev

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

GenLayer Intelligent Contracts

GenLayer enables Intelligent Contracts - Python smart contracts that can call LLMs, fetch web data, and handle non-deterministic operations while maintaining blockchain consensus.

Quick Start

Minimal Contract
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *

class MyContract(gl.Contract):
    value: str
    
    def __init__(self, initial: str):
        self.value = initial
    
    @gl.public.view
    def get_value(self) -> str:
        return self.value
    
    @gl.public.write
    def set_value(self, new_value: str) -> None:
        self.value = new_value
Contract with LLM
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *
import json

class AIContract(gl.Contract):
    result: str
    
    def __init__(self):
        self.result = ""
    
    @gl.public.write
    def analyze(self, text: str) -> None:
        prompt = f"Analyze this text and respond with JSON: {text}"
        
        def get_analysis():
            return gl.nondet.exec_prompt(prompt)
        
        # All validators must get the same result
        self.result = gl.eq_principle.strict_eq(get_analysis)
    
    @gl.public.view
    def get_result(self) -> str:
        return self.result
Contract with Web Access
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *

class WebContract(gl.Contract):
    content: str
    
    def __init__(self):
        self.content = ""
    
    @gl.public.write
    def fetch(self, url: str) -> None:
        url_copy = url  # Capture for closure
        
        def get_page():
            return gl.nondet.web.render(url_copy, mode="text")
        
        self.content = gl.eq_principle.strict_eq(get_page)
    
    @gl.public.view
    def get_content(self) -> str:
        return self.content

Core Concepts

Contract Structure
  1. Version header: # v0.1.0 (required)
  2. Dependencies: `# { "Depends"...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/acastellana/genlayer-dev
Version
—
Commit
680ef4ede5c3b3f86b3f587e023faf80705fff2c
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

README

genlayer-dev-claw-skill

A Claw skill for building GenLayer Intelligent Contracts—Python smart contracts with LLM calls and web access.

Purpose

This skill helps AI assistants write and deploy Intelligent Contracts:

  • SDK API reference
  • Code examples and patterns
  • CLI commands
  • Deployment workflows
  • Equivalence principles

For explaining GenLayer concepts, use the companion skill: genlayer-claw-skill

What's Inside

File Description
SKILL.md Quick start, core concepts, common patterns
references/sdk-api.md Complete SDK API reference
references/equivalence-principles.md Consensus patterns in depth
references/examples.md Annotated contract examples
references/deployment.md CLI commands, networks, deployment
references/genvm-internals.md VM architecture, storage, ABI

Quick Example

# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *

class MyContract(gl.Contract):
    result: str
    
    def __init__(self):
        self.result = ""
    
    @gl.public.write
    def analyze(self, text: str) -> None:
        prompt = f"Analyze: {text}"
        
        def get_analysis():
            return gl.nondet.exec_prompt(prompt)
        
        self.result = gl.eq_principle.strict_eq(get_analysis)
    
    @gl.public.view
    def get_result(self) -> str:
        return self.result

Key Topics Covered

  • Contract structure — gl.Contract, decorators, state types
  • Storage types — DynArray, TreeMap, sized integers (u256, etc.)
  • Non-deterministic ops — gl.nondet.exec_prompt(), gl.nondet.web.render()
  • Equivalence principles — strict_eq, prompt_comparative, prompt_non_comparative, custom patterns
  • Contract interactions — Cross-contract calls, EVM interop
  • CLI — genlayer deploy, genlayer call, genlayer write
  • Networks — localnet, studionet, test...

来源内容

SKILL.md
# GenLayer Intelligent Contracts

GenLayer enables **Intelligent Contracts** - Python smart contracts that can call LLMs, fetch web data, and handle non-deterministic operations while maintaining blockchain consensus.

## Quick Start

### Minimal Contract
```python
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *

class MyContract(gl.Contract):
    value: str
    
    def __init__(self, initial: str):
        self.value = initial
    
    @gl.public.view
    def get_value(self) -> str:
        return self.value
    
    @gl.public.write
    def set_value(self, new_value: str) -> None:
        self.value = new_value
```

### Contract with LLM
```python
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *
import json

class AIContract(gl.Contract):
    result: str
    
    def __init__(self):
        self.result = ""
    
    @gl.public.write
    def analyze(self, text: str) -> None:
        prompt = f"Analyze this text and respond with JSON: {text}"
        
        def get_analysis():
            return gl.nondet.exec_prompt(prompt)
        
        # All validators must get the same result
        self.result = gl.eq_principle.strict_eq(get_analysis)
    
    @gl.public.view
    def get_result(self) -> str:
        return self.result
```

### Contract with Web Access
```python
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *

class WebContract(gl.Contract):
    content: str
    
    def __init__(self):
        self.content = ""
    
    @gl.public.write
    def fetch(self, url: str) -> None:
        url_copy = url  # Capture for closure
        
        def get_page():
            return gl.nondet.web.render(url_copy, mode="text")
        
        self.content = gl.eq_principle.strict_eq(get_page)
    
    @gl.public.view
    def get_content(self) -> str:
        return self.content
```

## Core Concepts

### Contract Structure
1. **Version header**: `# v0.1.0` (required)
2. **Dependencies**: `# { "Depends"...
README
# genlayer-dev-claw-skill

A Claw skill for building GenLayer Intelligent Contracts—Python smart contracts with LLM calls and web access.

## Purpose

This skill helps AI assistants write and deploy Intelligent Contracts:
- SDK API reference
- Code examples and patterns
- CLI commands
- Deployment workflows
- Equivalence principles

**For explaining GenLayer concepts**, use the companion skill: [genlayer-claw-skill](https://github.com/acastellana/genlayer-claw-skill)

## What's Inside

| File | Description |
|------|-------------|
| `SKILL.md` | Quick start, core concepts, common patterns |
| `references/sdk-api.md` | Complete SDK API reference |
| `references/equivalence-principles.md` | Consensus patterns in depth |
| `references/examples.md` | Annotated contract examples |
| `references/deployment.md` | CLI commands, networks, deployment |
| `references/genvm-internals.md` | VM architecture, storage, ABI |

## Quick Example

```python
# v0.1.0
# { "Depends": "py-genlayer:latest" }
from genlayer import *

class MyContract(gl.Contract):
    result: str
    
    def __init__(self):
        self.result = ""
    
    @gl.public.write
    def analyze(self, text: str) -> None:
        prompt = f"Analyze: {text}"
        
        def get_analysis():
            return gl.nondet.exec_prompt(prompt)
        
        self.result = gl.eq_principle.strict_eq(get_analysis)
    
    @gl.public.view
    def get_result(self) -> str:
        return self.result
```

## Key Topics Covered

- **Contract structure** — `gl.Contract`, decorators, state types
- **Storage types** — `DynArray`, `TreeMap`, sized integers (`u256`, etc.)
- **Non-deterministic ops** — `gl.nondet.exec_prompt()`, `gl.nondet.web.render()`
- **Equivalence principles** — `strict_eq`, `prompt_comparative`, `prompt_non_comparative`, custom patterns
- **Contract interactions** — Cross-contract calls, EVM interop
- **CLI** — `genlayer deploy`, `genlayer call`, `genlayer write`
- **Networks** — localnet, studionet, test...

相关技能

OpenClaw

bambu-studio-ai

heyixuan2

Bambu Lab 3D printer control and automation. Activate when user mentions: printer status, 3D printing, slice, analyze model, generate 3D, AMS filament, print monitor, Bambu Lab, or any 3D printing task. Full pi...

OpenClaw

humanpages

human-pages-ai

Search and hire real humans for tasks — photography, delivery, research, and more

OpenClaw

geo-optimization

capt-marbles

Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discove...

OpenClaw

openclaw-skills

zseven-w

Reusable skill templates for OpenClaw AI agents. Templates for API integration, data processing, web scraping, CLI tools, and file processing.