Skip to content

Instantly share code, notes, and snippets.

@vgururao
Last active April 23, 2025 12:16
Show Gist options
  • Select an option

  • Save vgururao/f2e7cd029144bcc2208ac3b9b4c0eed5 to your computer and use it in GitHub Desktop.

Select an option

Save vgururao/f2e7cd029144bcc2208ac3b9b4c0eed5 to your computer and use it in GitHub Desktop.
Smol Gods Farcaster Frame

Small Gods

Smol gods is a concept for an onchain pantheon of distributed AI gods that roughly follow the rules of Terry Pratchett's Discworld novel Small Gods, but with a Southeast Asian theme.

The Concept

The goal is to develop a small gods farcaster frames miniapp that people can deploy with their chosen parameters. A small god is an onchain critter defined by a procedurally generated imageset parameterized by a single on-chain state parameter. It receives prayers and delivers blessings (signed by the god's private key), and the devotee votes it up or down depending on whether or not they are happy with the blessing. It grows/diminishes in power with devotee votes. The power is updated onchain after each prayer.

The on-chain element is that each small god is defined by a charitable cause, and submitting a prayer requires a small onchain fee. Fees are periodically batched and sent to the charity address.

The distributed AI element is that each deployed small god has an associated offchain AI client that calls an LLM to generate the benediction in response to a prayer, and also calls an image generator with a canned image prompt parameterized by the "state power." Each time the power updates, the previous image is minted and delivered as a 1:1 NFT sent to the devotee and the new one is generated. The history of god images/power levels/and prayers/ratings is preserved with a suitable mix of onchain/offchain archival.

Farcaster Frames

Farcaster Frames is an easy mechanism for deploying simply onchain apps that can be casted on the Farcaster network (a twitter-like app built on top of Ethereum).

More here: https://miniapps.farcaster.xyz/

Design features

Deploying a smol god

Define the following parameters

  • Name
  • Address of charity (initially pick from a whitelist)
  • Price of prayer (initially fixed at 1 USDC)
  • Description
  • Prompt wrapper for prayer
  • Prompt wrapper for image (indexed by power parameter)
  • API parameters for the LLM and image generators of choice

Behavior

  • The first frame is presented as the current image of the smol god, current power and a text field for a short prayer, and a submit buttn that triggers a 1 USDC payment flow
  • The second frame presents the short blessing and the upvote/downvote button
  • Upon voting, the state is updated on chain, the NFT is minted and delivered to the devotee (user name/address can be retrieved via farcaster id)
  • Every n invocations, the balance is sent to the charity. The smol god must not accumulate a balance about $n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment