This project revolves around the efficient use of ERC20 tokens to help users easily rent books and support authors. A deterministic ethereum address is generated through the user's email and a fixed salt, which is essentially a representation of the user's address.
The user can purchase tokens and use these to rent books. These are temporarily stored in one of the contracts to be later redistributed to the author's account. The access to the books gets disabled at the end of the time period because it depends on the bool returned by the smart contract which stores the expiry time.
Link to the presentation - https://drive.google.com/file/d/1e2cowOwUWK4zCf5dHBTPPFehWLE0_EVZ/view?usp=sharing
Presently, books can be uploaded only using the admin portal and the future works will include building an author's dashboard.
The Blockchain Dev
All the smart contracts were deployed using EthVigil along with it's proxy contract feature for added security measure. There is the primary smart contract to which the web app makes write calls using the EthVigil API, to transfer tokens and temporarily hold them before being redirected to the authors. The BookAccess smart contract provides the rental status of the books by calculating and storing the rental expiry time. Through the admin portal, the tokens stored in the primary contract is redirected to the author's account. Additionally, all the e-book PDFs are stored on Sia's Skynet Portal.
The Web App
The login system is built using the auth0-passport strategy which allows user directly to login with their Google account and therefore, there is no hassle of having to remember another password. A deterministic ethereum address is generated using the user's email address and a salt. Users can easily purchase tokens (the production version will include a payment gateway for this purpose) and use these tokens to rent books. All the books are rendered as 'read only' using the PDF.js library and are temporarily cached onto the server and deleted when the user logs out. There are several measures to ensure only the user who has access to the book is able to view it and no one else. There is a transaction log that is maintained along with the EtherScan link for users to view their ethereum transaction details.