Skip to content

jayantdahiya/AnonNews

Repository files navigation

Logo

AnonNews

A decentralised news platform
anon-news.web.app »


AnonNews_Landing.webm

AnonNews is a platform build using the decentralised web technology which helps this application to be censorship free. This application will let users post news and a media related to that news on the blockchain. While other users can vote these news posts, based on the number of votes the news with the maximum number of votes is shown first.

NOTE: AnonNews is under active development, most of the listed features are still experimental and subject to change.

Motivation

The main motivation behind this project is to remove under the table business of news platforms that are controlled by the big firms. This has made news a profit making business, which I think is a basic human right to get/know the correct and censor free news about the world.

Architecture

  • /news:
    • The frontend requests allNews() from the smart contract on Alchemy Polygon Mumbai chain.
    • The array of allNews() is of the following structure:
      {
         "author" : "<public_address_of_author>",
         "id": "<id_of_news>",
         "media": "<IPFS_link_of_news>",
         "timestamp": "<news_timestamp>",
         "votes": "<total_votes>"
       }
    • Now the frontend fetches news metadata from Infura IPFS from url news(media) and the following response is fetched:
      {
         "heading": "<heading_of_news>",
         "body": "<body_of_news>",
         "imageUrl": "<IPFS_link_of_image>"
       }
    • The response(imageUrl) payload is used to fetch the image from IPFS.
    • The final array of news() used to display all news:
    [ 0: {
      "author": ...,
      "content": ...,
      "heading": ...,
      "id": ...,
      "image": ...,
      "timestamp": ...,
      "votes": ...,
      },
      ...
     ]

PostNews


  • /post
    • Users enters heading, content and media for the news post.
    • The post(media) is uploaded to IPFS and the mediaUrl is returned.
    • The metadata of the news looks something like this:
    { 
       "heading": "<news_headline>",
       "body": "<news_content>",
       "image": "<mediaUrl_from_IPFS>"
    }
    • Now the above payload is uploaded to the IPFS storage which finally gives us the newsUrl.
    • newsUrl is now written on the smart contract with function post(newsUrl).

HowToVote.webm

  • /vote
    • To vote the news(id) is passed to the vote function
    • The voteFunction then interacts with the smart contract and triggers the voteNews() function
    • voteNews() takes news[id] as param and increaments the votes of the post[id] on the smart contract.

How to use

Note: This project is currently on the Polygon Mumbai Testnet

  • The user would need a metamask wallet (recommended) to access the web app. You can head over to this link and download the extension for your browser.
  • Create a new account on the metamask wallet. And add Polygon Mumbai chain to your wallet.

  • Copy your public address from your wallet and add some test MATIC to it by heading over to this link . Just paste your public address and you'll be good to go.
  • Posting a post in this web app will require an ethereum transaction as well as voting a post.
  • User can also upload a media (image) with their posts.

Use the web app wisely :)