Sign in
Log inSign up
D - Mail  #VercelHashnode

D - Mail #VercelHashnode

Yatharth Arora's photo
Yatharth Arora
·Feb 6, 2021·

10 min read

1*L5ApbOvu0Pf-oRXFYd3vkA.png

Decentralization defeats Deplatforming

Mexico, Germany, France and countries around the world have expressed concern over the deplatforming of a sitting US president and his followers by a collection of American tech companies, India should prioritize national support for decentralized platforms like Ethereum to create social networks and messaging apps that US corporations can’t shut down. Part of the solution can also be national replacements for Twitter, but non-Indians won't be on Indian Twitter, and India will still need to get messages out to the world on neutral international platforms. That's what crypto permits.

Note that the risk of political deplatforming is not theoretical. Once you’ve banned the “most powerful man in the world”, it’s no big deal to ban anyone else. Every day brings another headline to this effect. Recall too (a) that the US already once banned then- Chief Minister Modi’s physical entry for many years and (b) that millions of people in India are currently dependent on American apps like Twitter, WhatsApp, Facebook, Gmail, PayPal, and Google Pay. Given sufficient negative press, American technology companies may ban Prime Minister Modi and his followers not just from entering the US, but from much of the internet itself. And not just from communicating over the internet, but from sending and receiving payments over US-controlled platforms like SWIFT, PayPal, or Google PayPal. Digital hostilities may commence with little warning.

The need of the hour is to develop decentralized platforms which treat every user as the root user and no one can deplatformise someone else with some contrasting views. Recently WhatsApp was accused of breaching the privacy and using the data of their users for monetizing and other undeclared uses. The users were forced to accept the new terms and conditions or otherwise find some other platform for messaging. The way WhatsApp has become a part of us today it is difficult to switch to something new, and this is what gives the Facebook owned WhatsApp an added advantage.

D-Mail solves both of the above problems. This decentralized email application is a prototype of how a messaging system would work on a blockchain. No human power on this planet can block your account/address from the chain. You have the power to do what you want on the internet. Neither can somebody else keep a check on your messages unless you give them your address and the password you are using for sending and receiving emails. As Naval Ravikant once said in one of his podcasts - "We are not far from the day when you will find my views on a pointer to Blockchain. And no one can block/remove that pointer" The future is decentralised, be it finance (DeFi) or social media.

Implementation

  1. To send and receive an e-mail, one needs to install and set up Metamask extension in their chrome browser.
  2. Each user while setting up the Metamask will get a unique key phrase that has to be kept private and is not to be shared with anyone else.
  3. After you set up the password and save that key phrase somewhere where it is inaccessible to others, you will get an account address.
  4. This is the address that you will use for communicating with others on the blockchain.
  5. Only the person who has access to your key phrase and your password can send and receive emails on your specific address.
  6. So this unique key phrase makes the system secure without any need of registering on the platform.
  7. Since it's an Ethereum blockchain, every user is a root user and no one else can check the messages you send and receive without accessing your Metamask address and password.

Technicalities

-> What is a smart contract? The core of any Dapp is the smart contract written in Solidity and runs on the blockchain. In layman terms it is an automated account that runs on the blockchain and once deployed cannot be changed.

-> What is Solidity? Solidity is an Object oriented programming language and is widely used in writing smart contracts.

-> How should we write a Smart Contract? The first statement of a solidity code always specifies the version of the solidity compiler. The solidity code is a collection of contracts that will be deployed on the blockchain. Consider the following part of the solidity code used in our Dapp -

Pragma solidity 0.4.25 //Solidity compiler version Contract Test {
//Contract name is Test struct Text{ address sender; string subject; string body; }

mapping (address g Text[]) public text; }

Here Text is a structure that contains three fields namely sender (data type is 'address'), subject & body(with data type 'string'). Next we have a mapping of type address g Text[]. Mapping is one of the unique and useful features of solidity. Mapping serves as a key value pair data structure. Here text variable of mapping stores an array of Struct at a specific address. For example, suppose the address is 0k45AE67, then text[0k45AE67l.push(Text(address,subject,body) will push the data in the form of an array and store it with a key = 0k45AE67. The public keyword makes the contract variables accessible to the other contracts. Once the smart contract has been written, it is deployed onto the blockchain and its ABI is used to access functions from the contract and integrate it with front end to make the communication with the blockchain easier for the end user. Now the compiled code is integrated with Next.js and Web3 to make it easier for the user to interact.

-> What is Web3? Web2 revolutionised the World order and the Economy by bringing people who want to deliver a service and people who want to consume, together. However there is always a middlemen in Web2 and hence the lack of trust. Web3 solves this problem. Web2 revolutionised the frontend by making it more interactive and user friendly whereas with the introduction of Web3, the frontend doesn't change much, it deals with the backend, the data architecture as to how the data is stored at the backend. Web3 's consensus protocol is designed in such a way that it is next to impossible to hack a node and get access to data. Web3 enables users to control data privacy and data ownership instead of the intermediary third party.

MetaMask

MetaMask is a cryptocurrency wallet but also a web browser extension used to store, send and receive Ethereum and ERC20 tokens. In other words, setting up MetaMask account is a mandatory step to send and receive emails. The address of your MetaMask account is your identity on the DnMail. The person who has access to your highly secured MetaMask key-phrase can access your Mails. MetaMask extension can easily be added on the chrome browser. (The steps for the same are also given on the deployed site)

Project Screenshots

Screenshot 2021-02-05 at 5.49.30 PM.png

Screenshot 2021-02-05 at 5.49.41 PM.png

Screenshot 2021-02-06 at 11.24.42 AM.png

Check out the code for your better understanding Gihub

Contact me on Twitter

Send me a decentralised email via D-mail at the address {0x4762551964D4a557c24F5826c1b1CCd551080adE}

Working Project Video

Challenges

Emails usually involve sending attachment files/photos, but storing them on a blockchain is not possible because of the storage issues. Hence for sending files via the messaging Dapp we make use of the Interplanetary File System(IPFS). If one wishes to send a file, he/she shall upload the file and carefully copy the link that is returned after uploading in the email body. Another challenge is of the response time. Communicating with blockchain often takes some time since it solves a cryptographic puzzle to find a nonce value that adds the block to the chain. This is a problem of scalability, Blockchain has always had a problem with scalability.