├── .github └── workflows │ └── npm-publish-github-packages.yml ├── styles.css ├── index.html ├── app.js └── README.md /.github/workflows/npm-publish-github-packages.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: actions/setup-node@v4 16 | with: 17 | node-version: 20 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-gpr: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | permissions: 25 | contents: read 26 | packages: write 27 | steps: 28 | - uses: actions/checkout@v4 29 | - uses: actions/setup-node@v4 30 | with: 31 | node-version: 20 32 | registry-url: https://npm.pkg.github.com/ 33 | - run: npm ci 34 | - run: npm publish 35 | env: 36 | NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 37 | -------------------------------------------------------------------------------- /styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Arial, sans-serif; 3 | background-color: #f0f0f0; 4 | color: #333; 5 | margin: 0; 6 | padding: 0; 7 | } 8 | 9 | .container { 10 | max-width: 800px; 11 | margin: 50px auto; 12 | background-color: white; 13 | padding: 20px; 14 | border-radius: 10px; 15 | box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); 16 | } 17 | 18 | h1 { 19 | text-align: center; 20 | color: #4CAF50; 21 | } 22 | 23 | h2 { 24 | color: #333; 25 | } 26 | 27 | .donation-form { 28 | margin-bottom: 30px; 29 | } 30 | 31 | .donation-form label { 32 | display: block; 33 | margin-bottom: 10px; 34 | } 35 | 36 | .donation-form input, .donation-form select, .donation-form button { 37 | width: 100%; 38 | padding: 10px; 39 | margin-bottom: 15px; 40 | border-radius: 5px; 41 | border: 1px solid #ccc; 42 | } 43 | 44 | .donation-form button { 45 | background-color: #4CAF50; 46 | color: white; 47 | cursor: pointer; 48 | } 49 | 50 | .donation-form button:hover { 51 | background-color: #45a049; 52 | } 53 | 54 | .donations-list ul { 55 | list-style-type: none; 56 | padding: 0; 57 | } 58 | 59 | .donations-list li { 60 | background-color: #f9f9f9; 61 | padding: 10px; 62 | border: 1px solid #ddd; 63 | margin-bottom: 10px; 64 | border-radius: 5px; 65 | } 66 | 67 | .total-donations { 68 | text-align: center; 69 | font-size: 20px; 70 | } 71 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Crypto Donation Tracker 7 | 8 | 9 | 10 |
11 |

🌍 Decentralized Charity Donation Tracker

12 | 13 | 14 |
15 |

Make a Donation

16 | 17 | 22 | 23 | 24 | 25 |
26 | 27 | 28 |
29 |

Recent Donations

30 | 33 |
34 | 35 | 36 |
37 |

Total Donations

38 |

0 ETH

39 |
40 |
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | // Array to store donations 2 | let donations = []; 3 | 4 | // Function to make a new donation 5 | function makeDonation() { 6 | const cause = document.getElementById('cause').value; 7 | const amount = parseFloat(document.getElementById('donationAmount').value); 8 | 9 | if (!amount || amount <= 0) { 10 | alert("Please enter a valid donation amount."); 11 | return; 12 | } 13 | 14 | // Simulate a blockchain transaction ID (random) 15 | const transactionId = '0x' + Math.random().toString(16).substr(2, 10); 16 | 17 | // Create a donation object 18 | const donation = { 19 | cause: cause, 20 | amount: amount, 21 | transactionId: transactionId, 22 | timestamp: new Date().toLocaleString() 23 | }; 24 | 25 | // Add to the donations array 26 | donations.push(donation); 27 | 28 | // Update the UI 29 | updateDonationsList(); 30 | updateTotalDonations(); 31 | 32 | // Reset the input field 33 | document.getElementById('donationAmount').value = ''; 34 | } 35 | 36 | // Function to update the list of donations 37 | function updateDonationsList() { 38 | const donationsList = document.getElementById('donationsList'); 39 | donationsList.innerHTML = ''; // Clear the list first 40 | 41 | donations.forEach((donation, index) => { 42 | const listItem = document.createElement('li'); 43 | listItem.innerHTML = ` 44 | Cause: ${donation.cause}
45 | Amount: ${donation.amount} ETH
46 | Transaction ID: ${donation.transactionId}
47 | Time: ${donation.timestamp} 48 | `; 49 | donationsList.appendChild(listItem); 50 | }); 51 | } 52 | 53 | // Function to update the total donations 54 | function updateTotalDonations() { 55 | const totalDonationsElement = document.getElementById('totalDonations'); 56 | const totalDonations = donations.reduce((total, donation) => total + donation.amount, 0); 57 | totalDonationsElement.textContent = totalDonations.toFixed(2); 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🌍 Decentralized Crypto Donation Tracker 2 | 3 | This project is a **decentralized donation tracker** that allows users to donate cryptocurrency to various causes and track all donations in real time. The goal is to create a transparent and easy-to-use platform where users can support charitable initiatives using cryptocurrencies like **ETH**. Every donation is logged and displayed for transparency, simulating blockchain-like behavior. 4 | 5 | --- 6 | 7 | ## 📜 Features 8 | 9 | - **Donation Tracking**: Users can donate in ETH to selected charity causes. 10 | - **Transparency**: All donations, including amounts and causes, are displayed in real time. 11 | - **Simulated Blockchain**: Each donation is assigned a unique transaction ID, mimicking how blockchain donations are tracked. 12 | - **Real-Time Updates**: The total donations and recent donation list update automatically upon new contributions. 13 | 14 | --- 15 | 16 | ## 🛠️ Technologies Used 17 | 18 | - **HTML5**: For structuring the web page. 19 | - **CSS3**: For styling and layout. 20 | - **JavaScript**: Handles the donation logic and dynamic updates to the user interface. 21 | 22 | --- 23 | 24 | ## 🚀 How to Run Locally 25 | 26 | ### Prerequisites 27 | 28 | To run the project locally, you'll need: 29 | 30 | - A web browser (Google Chrome, Firefox, etc.) 31 | - A simple web server like **Live Server** (for VS Code) or **Python HTTP server**. 32 | 33 | ### Steps to Set Up 34 | 35 | 1. **Clone the repository**: 36 | ```bash 37 | git clone https://github.com/your-username/crypto-donation-tracker.git 38 | cd crypto-donation-tracker 39 | ``` 40 | 41 | 2. **Open the project**: 42 | - Open the `index.html` file in a browser, or 43 | - Serve it using a local server like **Live Server** in VS Code or: 44 | ```bash 45 | # If you have Python installed 46 | python -m http.server 8000 47 | ``` 48 | 49 | 3. **View in Browser**: 50 | - Open `http://localhost:8000` in your browser to see the project in action. 51 | 52 | --- 53 | 54 | ## 📂 Project Structure 55 | 56 | ```plaintext 57 | . 58 | ├── index.html # The main HTML file that contains the structure of the donation page. 59 | ├── styles.css # Contains all the styles for the project. 60 | ├── app.js # JavaScript logic for donations and real-time updates. 61 | └── README.md # Documentation for the project. 62 | ``` 63 | 64 | --- 65 | 66 | ## 🌟 Usage Instructions 67 | 68 | 1. Select a **cause** from the dropdown list. 69 | 2. Enter the amount of **ETH** you want to donate. 70 | 3. Click on **Donate Now** to register your donation. 71 | 4. Your donation will appear in the **Recent Donations** list, including: 72 | - The cause. 73 | - The amount donated. 74 | - A unique transaction ID (simulated). 75 | - The timestamp of the donation. 76 | 5. Watch the **Total Donations** update in real time! 77 | 78 | --- 79 | 80 | ## 💡 Future Improvements 81 | 82 | - **Blockchain Integration**: Integrate with **Ethereum** or **Polygon** testnets using **Web3.js** to enable real crypto donations. 83 | - **Smart Contract Deployment**: Deploy a smart contract to handle real-time donation tracking on-chain. 84 | - **Multiple Cryptocurrencies**: Support additional tokens and cryptocurrencies for donations. 85 | - **Charity Verification**: Implement a system to verify and audit charities on the platform for increased trust. 86 | 87 | --- 88 | 89 | ## 🤝 Contributing 90 | 91 | Contributions are welcome! If you have ideas for new features or bug fixes, feel free to open an issue or submit a pull request. 92 | 93 | --- 94 | 95 | ## 📄 License 96 | 97 | This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details. 98 | 99 | --- 100 | 101 | ## 🙏 Acknowledgements 102 | 103 | Special thanks to all the open-source libraries and contributors that helped make this project possible. 104 | 105 | --- 106 | 107 | ### Let's make crypto donations **transparent**, **trustworthy**, and **impactful**! 🌍 108 | 109 | --------------------------------------------------------------------------------