divine-comedian / Capstone-Project

1 stars 3 forks source link

Pixels For Peace

Pixels For Peace is an opensource Ethereum blockchain NFT project that allows users to create unique NFTs from their image files and choose to either create an auction or a lottery for a charitable cause. All proceeds are donated to the designated charity.

How it works

  1. First, you need to have an Ethereum wallet that supports ERC-721 tokens, such as MetaMask.
  2. Next, upload an image file via Front End. The file will be uploaded to a secure and reliable IPFS. An IPFS hash for the file will be generated.
  3. The IPFS hash and CID will be used to create a unique NFT on the Ethereum blockchain.
  4. Choose whether you want to create an auction or a lottery for your NFT and link a charitable cause.
  5. If you choose to create an auction, set a starting price (bid) and an end time for the auction.
  6. If you choose to create a lottery, set a ticket (token) price and the number of tickets that will be sold.
  7. All proceeds from the auction or lottery will be donated to the charitable cause of your choice.

Benefits of using Pixels For Peace

Getting started

To get started with Pixels For Peace, you will need the following:

Once you have these, you can start creating your own Pixels For Peace NFTs and supporting a good cause.

Components

Solidity Contracts

Pixels For Peace uses the following Solidity contracts:

  1. NFT.sol: used to generate NFTs
  2. Auction.sol: used to manage auctions
  3. Lottery.sol: used to manage lotteries
  4. SaleFactory.sol: used to create new auction or lottery contract instances for each generated NFT

Frontend

The frontend is built with Angular (TypeScript) and provides the customer-facing interface for generating new NFTs, viewing past and current sales, and viewing a list of supported charitable causes.

Backend

The backend is built with Nest (TypeScript) and is responsible for securely interacting with the Ethereum contracts, as well as managing the database (MongoDB). Backend API

Mongo Database

Each associated sale data (auction or lottery contract instance), are saved to the database.

The backend utilizes MongoDB Atlas instance. Simply connect to it using a connection string in the following format:

`MONGO_DB_CONNECTION_STRING="mongodb+srv://<username>:<password>@cluster0.ynzm1xh.mongodb.net/pixelForPeaceDB"`

Add this as an key-value pair in .env configuration. (See .env-sample at root of backend source.)

DevOps with GitHub Action

Frontend and backend are deployed to Azure web app instances.

Pipeline definitions for located in ./github/workflows which deployment can be triggered in GitHub action tab.

Each pipelines requires the following GitHub Action secret variables.

Configure the following (see each respective files env section).

deploy-frontend.yml

FRONTEND_PUBLISH_PROFILE: Export and add Azure web app publish profile here.

deploy_backend.yml

BACKEND_PUBLISH_PROFILE: Export and add Azure web app publish profile here.

BACKEND_ENV_FILE: Add production .env file here. (e.g containing database connection string).

tx hashes and contract addresses examples

create voting token

mint some tokens

create tokenized ballot