Prototype for discussion only - as part of the overarching T2115 and T2017 tasks.
Frontend
- new Social screen added to house the social media functions and public social feed
- clicking on the Portrait next to the wallet name in the header opens an identity management drawer where the user can set their name, twitter handles...etc. Proposing for these to be stored offchain.
- the 'Follow/Add to contacts' function will route the user to the upcoming Address Book/Contact List function in T2080, which will reside in the upcoming Advanced Tooling screen in D10758
- emoji libraries are resource heavy but are quintessential to the social experience, we'll swap in a lighter version post prototype
- Tipping in XEC and eTokens will leverage the existing sending UIs.
- posts with dislikes over a certain threshold is hidden automatically
- posts with likes over a certain threshold makes it into the 'Top' social feed
- potential routing from the upcoming NFT screens (D10667) to the Social screen to enable embedding NFTs into social posts
Backend
- proposed for a single address to be the central feed repository that social posts will be sent to in the form of OP_RETURN messages. The social feed will then query all inbound messages with the social prefix.
- cashtab social prefix hex (73746162) to be embedded into outputs when posting to the central feed address
- new sendSocialPost() created in useBCH.js which sends the post via OP_RETURN to the designated onchain message repository
- new retrieveSocialFeed() to be added to useBCH.js which specifically retrieves the social feed based on the social feed mode selected (either latest posts, top posts, replies or own posts)
- existing parseOpReturn() in cashMethods.js updated to recognize messages prefixed with 73746162. Further customized labelling in TxHistory will need to be made to both Tx.js and parseTxData() in useBCH.js
- to facilitate tracking of replies, we'll need to embed the tx hash of the parent post as an additional prefix hex into the OP_RETURN output i.e. [OPRETURN]-[Cashtab Social]-[Parent hash]
Key considerations:
- I avoided leveraging the existing sendXec() function in useBCH.js to post the social content because it would bloat the function too much and make it hard for new cashtab devs to understand the mvp sending mechanics
- will need to mitigate people spamming the feed, potentially rate limit users to only be able to post x amount of messages within a time period
- performance implications for Cashtab as a whole from refreshing the public feed
- may need a separate server to host media uploaded in each post or simply render media urls hosted elsewhere or integrate with IPFS
Potential phased release:
- MVP with ability to embed media into posts and basic offchain identity management
- 'Like/Dislike' tracking and integration with T2080 Address Book function for 'Follow/Add to contacts' links
- XEC/eToken Tipping
- update NFT section to enable users to 'Set NFT as social profile'
- Social post categories (e.g. General, Dev, Price) as an initial social landing page
- Integrate with future ENS-like namespace solution for identity management
- IPFS integration for trustless media hosting
- Integrate with Wechat / WhatsApp APIs
@johnkuney FYI re: T2183