Decentralized Crowdfunding Application

Dhrumil Dalwadi
6 min readOct 7, 2020

Introduction

Crowdfunding is a practice where people provide funds for a project or venture by raising small amounts of money from large number of people. In this day and age, with the advancement of the technology, such practices are now widely done over the internet. There are many platforms to create a campaign for a project and generate capital. But now these platforms are misused by some people. These people collect the money by creating a fake project campaign and steal people’s money rather than using it for the development of projects. Such frauds are quite common these days. To overcome this a decentralized application would be perfect.

What is Blockchain?

The technology of Blockchain was introduced along with Bitcoin in the white paper written by Satoshi Nakamoto back in 2009. Blockchain may be defined as a decentralized, distributed ledger that records the transactions and assets. Blockchain consists of chain of blocks. Each block contains the data, the hash of the previous block and hash of the same block. So if the data is changed inside the blockchain, the hash value will change and this reflects on the other blocks. Due to this one can identify where the data is changed.

Here no one organization can own the chain. Instead the copy of blockchain is distributed to all the peers in the network and whenever any changes are made in the chain, it is reflected in each copy of the blockchain. Due to this, whenever a transaction occurs, it takes about 15 to 30 seconds to confirm as it needs to reflect on all the copies of the chain.

Ethereum

Ethereum is the second largest cryptocurrency platform, behind Bitcoin. It is a decentralized, open source Blockchain featuring Smart Contract functionality. Some of the wallets like Trezor One, Metamask, Exodus, etc. are famous around the globe and easily available. These wallets are used to transact in ether. One of the most commonly used wallet is the Metamask which provides ether not only in main network but also in other test networks for development purposes. With the help of Infura API key, one is able to use the test network for the development of the project

Solidity

Solidity is an Object-Oriented Programming Language used for writing Smart Contracts. A Smart Contract is a program which is stored in a blockchain and is executed automatically when the conditions are met. Smart contracts automatically execute transactions following predetermined rules, and the encrypted records of those transactions are shared across participants. Thus, nobody has to question whether information has been altered for personal benefit.

Web3

Web3 is a library which enables us to interact with a local or remote ethereum node. The web3 JavaScript library interacts with the Ethereum blockchain. It can retrieve user accounts, send transactions, interact with smart contracts, and more. With the help of web3 one is able to connect their wallet with the frontend of the project and establish a communication.

Front-end

The Front-end of the project is made with the help of React JS and Next JS.

React is an open-source front-end Javascript library used to build interfaces and other ui components. It is used to render web elements which makes it relatively easy to create a interface. Semantic-ui is used to generate different elements and provide default styling to those elements.

Next JS is also a Javascript library which is used for server-side rendering with the help of react. The javascript files are executed on the server-side so the content delivery is faster. It is also used to do client-side route transition between pages and linking different pages.

My Work

Smart Contract

The designing and testing of the smart contracts was done in Remix IDE, which is an open source tool write and deploy solidity contracts. There are two contracts in this project.

The first contract is the Campaign contract which contains a manager, the person who wants to source money for his project. The person who deploys this contract will be regarded as the manager of that contract. A minimum contribution amount is set by the manager which limits the minimum amount a contributor can pay. All the ethers provided by the contributor does not go to the manager’s account but stays in the contract. When the manager wants to use those funds for the project, he/she has to create a request for the same. If the majority of the contributors approve the request, only then the manager can initiate the transaction.

The second contract is the Factory contract. This contract handles the deployment of the first contract. This contract is made due to security purpose so that the manager cannot get the hold of the Campaign contract’s source code.

Fig. Project Structure

Execution of the Project

Before going to the website itself, we need to compile and run the code. This can be done by typing ‘npm run dev’ at the root project folder in the terminal. By default our instance will be ready on localhost:3000.

Fig. Home Page

The above image shows the home page of the application. As you can see, it lists out different campaigns which are deployed in the Rinkeby Test network by us. To view details of a campaign, you can click on ‘View Campaign’ button below the address. With the help of ‘Create Campaign’ Button one can create a new Campaign. One has to provide a minimum amount to be payed by the contributors while creating a new campaign.

Fig. Campaign Details

The above page is shown when you click on ‘View Campaign’. It shows the details of the campaign like manager’s address, the amount the contract currently holds, minimum contribution set by the manager, etc. The page also gives a box to type the amount and contribute to the campaign. If you click on ‘View Requests’ you will be redirected to a page which shows all the requests of that campaign.

Fig. Request Page

The image above shows the request page of the contract. It shows all the details of the request made by the manager. The contributors have to click on Approve button if he/she wants to allow the use of ethers. When majority of contributors approve the request, the manager can finalize the request to initiate the transaction. Note that only manager can finalize the request. When a request is ready to be finalized, that particular request is highlighted in green and when the request is completed, that particular request greys out.

Conclusion

In this project, I was successfully able to create a scenario for a Decentralized Crowdfunding Platform. As this is an academic project and not a commercial project, the project was made with bare minimum functionalities. So this project can further be improved greatly.

Sign up to discover human stories that deepen your understanding of the world.

Dhrumil Dalwadi
Dhrumil Dalwadi

Written by Dhrumil Dalwadi

Blockchain and Cyber-security Enthusiast

No responses yet

Write a response