Create an NFT Minting Farcaster Frame on Degen Chain

Create an NFT Minting Farcaster Frame on Degen Chain

In this guide, learn how to create a Farcaster Frame that users can mint NFTs from on Degen Chain gaslessly — airdropping the NFTs to their wallets without them needing to bridge funds to Degen Chain.

Here's the link to the GitHub repo:

GitHub - thirdweb-dev/thirdweb-engine-farcaster-frame: Thirdweb engine example with farcaster frame
Thirdweb engine example with farcaster frame. Contribute to thirdweb-dev/thirdweb-engine-farcaster-frame development by creating an account on GitHub.

Video Tutorial

Deploying your NFT minting contract

Before getting into the Farcaster Frame setup, you need to have an NFT smart contract that you can add to your frame.

With thirdweb, you can deploy pre-built, audited smart contracts to any EVM chain. For the purpose of this guide, we'll be deploying an NFT Drop (ERC-721) smart contract to Degen Chain.

To deploy your NFT Drop (ERC-721) smart contract, simply hit "Deploy now" below and select Degen Chain in the modal that opens up:

NFT Drop - ERC721 | Published Smart Contract
Release collection of unique NFTs for a set price. Deploy NFT Drop in one click with thirdweb.

Getting Started

1. Get a Neynar API key (See the Neynar docs for more info)

2. Get a thirdweb Engine API key & create an Engine instance

Getting started with Engine | thirdweb Infrastructure
Learn how to use Engine to manage your backend wallets and call contract methods

3. Retrieve your thirdweb Engine URL, wallet, and access token. Set up your config.ts file as such:

thirdweb-engine-farcaster-frame/src/config/config.ts at main · thirdweb-dev/thirdweb-engine-farcaster-frame
Thirdweb engine example with farcaster frame. Contribute to thirdweb-dev/thirdweb-engine-farcaster-frame development by creating an account on GitHub.

We also have a .env.example file to get you started faster:

thirdweb-engine-farcaster-frame/.env.example at main · thirdweb-dev/thirdweb-engine-farcaster-frame
Thirdweb engine example with farcaster frame. Contribute to thirdweb-dev/thirdweb-engine-farcaster-frame development by creating an account on GitHub.

4. Replace <next_js_image_path> to what you'd like to have in your code.

Each part on the Mint API here:

thirdweb-engine-farcaster-frame/src/pages/api/mint.ts at main · thirdweb-dev/thirdweb-engine-farcaster-frame
Thirdweb engine example with farcaster frame. Contribute to thirdweb-dev/thirdweb-engine-farcaster-frame development by creating an account on GitHub.

Just make sure it’s related to your next.js image path, usually it’s in the public folder.

Here are the different steps:

  • Get started
  • Like & re-cast to mint (Neynar)
  • Mint NFT (thirdweb Engine)
  • Congratulations for minting

Here is some back-up HTML as well in case of something fails:

thirdweb-engine-farcaster-frame/src/pages/api/mint.ts at main · thirdweb-dev/thirdweb-engine-farcaster-frame
Thirdweb engine example with farcaster frame. Contribute to thirdweb-dev/thirdweb-engine-farcaster-frame development by creating an account on GitHub.

5. Change the public URL that you want the Farcaster Frame to send a response to here:

thirdweb-engine-farcaster-frame/src/utils/compute-html.ts at main · thirdweb-dev/thirdweb-engine-farcaster-frame
Thirdweb engine example with farcaster frame. Contribute to thirdweb-dev/thirdweb-engine-farcaster-frame development by creating an account on GitHub.

In this example, we just use Vercel's URL when doing preview and production deployments.

6. After you have everything set up — including your Neynar API key, thirdweb Engine, and the config file — you're ready to go! Please also make sure to test your api/mint locally.

7. Go to the Farcaster Frame validator to test how users will interact with your frame: https://warpcast.com/~/developers/frames

You'll be able to see what it will look like once you publish the cast to production.

And that's it — have fun!

Learn more

The thirdweb Frame API uses thirdweb Engine to send onchain transactions with a simple fetch request.

With thirdweb Engine, you can scale your app to millions of users with backend wallet & nonce management, gas fee optimization, automatic retries, and more.

Get started with thirdweb Engine:

Engine: Open-Source Server for Scalable Web3 Apps | thirdweb
A production-grade HTTP server to generate backend wallets on any EVM blockchain—with smart contracts, auth, gasless transactions, & managed infra. Get started.