This is a README file for a blockchain certificate generation application that utilizes Web3.js and integrates with MetaMask for Ethereum wallet interactions. This application allows users to create and store certificates on the Ethereum blockchain, with the certificate details also stored in Firebase Firestore.
Before you can use this application, make sure you have the following prerequisites installed and configured:
-
MetaMask: Ensure that you have the MetaMask extension installed in your web browser and that you are connected to your Ethereum wallet.
-
Firebase Firestore: You should have a Firebase Firestore database set up, as this application uses Firestore to store certificate details.
-
Web3.js: This application relies on Web3.js, a JavaScript library for Ethereum interactions. Ensure that you have Web3.js included in your project.
-
Ethereum Network: The application is configured to work on the Ethereum network. Make sure you are connected to the desired Ethereum network in MetaMask.
To set up and run the application, follow these steps:
-
Clone or download the repository to your local machine.
-
Open the project in your code editor.
-
Ensure that you have included the necessary libraries, including Web3.js, Firebase, and any other dependencies required for your project.
-
Update the
contractAddress
andcontractABI
in the JavaScript code to match your smart contract's address and ABI (Application Binary Interface).
- When a user accesses the application, it checks if the user is authenticated through Firebase Authentication. If not authenticated, the user is redirected to the login page (
index.html
).
-
After authentication, the user can generate a certificate by providing a name for the certificate in the form on the web page.
-
The application uses MetaMask to interact with the Ethereum wallet to send a transaction to the smart contract, creating a new certificate.
-
The transaction hash is stored in the Ethereum blockchain, and the certificate details (name and transaction hash) are stored in Firebase Firestore.
-
A success or failure message is displayed to the user.
- The user's username is retrieved from Firestore and displayed on the page.
- Users can log out by clicking the "Logout" button, which signs them out using Firebase Authentication.
You can customize this application to fit your specific requirements:
- Update the smart contract address and ABI to match your deployed smart contract.
- Modify the Firestore database structure to store additional information as needed.
- Customize the user interface (HTML and CSS) to match your branding and design preferences.
If you encounter any issues while using the application, refer to the following tips:
-
Ensure that MetaMask is installed and connected to the correct Ethereum network.
-
Check the browser console for any error messages or logs that might help diagnose the problem.
-
Verify that your Firebase Firestore database is properly configured and accessible.
-
Review the smart contract code and ensure that it matches the ABI and address used in the application.
-
This application was developed using Web3.js for Ethereum interactions and Firebase Firestore for data storage.
-
Special thanks to the MetaMask team for their excellent documentation and support for Ethereum wallet integration.