Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Latest commit

 

History

History
39 lines (36 loc) · 2.18 KB

README.md

File metadata and controls

39 lines (36 loc) · 2.18 KB

SUMilanCertificate Node.js API

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.

How the certificate is minted

  1. The server receives a POST request (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
    }
  2. Verifies if the event exists on Supabase database

  3. Checks if the certificate is mintable (typically rejected if the recipientAddress already has a certifificate associated to that eventId)

  4. From the base.png, generates an image of the certificate using Jimp library. Example: certificate.png

  5. uploads the image to IPFS using Pinata and gets the IPFS hash

  6. 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"
    }
  7. upload the NFT metadata to IPFS using Pinata and gets the IPFS hash

  8. invokes the mintCertificate function of the smart contract by signing a transaction using Alchemy

  9. returns the transaction hash.

Requirements