Coder Social home page Coder Social logo

unbanksytv / github-contributor-nft-rewards Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thirdweb-example/github-contributor-nft-rewards

0.0 1.0 0.0 246 KB

Use signature-based minting to allow users who have contributed to your github repositories to claim an NFT!

Home Page: https://github-contributor-nft-rewards.thirdweb-example.com/

License: Apache License 2.0

Shell 0.65% JavaScript 1.01% TypeScript 90.66% CSS 7.68%

github-contributor-nft-rewards's Introduction

GitHub contributors NFT rewards

This project demonstrates how you can build a full-stack web3 application that allows github contributors of certain repositories to mint an ERC 1155 NFT using signature minting.

Tools:

  • React SDK: To access the connected wallet, switch the user's network, and claim an NFT from our Edition Drop collection.
  • Auth: To authenticate the user and verify them on the backend.

Using This Template

Create a project using this example:

npx thirdweb create --template github-contributor-nft-rewards
  • Create an edition contract on thirdweb dashboard and lazy mint an NFT. Now, update the contract address in pages/index.tsx and pages/api/claim-nft.ts files.
  • Add your private key to the .env.local file.
  • Create a new OAuth app on GitHub and add the client ID and secret to the .env.local file.
  • Generate a new access token on Github and add it to the .env.local file.
  • You need the following variables in your .env.local file:
PRIVATE_KEY=
GITHUB_ID=
GITHUB_SECRET=
GITHUB_ACCESS_TOKEN=
NEXTAUTH_URL=
NEXTAUTH_SECRET=

How It Works

Using Auth, we first authenticate the user using their web3 wallets which we later use on the backend to generate a signature. We also use next auth to authenticate users with their GitHub account, so that we can check if they have contributed to the repository.

In the api we get the thirdweb user and the next auth user. We first check if both the users are present then we validate if the user has contributed to the repository. If the user has contributed, we generate a signature using the user's private key and send it back to the frontend. The frontend then uses the signature to mint the NFT.

Join our Discord!

For any questions, suggestions, join our discord at https://discord.gg/thirdweb.

github-contributor-nft-rewards's People

Contributors

jarrodwatts avatar avneesh0612 avatar n0ahdoteth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.