Skip to content

A prototype of a decentralized voting application on the Ethereum blockchain to classify torrent hashes into different categories.

License

Notifications You must be signed in to change notification settings

Peer-to-Peer-CDN/SmartTorrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartTorrent

A decentralized voting application on the Ethereum blockchain to classify torrent hashes into different categories (e.g. malware and copyrighted).

Contribution information

Overview

The goal of the project is to create an onchain voting application. Since this is a school project, it is only a software draft with limited functionality. For a productive operation, further development and extensive testing would be necessary.
Required components (detailed requirements):

  • Simple frontend (triggers onchain voting and display the results)
  • Contract for onchain voting
  • Second contract which processes the voting result

Technical Overview

  • Contract Language: Solidity
  • Ethereum Provider API: MetaMask
  • Used network: Goerli Testnet
  • Frontend: React
  • Language: JavaScript/TypeScript

System

Technology Decisions

  • The frontend framework React was chosen, because the team was already familiar with it.
  • MetaMask was used to communicate with the blockchain according to the lecturers' suggestion.
  • Solidity is the most commonly used contract language. Therefore, we used it.
  • We used the Goerli Testnet, because it is still supported after the Ethereum transition to proof of stake.

Libraries

The following libraries were used in the project:

  • metamask/detect-provider
  • parse-torrent
  • react-dropzone
  • react-hot-toast

Components

components.png

Voting Process

Possible process of voting with a blacklist entry:

  1. At first, a user needs to connect to his MetaMask account. In case of success, a file drop zone is displayed on the frontend.
  2. The user uploads a .torrent file and the web app extract its info hash.
  3. Now the user has the possibility to vote. He votes for 'Copyrighted'.
    1. The vote is done on the chain.
    2. The voting is evaluated and because the threshold is reached, the hash gets blacklisted.
  4. The user clicks 'get votes', a blacklist lookup is done and the result is returned (in this case 'COPYRIGHTED').
    1. The message Torrent is blacklisted for 'Copyrighted' is displayed.

sequence.png

Possible process of voting without a blacklist entry:

  • Step 1 - 3 will be almost the same as in the previous graphic. The only difference is that the threshold is not reached and therefore the hash does not end up on the blacklist.
  1. The user clicks 'get votes', a blacklist lookup is done and the result is returned (in this case 'NOTLISTED').
    1. The number of votes for 'Malware' is fetched.
    2. The number of votes for 'Copyrighted' is fetched.
    3. The result Votes for Malware: 2 and Votes for Copyrighted: 0 is displayed.

sequence.png

Local Execution on Testnet

  1. Deploy TorrentBlackList.sol to Goerli testnet (owner address needed)
  2. Deploy SmartTorrent.sol to Goerli testnet (blacklist address needed)
  3. Change the contract addresses in your project
  4. npm install in .\frontend\blch-smart-torrent\
  5. npm start in .\frontend\blch-smart-torrent\

Step 1 - 3 can be skipped if the already deployed contracts should be used.

Contract information

The app currently interacts with the following contracts on the Goerli testnet:

About

A prototype of a decentralized voting application on the Ethereum blockchain to classify torrent hashes into different categories.

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •