SNIP-721 Proof-of-Ownership Discord Bot
A proof-of-ownership Discord bot for SNIP-721 tokens on the Secret Network. Verified owners are given specified roles. In addition, there is a cron script included which will continuously check ownership of all the holders and remove users that no longer hold any tokens.
- Edit the
.envfile in the backend directory.
- Fill in the details for your Discord server ID, role ID and token at the top.
- Fill in the contract address and code hash for your SNIP-721 contract.
- Create a new wallet, fund it with some SCRT for gas and input the mnemonic inside the
- Enter your Mongo DB details at the bottom of the file.
Next, we will generate a viewing key. Open your terminal, head to the backend directory and enter:
yarn run --set-viewing-key
This will output a viewing key, save this to the
Next, we will generate an encryption key that will be used for encrypting the secret address and discord ID’s saved in the database.
yarn run --create-encryption-key
Copy the encryption key from the output and save it in the
Now, you are ready to start the bot!
Note: The bot will run on port 4000, you can change this in
bot.js if you need.
Start the bot:
To start the cron job:
Note: The cron job is set to run every 1 minute. The purpose of a short duration is for testing. You can increase the duration in
cron.js when you put in production.
- Edit the
config.jsfile in the frontend directory
- Fill in the details for your SNIP-721 contract
- Fill in the Secret address for the new wallet you created to use with the backend
- Finally, you will need to include the URL for the backend API running on port 4000
- For example, you would enter http://localhost:4000 if you are running this from your local machine
Now you are ready to deploy the website! Save the config file, build and deploy to your web server.