A video sharing DApp (distributed application) which uses smart contracts to structure the application's logic, a distributed file store system to share the content between application users, and BTC to incentivize content creation.
Briefly, (because this is a Readme) there are three major pieces to this application. For a more detailed description of the DApp logic please see Andreas' blog post on the topic. For a more detailed description of how we operate the blockchain network please see Casey's blog post on the topic.
This DApp makes use of IPFS to store, share, and distribute video files. IPFS works on the concept of immutable hashes. These are unstructured data in the form of video files.
The logic for the application, which remembers and utilizes immutable hashes stored, shared, and distributed by the IPFS protocol, resides in Eris Industries' erisdb
system, a smart contract enabled, smart contract controlled blockchain.
The view layer for 2gather is an Angular application which is ran in any compatible web browser. The user interface (aka, view layer) makes JS calls back to the Decerver hosted middlewear layer which provides a routing framework, method framework, and connection to both the erisdb
and ipfs
systems.
This DApp is in active development. Here is what we have done and not done.
contracts suitedeployment controller (.pdx)api specificationapi routing frameworkapi methods frameworkapi connections frameworktest suite blockchaincontinuous integration systemfig files for productionfig files for testingbuild prototype view layerconnect prototype view to API endpointsdisplay BTC addresses for ProTipHQ integration- production blockchain
- add a ChangeTip functionality ...?
This distributed application (DApp) is ready for wider beta testing.
Please note, however, that the blockchain it uses may have to be reset from time to time. We do not currently have a backup/export/import functionality for smart contract housed information (yet), so at this time when the blockchain resets all videos are lost and will have to be readded.
In general there are three ways in which to install the 2gather distributed application, an easy way (which we recommend), a medium way, and a hard way.
Dependencies: for the easy installation there are 2 required dependencies: Docker and Docker Compose.
Docker is a run anywhere container solution which we feel makes development, deployment, testing, and running of distributed applications a breeze. We are moving most of our development, testing, and usage efforts for Eris Industries to use a container-based paradigm. Given the complexity of getting p2p software running, Docker containers provide an excellent mechanism for handling the building and running of distributed applications.
Docker Compose (recently renamed from the fig
tool which was purchased by Docker last year) is a way to compose groups of containers and makes running those containers ultra simple. The first time you docker-compose up
it will take a while to download and configure the base images. After that it will be ultra fast due to Docker's intelligent caching features.
Install Docker. Install instructions will vary by platform. NOTE Eris Industries requires a docker version >= 1.4 to work properly. We highly recommend that you install docker version 1.5.
Ubuntu:
$ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
64 bit Linux && OSX:
$ curl -L https://github.com/docker/compose/releases/download/1.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
$ chmod +x /usr/local/bin/docker-compose
If you run into problems on linux, execute the curl
command from a sudo shell.
Make sure Docker is installed properly:
$ (sudo) docker version
Alternatively:
$ (sudo) pip install -U docker-compose
Go Vroom: Once you have Docker and Docker-Compose installed the rest is ultra simple.
First clone this repository:
$ git clone https://github.com/eris-ltd/2gather
$ cd 2gather
$ (sudo) docker-compose -f docker-compose-get.yml up
N.B. If you do not have git
installed and do not want to install it, then you can simply copy and paste the contents of this file into a docker-compose.yml
file in any directory and then start the DApp with:
$ (sudo) docker-compose up
Whichever command sequence you use, you should now have the DApp running in your terminal window. After that simply go to any web browser to play with 2gather.
Dependencies: this method requires Docker and Docker-Compose to be installed (please see above for installation instructions). Once those are installed then clone this repository:
git clone [email protected]:eris-ltd/2gather.git
cd 2gather
Next, you'll need to install the front end dependencies. We use the Bower package manager to manage our front end dependencies. Note that Bower is a Node.js program and Bower depends on Node.
bower install
Go Vroom: At this point there are two possible compositions of the containers which you can use. The composition we suggest starting with is the testing containers which will deploy your own chain locally along with all of the contracts required for the DApp and allow you to begin operating the DApp on a local chain.
(sudo) docker-compose -f spec/docker-compose.yml up
The second way you could work is to link into the public testing chain which we use. Note, the production blockchain will be released when we have finalized the testing cycle. See the Status
section above. To work with the public test chain
(sudo) docker-compose up
Note that depending on your system setup sudo
command may or may not be necessary.
Note that when using the testing composition with the -f spec/docker-compose.yml
flag, you will want to wait about 60 seconds after the containers boot before working with the API. This is to allow the chain to be established and the contracts to be deployed.
NOTE: When using containers, the keys do not persist. In addition, the usernames are tied to a public key address. So if you use a container and then restart the container you will get a new key so you will have to reregister with a new username unless you deleted your old username before exiting the containers before -- as only one username is allowed per chain and each username is tied to a public key address.
The containers are for rapid prototyping and testing and so we do not see this as a problem as it is using containers how they should be used. We are working toward moving keys as close as possible to the user (ideally, in the browser), but that work will be ongoing for quite some time.
If you wish to persist your username then you will have to use the High Difficulty Installation below or export a volume which contains the keys (the latter of which we'd love any bug reports on).
While we highly encourage folks to begin using a container based system for working with distributed applications, we understand that not everyone will want to do that.
2gather works just as well outside of containers.
Follow our Go VROOM Guide Here.
Follow IPFS's Guide Here.
You'll need to install the front end dependencies as well. We use the Bower package manager to manage our front end dependencies. Note that Bower is a Node.js program and Bower depends on Node.
You will also need the jq
program installed.
On Ubuntu:
sudo apt-get install jq
On OSX:
brew install jq
For other systems see the JQ download page.
Clone this repository into your ~/.decerver/dapps
folder:
git clone [email protected]:eris-ltd/2gather.git ~/.decerver/dapps/2gather
cd ~/.decerver/dapps/2gather
Install the front end dependencies:
bower install
Make sure that an IPFS gateway is running and is write accessible on port 8080.
ipfs daemon -writable
Note that IPFS daemon command will block in a terminal, so you will need to run it in a separate terminal window.
If you would like a chain for testing, then execute the spec/teststart.sh
file. That will establish a new chain with proper configuration for local testing.
If you would like to connect to the public test chain then execute the ./start.sh
file.
When the DApp is running, open http://localhost:3000/2gather/ in a browser.
GPL. See LICENSE.txt file.
We are happy to accept contributions to this template distributed applications with the proviso that any and all contributions will be licensed GPL by Eris Industries.
Even better than contributions to this template, please press the big FORK button at the top and make the DApp your own. Do cool shit with it.
Run it on your own chain. Connect with your own community. And most importantly HAVE FUN!
Enjoy DApp-ing! :)