Generate NFT EIP-721 compliant participation certificates for SingularityU Milan Chapter events.
ARCHIVED: this repository has been archived because it has been merged inside of SUMilanApp monorepo.
NFTs are generated by a Smart Contract deployed on Ethereum (currently only on the Ropsten testnet because of the fees are too high on the Mainnet).
-
The Smart Contract is written in Solidity.
-
Hardhat is used to develop, test and deploy the Smart Contract.
-
Alchemy's blockchain APIs are used to sign transactions.
-
Pinata APIs are used to publish certificate images to IPFS.
-
OpenZeppelin's libraries are used inside the Smart Contract.
-
Node.js is used to create an HTTP endpoint, reachable by the webapp.
Node.js
and npm
must be installed on your machine.
The Smart Contract is deployed by an Ethereum wallet/address, so you must have private and public keys of an Ethereum address. You can create an ETH wallet using Metamask and then export the account private key form there. The public key is just your Ethereum address. These keys will be used to deploy the Contract and sign the transactions.
In order to sign transactions to invoke the Contract's functions, you must be able to connect to an Ethereum node. Since today running an ETH node is challenging for most of the people, there are Node-as-a-Service platforms like Alchemy, Infura, etc. that offer you HTTP APIs to handle this problem.
Our implementation uses Alchemy as ETH node "backend", so you have to create an App on Alchemy and obtain an API URL from the Alchemy Dashboard.
In order to keep the certificate image stored somewhere publicly and safely, we choose to upload it to IPFS. Again, running an IPFS node is challenging, so services like Pinata handle this for you and expose their HTTP APIs.
Our implementation uses Pinata APIs, so you must create an account there and obtain the API Keys.
This repo is stricly connected to the webapp, because it offers a "backend" for generating NFT partecipation certificates for the SingularityU Milan Chapter events' attendants. The events' data are stored on Supabase database, so you must have the Supabase API Keys also in this repo.
- clone this repo:
git clone https://github.com/Axelera/SUMilanCertificates.git
- move inside the repo directory:
cd SUMilanCertificates
- create a file called
.env
and put these lines inside:METAMASK_PRIVATE_KEY="<obtained at step 2 of requirements>" METAMASK_PUBLIC_KEY="<obtained at step 2 of requirements>" ALCHEMY_API_URL="<obtained at step 3 of requirements>"
- install dependencies:
npm insall
Once you have completed the Installation steps, you are ready to deploy the Contract to Ethereum. By default, the target network is Ropsten (reasons explained above).
- compile the Contract:
npx hardhat compile
- deploy the Contract with this command:
should generate this output:
npx hardhat run scripts/deploy.js
Deploying contracts with the account: <METAMASK_PUBLIC_KEY> Account balance: <Your ETH Ropsten balance> Contract deployed to address: <ETH address of the deployed contract> # <- write it down
Once you have deployed the Contract and obtained its address, add the following line to the .env
file (which you created in the step 3. of Installation section):
CONTRACT_ADDRESS="<the contract address>"
See here.
contracts/
: Smart Contract's Solidity code. More info here.scripts/
: JS scripts to deploy and update the Contract (run withnpx hardhat run
command).test/
: JS scripts to test Contract's functionalities (run withnpx hardhat test
command).api/
: more info here.hardhat.config.js
: the configuration file for Hardhat, docs here.
We are planning to migrate the Smart Contract from Ethereum to IOTA, because the second one has no fees. IOTA Smart Contracts implementation supports Solidity contracts by running an EVM but now it's all still in beta (info), so we want to wait until it will be more stable.
Every contribution is welcome! Feel free to open issues and/or create PRs.
SUMilanCertificates is released under the MIT License.