Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AbztractBoy/NFT-Nexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Moon Pi

Moon Pi is a decentralized application (dApp) built on the Pi Network, enabling users to create, mint, and trade NFTs seamlessly. The platform includes an integrated marketplace, empowering creators and collectors to engage in the digital asset economy.

Features

NFT Creation: Easily create unique digital assets using an intuitive interface.

Minting: Mint NFTs on the Pi Network blockchain with low transaction costs.

Marketplace: A decentralized peer-to-peer marketplace for buying, selling, and trading NFTs.

Wallet Integration: Seamless integration with Pi Network wallets for secure transactions.

User-Friendly: Designed for both beginners and advanced users.

Technologies Used

Frontend: React.js, Next.js, or your preferred framework.

Smart Contracts: Solidity (Ethereum-compatible smart contracts).

Blockchain: Pi Network (testnet/mainnet integration).

Backend: Node.js, Express.js (optional for APIs).

Database: MongoDB, Firebase, or any preferred database.

Tools: Hardhat/Truffle (smart contract development), Web3.js/Ethers.js (blockchain interaction).

Prerequisites

Node.js (v16 or higher)

npm or yarn

Git

Pi Network account (for wallet integration)

MetaMask or Pi Wallet (for testing)

Installation

Clone the repository: git clone https://github.com/AbztractBoy/Moon-Pi.git cd Moon-Pi

// Install dependencies: npm install

// Set up environment variables: Create a .env file in the root directory and add the following: REACT_APP_INFURA_ID=your_infura_project_id REACT_APP_PI_NETWORK_API_KEY=your_pi_network_api_key

// Run the development server: cd client npm start

// Deploy smart contracts: cd contracts npx hardhat compile npx hardhat run scripts/deploy.js --network pi_network

Project Structure

Moon-Pi/ ├── client/ # Frontend (React, Next.js, etc.) │ ├── public/ # Static assets │ ├── src/ # React components │ │ ├── components/ # Reusable UI components │ │ ├── pages/ # Application pages │ │ ├── styles/ # CSS or SCSS files │ │ └── App.js # Main app component │ └── package.json # Frontend dependencies │ ├── contracts/ # Smart contracts (Solidity) │ ├── NFT.sol # NFT creation and minting contract │ ├── Marketplace.sol # NFT marketplace contract │ └── migrations/ # Deployment scripts │ ├── server/ # Backend (optional, for APIs) │ ├── routes/ # API routes │ ├── models/ # Database models │ └── server.js # Backend entry point │ ├── tests/ # Unit and integration tests │ ├── contracts/ # Smart contract tests │ └── frontend/ # Frontend tests │ ├── README.md # Project documentation ├── .gitignore # Files to ignore in Git └── package.json # Root dependencies (if using a monorepo)

Integration

// Pi Network Integration To integrate the Pi Network into the dApp, follow these steps:

// Pi SDK Setup:

Install the Pi SDK (if available) or use Pi Network's APIs for wallet integration.

// Add the Pi SDK to your frontend: npm install pi-network-sdk

// Initialize the SDK in your App.js or main component: javascript - import Pi from 'pi-network-sdk';

Pi.init({ apiKey: process.env.REACT_APP_PI_NETWORK_API_KEY });

// Wallet Authentication:

Use Pi Network's authentication flow to allow users to log in with their Pi wallets.

Example: javascript - Pi.authenticate().then((user) => { console.log('Authenticated user:', user); });

// Transaction Handling:

Use Pi Network's APIs to handle transactions (e.g., minting fees, marketplace purchases).

Example: javascript - Pi.createPayment({ amount: 1, memo: 'NFT Purchase' }).then((payment) => { console.log('Payment created:', payment); });

Smart Contract Integration

The dApp uses Solidity smart contracts for NFT creation, minting, and marketplace functionality.

// Deploy Contracts:

Compile and deploy the NFT.sol and Marketplace.sol contracts to the Pi Network blockchain (or a testnet).

Example deployment script: javascript - const hre = require('hardhat');

async function main() { const NFT = await hre.ethers.getContractFactory('PiNFT'); const NFT = await NFT.deploy(); await NFT.deployed(); console.log('NFT deployed to:', NFT.address); }

main().catch((error) => { console.error(error); process.exit(1); });

// Interact with Contracts:

Use Web3.js or Ethers.js to interact with the deployed contracts.

Example: const contractABI = require('./contracts/NFT.json'); const contractAddress = '0xYourContractAddress';

const provider = new ethers.providers.Web3Provider(window.ethereum); const signer = provider.getSigner(); const piNFTContract = new ethers.Contract(contractAddress, contractABI, signer);

const mintNFT = async () => { const tx = await NFTContract.mintNFT('https://your-metadata-url.com'); await tx.wait(); console.log('NFT minted!'); };

// Frontend-Backend Integration If you're using a backend for APIs or database management, integrate it with the frontend as follows:

// API Endpoints:

Create RESTful APIs for fetching NFT data, user profiles, and marketplace listings.

Example: app.get('/api/nfts', async (req, res) => { const nfts = await NFTModel.find(); res.json(nfts); });

Frontend API Calls:

Use Axios or Fetch to call backend APIs from the frontend.

Example: const fetchNFTs = async () => { const response = await axios.get('/api/nfts'); console.log(response.data); };

// Testing the Integration Unit Tests:

Write unit tests for smart contracts using Hardhat or Truffle.

Example: describe('NFT Contract', () => { it('Should mint an NFT', async () => { const tx = await NFTContract.mintNFT('https://your-metadata-url.com'); await tx.wait(); const balance = await NFTContract.balanceOf(userAddress); assert.equal(balance.toString(), '1'); }); });

// End-to-End Tests:

Use tools like Cypress or Selenium to test the frontend and backend integration.

Example: describe('NFT Marketplace', () => { it('Should display NFTs', () => { cy.visit('/marketplace'); cy.get('.nft-item').should('have.length.greaterThan', 0); }); });

Contributing

We welcome contributions from the community! To contribute:

Fork the repository.

Create a new branch (git checkout -b feature/YourFeatureName).

Commit your changes (git commit -m 'Add some feature').

Push to the branch (git push origin feature/YourFeatureName).

Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or feedback, feel free to reach out:

Email: [email protected]

GitHub: https://github.com/AbztractBoy/

Website: in development

About

A Pi Network dApp for creating, minting, and trading NFTs with an integrated marketplace.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors