Real-time rewards for on-chain events ๐ 2023 Sandstorm Hackathon Winner
Last updated Jan 27, 2026
15
Stars
4
Forks
0
Issues
0
Stars/day
Attention Score
5
Language breakdown
TypeScript 71.5%
CSS 27.2%
Shell 1.0%
JavaScript 0.3%
โธ Files
click to expand
README
Submitted to the 2023 Sandstorm Hackathon. Application available: sandstorm.md
proof-of-x
Mint and Drop an NFT after Verifying a Specific Solana Event has occurredThis is a serverless function that handles a POST request from Helius on Vercel using Next.js. The function:
- Validates and authorizes the
POSTrequest - Verifies that the type of transaction received matches what was expected (in this case 'BURN').
- It extracts the
tokenTransferarray from the body, and verifies that the tokens burned is greater than theMIN_BURNconstant. - If the amount of tokens burned is greater than the
MIN_BURNconstant, we send a call to CrossMint to mint an NFT to the burner orpyro.
pages/api/burn.ts.
Getting Started
- Clone from GH.
- Rename
.env.exampleto.envand update the variables. \
AUTH_CODE is self generated (i like solana keygen-grind to find something secure)
- CROSSMINT envs require a dev account from CrossMint
- DISCORD keys are available via the Developer Portal
- * NOTE: You can disable DISCORD BOT by setting const NOTIFY_DISCORD = false in pages/api/burn.ts, in which case you shouldn't need these keys
- You'll need a Helius WebHook. At present this repo is only really indexed for the
Enhanced TransactiontypeBURN. The verification component is pretty modular and could easily be replaced with some other Tx Type and different success criteria. You'll need to wait to deploy the webhook until after you've launched your server. - Modify NFT rewards/metadata to your liking.
yarn
yarn dev
- Out the gate, you should be able to use
utils/samples/samplePOST.mdto run acurlcommand in a seperate terminal--this should effectively simulate recieving aPOSTrequest from the WebHook. Just make sure you're sending the request to the right path (in my case,http://localhost:3000/api/burn)
Requesting NFT Mint:
- Pyro: Cw9P...4J1E
- Burn: 10,055,679 $BONK
- TxId: JWSn...JoDR
- CMID: w44177a9-02e9-4d04-a5ce-de7d5739d5bx
โ
Mint: arGbzUJQ1vTmjqPdDTqXsuqPxLQb1MGkUX5qTXt483Kx
โ
DCRD: ๐ค Connection Established
โ
DCRD: Message sent to server
โ
DCRD: ๐ค Connection destroyed
To get the feed from Helius, you need to push your component to a serverless function hosting provider. I used Vercel. I note some issues/limitations below, especially on their free plan.
Potential Limitations / Known Issues
At present (Jan 21, 2023):
- Webhooks:
- Vercel:
- CM:
properties.files for the img file causes the NFT to not render on all platforms (e.g., Solana Explorer)๐ More in this category