This folder has this structure:
local/: if you want to run an Express + Node.js server that exposes the API (typically used for development). More info here.lambda/: if you want to deploy the API to Amazon AWS Lambda service. More info here.
-
The server receives a
POSTrequest (see endpoint specifications inside each folder) with this body:{ "recipiendAddress": "0x...", // address of the recipient "recipientName": "John Doe", // name of the recipient "eventId": "incontro-41" // id of the event }
-
Verifies if the event exists on Supabase database
-
Checks if the certificate is mintable (typically rejected if the
recipientAddressalready has a certifificate associated to thateventId) -
From the base.png, generates an image of the certificate using Jimp library. Example:
-
uploads the image to IPFS using Pinata and gets the IPFS hash
-
generates NFT metadata following the ERC721 Metadata JSON Schema. Example:
{ "name": "SUMilan Chapter Event Participation Certificate", "description": "To: SU Milan Chapter; Event: Incontro 41: NFT: che cosa sono e come funzionano; Date: 24/09/2021", "image": "ipfs://QmNZLQj6GDoJZzj5iU9aTv8EMssMZRXJ3SUZ7MccR4vubU" }
-
upload the NFT metadata to IPFS using Pinata and gets the IPFS hash
-
invokes the
mintCertificatefunction of the smart contract by signing a transaction using Alchemy -
returns the transaction hash.
Node.jsandnpminstalled- Ethereum private and public address keys (see Requirements)
- Alchemy API Url (see Requirements)
- Pinata API Keys (see Requirements)
- Supabase API Keys (see Requirements)
- deployed contract address (see here)