blockchain-charity-fundraising
v1.0.0
Published
This npm package provides functionalities for creating a blockchain-based charity fundraising platform using blockchain technology. It allows users to create fundraising campaigns, donate to campaigns, and retrieve active campaigns directly on the blockch
Downloads
2
Readme
Blockchain-based Charity Fundraising Platform
This npm package provides functionalities for creating a blockchain-based charity fundraising platform using blockchain technology. It allows users to create fundraising campaigns, donate to campaigns, and retrieve active campaigns directly on the blockchain.
Installation
To install this package, use the following command:
npm install blockchain-charity-fundraising
Usage
Here's how to use the package in your project:
const CharityFundraising = require('blockchain-charity-fundraising');
// Initialize with your Web3 provider and contract address
const web3Provider = 'YOUR_WEB3_PROVIDER_URL';
const contractAddress = 'CONTRACT_ADDRESS';
const charityFundraising = new CharityFundraising(web3Provider, contractAddress);
// Example: Create a fundraising campaign
const campaignName = 'Campaign Name';
const targetAmount = 1000; // Target fundraising amount in Ether
charityFundraising.createCampaign(campaignName, targetAmount)
.then(() => console.log('Campaign created successfully'))
.catch(error => console.error('Failed to create campaign:', error));
// Example: Donate to a campaign
const campaignId = 'CAMPAIGN_ID';
const donationAmount = 100; // Donation amount in Ether
charityFundraising.donate(campaignId, donationAmount)
.then(() => console.log('Donation successful'))
.catch(error => console.error('Donation failed:', error));
// Example: Get active campaigns
charityFundraising.getCampaigns()
.then(campaigns => console.log('Active campaigns:', campaigns))
.catch(error => console.error('Failed to get campaigns:', error));
Replace 'YOUR_WEB3_PROVIDER_URL'
and 'CONTRACT_ADDRESS'
with the appropriate values for your environment. Adjust the usage instructions and examples as needed based on your package's functionality.