Coder Social home page Coder Social logo

swarm-dapps's Introduction

Swarm Đapp Examples

In this repository, you find the source code for distributed applications (so-called đapps), the primary purpose of which is to demonstrate the use of Swarm's API and the most useful patterns of developing such applications.

examples/album

A photo album dapp with a set of public-domain photographs that lets users upload their own photos. The code is based on fgallery version 1.7. All chenges in the gallery are accompanied by a change in the root hash of the album. Sharing or registering the root hash corresponds to sharing and/or publishing a particular state of the photo album. This is an example of non-interactive content dissemination, with no feedback from the audience.

examples/filemanager

This is a GUI explorer for file collections hosted on swarm. An example of a tool for working on file collections other than itself. The root hash of the explorer remains the same (or changes with upgrades); the root hash of the explored collection is appended as a fragment to the URI. Of course, it can be used to explore itself.

examples/ens-updater

This is a GUI tool for updating ENS domain with SWARM hash.

examples/bzzhandler.html

This html installs http protocol handlers for bzz, bzzi and bzzr protocols.

You can either upload each example into Swarm and run it from there or run a proxy server (see below)

Running via proxy server

npm install live-server

Now run ./start-proxy <folder>. For example, to run the filemanager:

./start-proxy ./examples/filemanager

swarm-dapps's People

Contributors

aquiladev avatar hiddentao avatar igorshadurin avatar nagydani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swarm-dapps's Issues

markdown-editor needs better default behaviour

markdown-editor.eth gives an error message when it is loaded without a markdown document as an extra argument to the URL.

It should either pop-up a text input field asking for a markdown-document (just like swarm-explorer.eth does) or it should load a simple basic default markdown document - possible with usage info / docs.

Photoalbum - images added in reverse order

When I add an image to the photoalbum, it will be added above the current image. It would be better if it were added after.

Why do I think it would be better the other way?
When I use the album as a slideshow for example and I add a bulk of slides at once, they are all added in reverse order. To work around this, I'd upload the last slide manually then move it to the bottom and then click to add more slide; I'd sort them in reverse order in my file manager and then click to add.

ENS Updater app to support EIP 1577

Any name in ENS that is set up using the 'default public resolver' (using manager.ens.domains, or manager-beta.ens.domains for example) will now be using a new resolver that conforms to EIP 1577.

https://eips.ethereum.org/EIPS/eip-1577

As such, the content field has changed to contenthash and the ens-updater app no longer works with this resolver.

The app should be updated to check what the resolver supports and act accordingly.

Getting 400 (Bad Request) when accessing filemanager

I'm trying to get the filemanager running. Here is how I setup Swarm:

  • I run swarm init 1
  • I then use bzz.upload() to upload the filemanager source folder and set index.html as the default file.
  • I then access http://localhost:32200/bzz:/<filemanager_item_hash>

The page loads with some UI, but In the JS console I get:

angular.js:11821 GET http://localhost:32200/bzzr:/ 400 (Bad Request)

Error: Cannot find module 'live-server'

Ok so I do:
npm install -g live-server
then cd into the directory and do:
node start-proxy /examples/filemanager

(I assume you run start-proxy as a node server?)

Missing error handling on json directory upload

The function body at
https://github.com/ethereum/swarm-dapps/blob/master/examples/album/file-manager.js#L104
does not handle errors and assigns i with the http response even if the status is different from 200 and the response is not a hash. A sanity check similar to
https://github.com/ethereum/swarm-dapps/blob/master/examples/album/file-manager.js#L22
would probably do the trick. In fact, it would be nice to have a common code for PUT-ting a file and then receiving and checking a hash.

PSS CHAT -- Swarm Demo App

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.

is this obsolete?

situation

  • this unarchived repo contains obsolete stuff

ultimate goal

less confusion for people who stumble upon this

proposed/possible actions

  • transfer ownership, so that it's next to the current Bee implementation
  • update this repo to use the latest Swarm implementation
  • mark it as obsolete
  • update the readme to explain the current situation

markdown-editor: Edit link needs to be visible at the top / in header

When opening a markdown file with the markdown-editor, the edit link is hidden waaaay at the bottom.
see here for example:
http://swarm-gateways.net/bzz:/markdown-editor.eth/#2d4b1a052b1b32dd0764c17120c769aa932c1a36879207b5247619f711c9d47e

I argue that the edit link should be at the top... Maybe there should even be a header With "New" "Open" "Edit" and "Help" links.

New - opens an empty markdown document
Open - opens a new (swarm-hosted) markdown document
Edit - starts the editor
Help - opens the documentation (another markdown document)

perhaps there could also be an option to open a local markdown file and upload it to swarm?

Photoalbum - should be possible to delete all photos

It should be possible to delete the last photo in an album so as to have an 'empty' album to start with.

Currently, to make a new album, one must select an old album, delete all but one of the images, add one of your own and then delete the last one from before.

If we could have an empty album, we'd host it at new.photoalbum.eth and have the be the starting point for anyone wishing to create their own album

Error: connect ECONNREFUSED 127.0.0.1:32200

I get this error in the console:
angular.js:11821 GET http://localhost:8888/bzzr:/ 500 (Internal Server Error)

and this in the servers console:
Error: connect ECONNREFUSED 127.0.0.1:32200
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect as oncomplete

bzzhandler.html does not work

I have tried loading it in chromium and and chrome it has no effect.

In fact bzz:// is not recognised as a protocol at all and all that happens is that a google search result comes up for "bzz://blablabla"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.