Skip to content

Add beginner Hello GenLayer example and README guide#19

Open
vansham wants to merge 2 commits intogenlayerlabs:mainfrom
vansham:main
Open

Add beginner Hello GenLayer example and README guide#19
vansham wants to merge 2 commits intogenlayerlabs:mainfrom
vansham:main

Conversation

@vansham
Copy link

@vansham vansham commented Jan 13, 2026

This PR adds a beginner-friendly Hello GenLayer contract example and improves the README with step-by-step usage instructions.

Changes:

  • Added a simple Hello GenLayer contract in examples/ to help new developers get started.
  • Updated README.md with explanation and usage steps for running the example.

This improves the GenLayer boilerplate by making onboarding easier for first-time builders.

Summary by CodeRabbit

  • Documentation
    • Added a beginner-friendly example contract demonstrating core GenLayer concepts including state management, read operations, and write operations for learning purposes.

✏️ Tip: You can customize this high-level summary in your review settings.

Added a minimal GenLayer contract example and updated README to help beginners understand basic contract structure and deployment.
Added documentation explaining the new Hello GenLayer example contract and how beginners can use it.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

Introduces a new beginner-friendly GenLayer contract example (HelloGenLayer) with state management capabilities and documentation. The contract demonstrates basic contract structure with message storage and read/write operations. Documentation updated to guide users through the example and its deployment via GenLayer Studio.

Changes

Cohort / File(s) Summary
New Contract Example
examples/hello_genlayer.py
Introduces HelloGenLayer contract class inheriting from gl.Contract. Implements message state variable with __init__() initializer, get_message() view method, and set_message() write method for basic state management.
Documentation Update
frontend/README.md
Adds "Beginner Example: Hello GenLayer Contract" section documenting the new contract example, its structure, capabilities (read/write operations), and intended use for teaching GenLayer fundamentals.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A contract so simple, a message to keep,
Get it, set it—logic runs deep!
Hello GenLayer, the learner's delight,
Storing and reading, everything right! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main changes: adding a beginner-friendly Hello GenLayer example contract and documenting it in the README.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
examples/hello_genlayer.py (1)

4-4: Star import is acceptable for GenLayer contracts, but explicit import improves IDE support.

The Ruff warnings (F403, F405) about gl being undefined are false positives—gl is exported from the genlayer package. However, for better IDE autocompletion and static analysis, consider an explicit import.

💡 Optional: Use explicit import
-from genlayer import *
+import genlayer as gl
frontend/README.md (2)

86-104: Consider moving this section to the repository's root README.

This documentation describes a contract example in examples/hello_genlayer.py, which isn't frontend-specific. The frontend/README.md is focused on the Next.js application setup and features. For better discoverability and consistency:

  • Move this section to the root README.md, or
  • Create an examples/README.md for example-specific documentation

This keeps the frontend README focused on frontend concerns and places the contract example documentation closer to the example itself.


90-91: Minor: Format the file path as inline code for consistency.

📝 Suggested formatting
 File:
-examples/hello_genlayer.py
+`examples/hello_genlayer.py`
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2164ec6 and 60d2344.

📒 Files selected for processing (2)
  • examples/hello_genlayer.py
  • frontend/README.md
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Follow the development workflow: ensure GenLayer Studio is running, select network with `genlayer network`, deploy contract with `npm run deploy`, update frontend environment variable, and run frontend with `cd frontend && bun dev`
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to contracts/**/*.py : Contracts are Python files in `/contracts/` using the GenLayer SDK with Python class syntax
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to frontend/lib/genlayer/client.ts : Maintain GenLayer client initialization in `frontend/lib/genlayer/client.ts`
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Reference the complete SDK API documentation at https://sdk.genlayer.com/main/_static/ai/api.txt when implementing contracts and integrations
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to contracts/**/*.py : Contracts are Python files in `/contracts/` using the GenLayer SDK with Python class syntax

Applied to files:

  • examples/hello_genlayer.py
  • frontend/README.md
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Applies to frontend/lib/genlayer/client.ts : Maintain GenLayer client initialization in `frontend/lib/genlayer/client.ts`

Applied to files:

  • frontend/README.md
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Follow the development workflow: ensure GenLayer Studio is running, select network with `genlayer network`, deploy contract with `npm run deploy`, update frontend environment variable, and run frontend with `cd frontend && bun dev`

Applied to files:

  • frontend/README.md
📚 Learning: 2025-12-10T12:30:13.640Z
Learnt from: CR
Repo: genlayerlabs/genlayer-project-boilerplate PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-10T12:30:13.640Z
Learning: Reference the complete SDK API documentation at https://sdk.genlayer.com/main/_static/ai/api.txt when implementing contracts and integrations

Applied to files:

  • frontend/README.md
🪛 Ruff (0.14.10)
examples/hello_genlayer.py

4-4: from genlayer import * used; unable to detect undefined names

(F403)


6-6: gl may be undefined, or defined from star imports

(F405)


12-12: gl may be undefined, or defined from star imports

(F405)


16-16: gl may be undefined, or defined from star imports

(F405)

🔇 Additional comments (1)
examples/hello_genlayer.py (1)

6-18: LGTM! Clean beginner-friendly contract example.

The contract correctly demonstrates:

  • State variable declaration with type annotation (message: str)
  • Constructor initialization (__init__)
  • Read method with @gl.public.view decorator
  • Write method with @gl.public.write decorator

This is a well-structured example that aligns with GenLayer SDK patterns. Based on learnings, contracts use Python class syntax with the GenLayer SDK.

@vansham
Copy link
Author

vansham commented Jan 13, 2026

Hi team,
This PR adds a beginner-friendly Hello GenLayer example and improves the README to make onboarding easier.
All checks have passed.
Kindly review and let me know if any changes are needed.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant