Skip to content

GenLayer

Starter template for a GenLayer Python smart contract (football bets) with tests, linting, and a Next.js frontgenlayerlabs/genlayer-project-boilerplate

Stars
19.3k
Forks
936
Licence
MIT
Language
TypeScript
Last update
2 months ago
Type
Framework

What it is

This is a sample project for GenLayer, a platform for smart contracts written in Python that can fetch web data and call an LLM. It includes an example football bets contract, tests that run with and without GenLayer Studio, a linter for contracts, and a Next.js frontend. It is meant as a starting point to copy and adapt.

  • Run the football bets contract's direct tests in memory with mocked web and LLM calls
  • Lint a contract with genvm-lint before deploying it
  • Deploy the example contract to a GenLayer network using the CLI
  • Run the Next.js frontend against a deployed contract address

Great for

  • Developers who want to learn how GenLayer intelligent contracts are structured
  • Developers building a GenLayer app who want a working test and frontend setup
  • Anyone who wants fast local feedback loops using the in-memory direct tests
  • Teams setting up CI with linting and direct tests for contracts

Not ideal for

  • People who do not want to write Python or TypeScript, since the contract and tooling require both
  • Anyone needing a production football betting product, since the README describes this only as boilerplate for a use case
  • People without access to GenLayer Studio who need full consensus testing, since integration tests require a running Studio
Step-by-step guide: how to use GenLayerInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Python 3.12 or newer · GenLayer CLI (npm install -g genlayer) · Node.js for the frontend and the CLI

    Create and activate a Python environment

    python3 -m venv .venv && source .venv/bin/activate

    Install Python dependencies

    pip install -r requirements.txt

    Install the GenLayer CLI globally

    npm install -g genlayer

    Install frontend dependencies

    cd frontend && npm install
  2. 2

    Run it

    • Lint the contract with genvm-lint check contracts/football_bets.py
    • Run direct tests with pytest tests/direct/ -v
    • Deploy with genlayer deploy after choosing a network with genlayer network
    • Copy frontend/.env.example to frontend/.env, set NEXT_PUBLIC_CONTRACT_ADDRESS, then run npm run dev
  3. 3

    Get the most out of it

    • Lint after every contract change, as the README recommends
    • Use direct tests with mock_web and mock_llm to test resolution logic without a network
    • Run integration tests against GenLayer Studio before deployment to check consensus behavior
    • Use the included GitHub Actions workflow to run linting and direct tests on each change

Downloads

Strengths

  • Includes both fast in-memory tests and full integration tests in one template
  • Ships with a CI workflow for linting and direct tests
  • Clear project layout and step-by-step quick start in the README

Trade-offs

  • The README is short and some steps (like deployment) rely on external docs and the GenLayer CLI
  • Integration tests need GenLayer Studio, either local or hosted, and are slow per the README
  • The README mentions requirements.txt and deployment scripts whose details are not fully shown

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.