## Big Bang - First Level Details
[TOC]
*Example mermaid diagram* - see https://mermaid-js.github.io/mermaid/#/sequenceDiagram
### References
Business requirements: https://hackmd.io/@plur9/Sk34fadmd
GetLogin smart contracts: https://github.com/GetLoginEth/login/tree/master/src/smart/contracts
User movement: https://lucid.app/lucidchart/invitations/accept/3859fb08-6b79-4015-892f-970868f50826?viewport_loc=-750%2C-27%2C4272%2C2181%2C0_0
Workflows: https://hackmd.io/82OaCq1bSO-gfXBlBICBFw?view
### Phase 1: Use Case Explosion
**Legend**
+1 must have for v1 (MUST HAVE)
+2 next iteration (SHOULD HAVE)
+3 sometime after (NICE TO HAVE)
**TODO next steps:**
- more detailed user stories for +1 phase
- credit system
- invite system : Igor
- UI (Fairdrive) : Igor (screen drafts, diagramme)
- Storage (FairOS) : Zahoor (diagramme)
- smart contracts : Zahoor, Igor (diagramme)
**Goal: To capture leads; give early user access.**
Real launch of Fairdrive will be with Swarm 1.0 - people can start using it.
No guarantees for persistence before that.
A BIG DISCLAIMER , you can loose your data.
Promise of postage stamps / tokens (1BZZ) when Swarm launches.
- --------------------------
#### Version 0.1 (Testnet version for May 15th)
- Invitation Management
- Initial Invitation system (1 Million capacity)
- Generate invites URL to send via email
- These should not have gas costs associated (from the user perspective)
- Save gas cost
- only clicked accounts should be funded (not funding stale accounts, not answered invites)
- create a ephemiral account only when clicked etc.
- User should be able send some X number of invites for free (X = 5)
- User Management
- Create user
- a wizard, frienly & simple UI; generate password(?)
- using the invite
- Login user
- login with the created user;
- username + password is the method(?);
- Logout user
- Pod Management
- Create a default logical drive (call it Home)
- Create directory
- Delete directory
- Upload file
- Download file
- Browse file system (fairdrive pod and other pods, created by apps)
- as simple as browsing a normal file system
- Share file to another user (read only) Using friends public key as input
- Show all drives in the system (so that user can see app data too)
- Storage Credits
- First on Goerli
- Feature of storage (and bandwidth) credits (free)
- smart contracts & infra
- storage (postage stamps)
- bandwidth (BZZ; upload & download counts)
- Show storage (and bandwidth) credits (remaining credit)
- Account for storage credit (X credit per Gb per unit of time)
- unit of time: day? month?
- how to account for spent bandwidth
#### Version 0.2 (Mainnet version - possibly L2 based, Along with Swarm 1.0)
- Inviation management (UI)
- tracking who accepted
- friends appear on contact list
- Pod Management
- File upoad / download by drag & drop
- File browser with details (detailed view etc..)
- Share file to contacts / freiends
- contacts/friend management page OR contacts Dapp later
- how to show shared files in UI (special folder for each contact?)
- Create a logical drive ( a user created pod)
- one called Fairdrive by default
- but want to create e.g. Music drive
- every app should have its own drive (at this stage, later it will be permissions)
- A public pod belonging to FDS "mounted" in Fairdrive by default
- contains instructions, communication, etc.
- Storage Management
- Move contracts on Mainnet
- Add storage (and bandwidth) credit (topup storage credit)
- Wizard: explaining postage stamps, invite system, how to get storage, etc.
#### Version 0.3
- NFT Gamification
- generate NFTs for files in storage
- put in special folder
- View NFTs stored in Fairdrive (a Dapp?)
- User Management
- delete user
- Invitation management
- extra invites to send (payable)
- when invites used, alice gets reward (postage stamps, bzz)
- File Management
- Unshare file
- Pod Management
- Export pod as public
- Import a public pod and access data as read only
- App Management
- Add app
- Enter app url / contract / swarm url / public key
- Show all installed Apps
- Other Apps shold be able to login using single sign on
- A JS library for others to use (Fairdrive connect)
- Give permission to app to use data
- Search other Apps and installing (marketplace / registry)
Q1: What format does the campaign requires?
Q2: How much are we willing to spend on gas costs?
Q3: How much storage are we willing to give out for free & how much time?
in that regard ...
v0.1
- app management can be launched later, when we have apps
what to give to Linum lab devs? we should give them:
- UI & APIs parts
- file browser in Fairdrive
what do we need from the JS team if anything? Fairdrive engine maybe?
- security aspect consultation - Zahoor will speak Attila, will set up a meeting
- connect on the app management side maybe
- connect on the idea of FD engine?
how to get the contacts? how much gas costs?
- should use gETH
- emails or other contacts
**FINISH BY THE END OF APRIL, CAN CUT DOWN ON FEATURES.** after that, testing
### Phase 2: Component vise breakup
#### FairOS
- User (create / delete / login / logout/ invite)
- Pod (create / delete / open / close / share / import / sync/ stat)
- Directory (mkdir / rmdir / list)
- File (upload / download / share / import / stat)
- Wallet (create / topup / withdraw / info)
- App (add / show/ info)
- Login using smart contract version
#### UI
- Onboarding Wizard (create user and explain about fairdrive)
- Login / Logout screen
- Dir (create / remove)
- File (upload / download / recursive upload / share / import)
- Pod ( create / show / remove/ browse / share / import)
- Wallet (show credits / topup & withdraw workflow screens)
- App (add / show all )
#### Smart Contract
- User (username -> feed Reference)
- User mnemonic (encrypted)
- Store attached Swarm PSS id
- Store users friends related details
- Functionality
* Create user wallet contract
* Send invite and create user from invite
* Get Session token ( Login App, can be Fairdrive or any other app)
* Add App (make an app available to the user )
* social recovery ( later)
* permissions (later)
- Wallet (which has the user credits / bzz)
- Attached to a particular user (1 wallet per user)
- Prefund with some free credits
- Functionality
- Should be able to topup (transfer bzz)
- Withdraw credits (withdraw bzz incase if it more)
- Auto debit every unit of time (X credits per Gb of data used)
- App (appname -> app information, created once for every app by the developer)
- App name
- App Icon
- App pod name
- Tables used by app & their schema
#### Fairdrive connect - allows (other) apps to connect
### Hurdles / needs clarification
To be tackled at later stage, but pu down now already:
- invites via Getlogin expensive (from 2,2M$ to least 70k$)
- how to secure the storage that we offer for free
- how to secure the bandwidth that we offer for free
- --------------------------
### User stories
#### Smart Contract
1) Smart contract design (functionality, APIs, events)
2) User contract
- Add user (userHash <-> Swarm Reference)
- Remove user (delete userHash)
- GetInfoForUser (take userHash and return swarm reference)
3) Invitation contract
- ???
4) Wallet contract
- Fund Wallet
- Deduct credits
- Add credits
#### FairOS
1) Freeze APIs for fairdrive
* New APIs (wallet, invitation etc.)
* Old API (GET should not have body)
* Get rid of cookies
* remove unnecessary API like contacts
* Make API short and crisp
2) Pod & FS alignment (finish refactoring)
* Dir & Pod refactoring
* add testcases and improve coverage
* Use signer instead of accounts
4) Login/signup (gateway mode)
* have gateway mode to run fairOS as gateways
* normal mode should not have login comlexities
* Use contract information to get userHash and get info from Swarm
* During signup add the info to the contract
6) Invitation
* call contract to generate invite
* create a url for invite
* process invite and call contract to fund new account
8) Wallet functions
* call contract to create wallet
* fund wallet
* get bandwidth and storage creadit for display