StellarEntry - Bringing Stellar NFTs into the digital community economy

StellarEntry allows community owners to leverage NFTs on the Stellar network:

  • to monetize their community with a new revenue stream
  • verify members with ownership of an NFT (keeping out pesky spammers!)
  • pave the way for rewarding genuine community engagement (e.g. distribute assets and tokens to the best community members to reward them for engagement)

In this hackathon, I built a Discord membership platform powered by Stellar NFTs as a proof of concept for the NFT Wizard challenge.

How it works

  1. A user joins the community Discord (You can join my test discord here: https://discord.gg/UM2FRMJV2d) in order to access premium content / engage with community
  2. They need to purchase an NFT, mintable through the web app
  3. After a succesful mint, they verify their ownership of the NFT and are provisioned access to the #nft-holders channel

Running StellarEntry

  1. Setup your own discord server, create a new channel (e.g. #nft-holders) and a new role called NFT Holder. Grant access to the channel for this new role.
  2. Create a new Discord bot (tutorial added to bottom of this readme), add bot, add "Administrator" permissions and replace L57 token in discordbot/main.py. In Discord, ensure your bot's role is the top-most to prevent any issues
  3. In discordbot/, using Python3+, install requirements pip install -r requirements.txt and run the bot python main.py. You can test if the bot is functional by simply typing $verify in the Discord and asserting you receive an error message
  4. Now, install Meteor (from https://www.meteor.com/developers/install), then, inside webapp, run: npm install npm start
    1. The webapp should now be running on port 3000. The webapp will self-generate a server/issuer account for the NFT and the user account, which you can test mint when visiting http://localhost:3000/
    2. Mint the NFT successfully, and go back to discord to verify ownership with the StellarEntry bot: $verify [XLM public key] replacing the public key with the app-given one.
    3. Assert you have been promoted on Discord and now have access to the previously restricted channel.

Architecture

StellarEntry is built on a MeteorJS (NodeJS) web application. Python is used to create the Discord NFT verification bot. Stellar SDK is the primary library used to connect with Stellar blockchain.

| discordbot/
| -- main.py                           # The Discord bot used to verify the NFT owners and promote their accounts
|
| webapp/
| -- client/*                          # The client-side flow of the MeteorJS web app that a user experiences. Templates are used to display data, client-side javascript is used to interact with the server.
| -- server/methods.js                 # The server-side methods of the MeteorJS web app which integrates the MongoDB database. Methods are called from the client.
| -- imports/server/createAccount.js   # XLM account creation class file for interacting with XLM account
| -- imports/server/mint.js            # XLM minting class file for interacting with XLM NFTs
| -- lib/router.js                     # The routing for the app

Caveats

For this hackathon, the purpose was to engineer a proof of concept in 48 hours. Due to limited time, security was not considered in the design, with plaintext key generation and transmission over the wire. Additionally, the discord bot can be expanded to verify identity (e.g. through signing a transaction/string) before provisioning access.

References

Creating a Discord bot tutorial (from freecodecamp)

  1. Make sure you’re logged on to the Discord website. https://discord.com/
  2. Navigate to the application page. https://discord.com/developers/applications
  3. Click on the “New Application” button.
  4. Give the application a name and click “Create”.
  5. Go to the “Bot” tab and then click “Add Bot”. You will have to confirm by clicking "Yes, do it!"
  6. Keep the default settings for Public Bot (checked) and Require OAuth2 Code Grant (unchecked).
  7. Copy the bot token

To invite the bot to your Discord server:

  1. Go to the "OAuth2" tab. Then select "bot" under the "scopes" section. Ensure to give administrator permissions.
  2. After selecting the appropriate permissions, click the 'copy' button above the permissions. That will copy a URL which can be used to add the bot to a server. Paste the URL into your browser, choose a server to invite the bot to, and click “Authorize”.

Built With

Share this project:

Updates