gitmyhub

genlayer-project-boilerplate

TypeScript ★ 14k updated 5d ago

A starter template for building apps on GenLayer, a blockchain platform where smart contracts can fetch live internet data and use AI, includes a working football match betting game as a complete example.

TypeScriptPythonNext.jsRadix UIGenLayer CLIsetup: moderatecomplexity 4/5

This repository is a starter project for building applications on GenLayer, a blockchain platform that allows smart contracts to call out to the internet and use AI during execution. The boilerplate comes with a working example: a football match betting game built as a smart contract.

The football bets contract lets users place a prediction on which team will win a given match. After the match is over, anyone can trigger resolution, at which point the contract fetches the actual result from a URL and compares it against the stored predictions. Users who guessed correctly earn points. The contract also lets you query all bets and check point totals for any player.

The project has three main parts. First, there is the smart contract itself, written in Python and deployed to GenLayer using a command-line tool called the GenLayer CLI. Second, there is a Next.js web frontend built with TypeScript, TanStack Query for data fetching, and Radix UI for interface components. The frontend connects to the deployed contract so users can interact with it through a browser. Third, there is a test suite that runs against the deployed contract in the GenLayer Studio environment to verify that creating bets, resolving them, and querying results all work correctly.

To run this example, you need either the hosted GenLayer Studio or a local installation of it, plus the GenLayer CLI installed globally via npm. Setup involves deploying the contract, copying an environment configuration file, adding the deployed contract address, and starting the Next.js development server.

This is a boilerplate template meant to be the starting point for new GenLayer projects, not a finished application.

Where it fits