Demo video: https://youtu.be/P1rUBsEHTM4
It has 2 contracts:
- SafeMail(sol): through which users can send message via contract events.
- Stake(sol): When user sends a mail, their 1 MAIL token is locked in Stake contract.
Receiver can [reportSpam](https://github.com/blockdeveth/stake_mail/blob/main/contracts/SafeMail.sol#L75)
the mail, and Kleros court will take a decision.
If the mail is judged to be spam, then sender's 1 MAIL token is sent from Stake contract to receiver, otherwise, it is returned to sender.
Contracts are deployed on Kovan:
- SafeMail: https://kovan.etherscan.io/address/0x84373A4b2D2E3349C68C0d5B244A729cB370D9fa
- Stake: https://kovan.etherscan.io/address/0x100159abe1968490dF780cFf4C7F14c0Bbe24C16#writeContract
- Centralized Arbitrator: https://kovan.etherscan.io/address/0x4d733181b675bb56de1b516fc6cbf0015c7cf1f1
- Start a local server:
yarn react-app:start
- It shows the interface to send a mail.
- After sending the mail, get the mailId from the kovan events page.
-
Using the mailId, report it from the interface, and head over to https://centralizedarbitrator.kleros.io/
-
Use
0x4d733181b675bb56de1b516fc6cbf0015c7cf1f1
as the Arbitrator (or deploy your own and add the new address in this code).
-
It will load all the current disputes.
-
You can vote and check the subsequent balance of sender and receiver based on your vote.
- There is no privacy in the mechanism. All the mails can be seen by anyone. Use private and public key encryption.
- Add a timeout so that receiver can report a mail within a day of receiving it.
The app was bootstrapped from create-eth-app, and Kleros documentation.