Solidity is incorporated with lots of applications, and each one of them is equally important. Today, we will discuss the applications of solidity and how they are being used.
All the applications of the Solidity are based on contracts as I have discussed in the earlier blog that it is a contract-oriented language. Now, I will discuss few applications to let you understand their usage and how they work in detail. It is not possible to address all in detail, but I will give brief information about every topic.
Solidity applications and their uses are
Real world scenario of voting comprises of various fraudulent techniques like manipulation of data, booth capturing, fake voters, and manipulation in voting machines, etc. But to solve few of these problems, we could make use of contracts in doing envoy voting so that everything will work smoothly, transparently and automatically. Given below is the code for voting.
Fig.1. Contract named as Ballot
A contract named as Ballot is defined in which two structures named as Voter and Proposal are defined. Inside these two, many integers, boolean and address are defined such as weight, vote, voteCount, delegate and voted.
One contract per ballot will be created, and the creator will have the power to serve as the Head. Head will have the authority to provide the right to vote to each address separately.
A person associated with the address can select himself, or to any other person, he wants to give his vote. In the end, a proposal with the most significant number of votes will be displayed using winningProposal() function.
Fig.2. Functions defined in Ballot Contract.
Mapping of the address is done following a proposal is made. Functions named as Ballot_, giveRightToVote, delegate are defined, and the logic is written on how these functions will work or what each task will do separately. You can go thru it and will be able to understand the simple logic of the workflow.
Fig.3. Functions winningProposal() and vote()
Function vote() check if the vote given is valid or not and calculates votecount using voteCount and winningProposal() will provide the final output showing who wins the proposal.
Crowdfunding can also be done using contracts and can solve various problems associated with it like a commission of third party, issues related to managing data, etc.
Crowdfunding doesn’t require any centralized system to manage things as smart contracts can workout far away better than non-trusted centralized systems.
Implementation of Blind Auction in solidity is straightforward on ethereum. In this, an open auction will be created in which everyone can make each other’s bid. After that, a blind auction will be designed where it will not be possible for anyone to see the bid until it ends.
Everyone involved in the bid can send bids for the bidding period. Bidders will be bound by the bidding as some money or ether will be included.
There are many other applications also which are a part of Solidity language. I would try to cover them in future blogs.