PSS Chat App
Context:
We are hosting several demo applications on Swarm including:
The Photocalbum https://swarm-gateways.net/bzz:/example.photoalbum.eth/
The ENS updater https://swarm-gateways.net/bzz:/swarm-ens.eth/
The Swarm File Manager https://swarm-gateways.net/bzz:/swarm-explorer.eth/
and more (see swarmapps.eth)
There are some new features of Swarm 0.3.x that we wish to showcase.
Goal 1: A simple demo chat dapp using Swarm PSS
Swarm 0.3.x contains the PSS communications protocol. It is documented here:
https://swarm-guide.readthedocs.io/en/latest/pss.html
https://swarm-guide.readthedocs.io/en/latest/apireference.html#pss
We would like a decentralised (Swarm hosted) application that leverages PSS messages for a simple chat application.
For goal 1, this application must allow a user to add another user's PSS address and then engage in a back-and-forth irc-style chat.
Bonus: Allow sharing of images
Adding an image to the chat, should perform an (encrypted?) swarm upload of the image and share the hash with the chat peers - so that they can download the images from swarm and inline them in the chats.
Goal 2: Named chat contacts
The Ethereum Name Service (ENS) allows us to have payment addresses and content hashes assigned to names. For example, theswarm.eth currently has d1de9994b4d039f6548d191eb26786769f580809256b4685ef316805265ea162 registered as the content hash and 0x3df7ce6b04663bb6f625bab474543d2e43aaaa44 as the payment address.
Under the hood, what the ENS does is to assign a special 'resolver' contract to the name. The currently used default resolver has fields for 'address' and 'content'.
See also: http://docs.ens.domains/en/latest/
There are discussions on changing the behaviour of the default resolver specifically to accomodate more diverse content hashes (such as IPFS multihash) alongside Swarm. (example: https://eips.ethereum.org/EIPS/eip-1062 or ethereum/EIPs#1577). In the medium term we would like to contribute Swarm related improvement suggestions to the ENS ourselves.
However, goal 2 of this project is simply to experiment with custom resolver contracts on the testnet. Try a resolver that allows users to add a PSS address to their ENS name and adapt the chat dapp to be able to find chat peers by name.
Be aware of the security imlications of forward vs backward lookups. [Nobody can stop me registering your PSS address at my name].
Goal 3: Feeds and Avatars
Another new feature in Swarm 0.3.x is that of feeds, allowing mutable content to be accessed at a static address.
Goal 3 is to experiment further by extending the ENS resolver and the chat dapp to enable users to create a profile (avatar, name, bio) that is updatable as a Swarm feed, and have the hash of that feed registered in the Resolver.
Bonus: use functionality from the swarm-ens.eth demo app to implement a "save profile" button in the chat app.
Bonus 2: Allow user-to-user payments to be initiated from the chat using the 'address' field of the resolver contracts as payment addresses.