πŸš€ Genlayer Builders Guide β€” Beginner Training Module


:rocket: Genlayer Builders Guide β€” Beginner Training Module

:puzzle_piece: Overview

In this training, you’ll learn how to:

  • Set up the Genlayer development environment

  • Initialize a local blockchain

  • Create and deploy your first intelligent contract

We will be deploying on Studionet, so make sure your setup matches the requirements below.


:hammer_and_wrench: Prerequisites

Before starting, ensure you have the following installed:

  • Docker (for running blockchain services)

  • WSL (recommended for Windows users)

  • VS Code (code editor)

  • Rabby Wallet Extension (for interacting with blockchain)

  • Node.js (v18+) and npm

  • Python (v3.10+)

:backhand_index_pointing_right: Tip: Verify installations:

node -v
npm -v
python --version
docker --version


:file_folder: Step 1 β€” Project Setup

1. Install Genlayer CLI

npm install -g genlayer

This installs the Genlayer command-line tool globally.


2. Create Your Project Folder

mkdir yourProjectName
cd yourProjectName


3. Create Contracts Directory

mkdir contracts

This folder will store your smart (intelligent) contracts.


:gear: Step 2 β€” Initialize the Blockchain

1. Initialize Genlayer

genlayer init

During setup:

You will be asked to:

  • Select an LLM provider β†’ Choose Heurist AI

  • Enter API key


:key: Get Heurist API Key

  1. Visit: https://dev-api-form.heurist.ai

  2. Use referral code:

genlayer

  1. Copy your API key and paste it into the CLI

:fire_extinguisher: Troubleshooting Docker Issues

If initialization fails:

Option 1 β€” Pull PostgreSQL manually

docker pull postgres:17-alpine

Option 2 β€” Pull required images manually

Use Docker Desktop UI or:

docker pull <missing-image-name>


2. Start the Blockchain

genlayer up

:white_check_mark: This starts:

  • Local blockchain

  • Database

  • AI execution environment


:brain: Step 3 β€” Create Your First Intelligent Contract

Now you’re ready to build your contract.

:blue_book: Official Documentation

Follow the official guide:
:backhand_index_pointing_right: https://docs.genlayer.com/developers/intelligent-contracts/first-contract


:brick: Basic Contract Structure (Example)

Here’s a simplified conceptual example:

from genlayer import Contract

class HelloWorld(Contract):
    def __init__(self):
        self.message = "Hello, Genlayer!"

    def get_message(self):
        return self.message


:rocket: Deploy Your Contract

Typical deployment flow:

genlayer deploy contracts/HelloWorld.py

Then interact with it using:

genlayer call <contract-address> get_message


:magnifying_glass_tilted_left: Key Concepts You Should Understand

1. Intelligent Contracts

Unlike traditional smart contracts, Genlayer contracts:

  • Can use AI (LLMs)

  • Can process natural language

  • Can make context-aware decisions


2. Local Blockchain

  • Runs in Docker

  • Simulates real deployment

  • Safe for testing


3. Studionet Deployment

Once tested locally:

  • Deploy to Studionet

  • Connect wallet (Rabby)

  • Interact via frontend or CLI


:test_tube: Best Practices

  • :white_check_mark: Always test locally before deploying

  • :white_check_mark: Keep API keys secure

  • :white_check_mark: Use version control (Git)

  • :white_check_mark: Write modular contracts

  • :white_check_mark: Log errors during development


:compass: Next Steps

After completing this training:

  1. Build a more complex contract

  2. Integrate a frontend (React / Next.js)

  3. Connect Rabby Wallet

  4. Deploy to Studionet

  5. Experiment with AI-powered logic