getting-started
Onboarding Checklist

Developer Onboarding Checklist

Welcome to GenLayer! This checklist will guide you through setting up your development environment and deploying your first Intelligent Contract.

💡 Tip: Work through this checklist in order. Each section builds on the previous one.


🛠️ Setup Environment (15-20 minutes)

Prerequisites

Install GenLayer CLI

  • Install the CLI globally:
  npm install -g genlayer
  • Verify installation:
  genlayer --version

Start GenLayer Studio

  • Start the local development environment:
  genlayer up

📚 Learn the Basics (30 minutes)

Core Concepts

Key Features

  • Understand: Natural language processing in contracts
  • Understand: Web access from contracts
  • Understand: LLM integration for decision-making
  • Understand: Non-deterministic operations

🚀 Deploy Your First Contract (30 minutes)

Clone the Boilerplate

  • Clone the project template:
  git clone https://github.com/genlayerlabs/genlayer-project-boilerplate
  cd genlayer-project-boilerplate
  • Install dependencies:
  npm install

Configure Network

  • Set your network to local development:
  genlayer network

Deploy Example Contract

  • Deploy the football prediction contract:
  genlayer deploy
  • Note the contract address from the output
    • It should look like: 0x03FB09251eC05ee9Ca36c98644070B89111D4b3F

Interact with Your Contract

  • Open Studio in your browser: http://localhost:3000 (opens in a new tab)

  • Find your deployed contract in the contracts list

  • Try calling a read method:

    • Select a view() method
    • Click "Call Function"
    • Observe the result
  • Try calling a write method:

    • Select a method that modifies state
    • Fill in the parameters
    • Click "Execute"
    • Wait for consensus

🧪 Test Your Contract (20 minutes)

Run Built-in Tests

  • Run the test suite:
  npm test

or

  gltest
  • All tests should pass ✅

Write Your Own Test

  • Create a new test file: tests/my-first-test.ts

  • Add a simple test:

  import { expect } from 'chai';
  
  describe('My First Test', () => {
    it('should deploy contract', async () => {
      // Your test code here
      expect(true).to.be.true;
    });
  });
  • Run your test: npm test

💡 Build Your Own Contract (1-2 hours)

Plan Your Contract

  • Decide: What problem will your contract solve?

    • Examples: voting system, prediction market, content curation
  • List: What functions will you need?

    • Read functions (view data)
    • Write functions (modify state)
  • Identify: Will you need:

    • Web access?
    • LLM integration?
    • Contract-to-contract calls?

Create Your Contract

  • Create a new file: contracts/my-contract.py

  • Start with this template:

  from genlayer import *
  
  class MyContract(gl.Contract):
      # State variables
      owner: Address
      
      def __init__(self):
          self.owner = gl.message.sender_address
      
      @gl.public.view
      def get_owner(self) -> Address:
          return self.owner
      
      @gl.public.write
      def update_owner(self, new_owner: Address):
          if gl.message.sender_address != self.owner:
              raise gl.UserError("Only owner can update")
          self.owner = new_owner
  • Add your custom logic

  • Test locally with Studio


🔧 Troubleshooting

Common Issues

"Cannot connect to Docker"

  • Solution: Make sure Docker Desktop is running
  # Check Docker status
  docker ps

"Studio won't start"

  • Solution: Check if port 3000 is available
  # On macOS/Linux
  lsof -i :3000
  
  # On Windows
  netstat -ano | findstr :3000
  • Kill any process using port 3000, then restart Studio

"Contract deployment failed"

  • Solution: Check your contract syntax
    • Look for Python syntax errors
    • Verify all imports are correct
    • Check that type annotations are valid

"Transaction stuck in 'pending'"

  • Solution: Wait for validator consensus
    • Default timeout is 60 seconds
    • Check Studio logs for validator activity
    • Restart Studio if necessary: genlayer down && genlayer up

"Module import errors"

  • Solution: Verify GenLayer CLI is up to date
  npm install -g genlayer@latest

📖 Next Steps

Congratulations! You've completed the onboarding checklist. Here's what to explore next:

Dive Deeper

Join the Community

Contribute


🎯 Quick Reference

Essential Commands

# Start Studio
genlayer up
 
# Stop Studio
genlayer down
 
# Deploy contract
genlayer deploy
 
# Run tests
npm test
# or
gltest
 
# Switch networks
genlayer network
 
# Check CLI version
genlayer --version

Key Concepts

TermDefinition
Intelligent ContractSmart contract with AI/LLM capabilities
GenVMVirtual machine that executes Intelligent Contracts
Optimistic DemocracyConsensus mechanism using AI validators
StudioLocal development environment for testing contracts
Equivalence PrincipleMethod for achieving consensus on non-deterministic outputs

✅ Checklist Complete!

You're now ready to build on GenLayer. If you have questions:

Happy building! 🚀