├── DNN.ipynb ├── Module_guide.md └── README.md /DNN.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Decentralized News Network\n", 8 | "\n", 9 | "#### A community-run news network backed by incentives for individuals to create, review, and consume news. \n", 10 | "\n", 11 | "![alt text](https://cdn-images-1.medium.com/max/1600/1*Zt_i6N8kLy7usmHHbzBgtA.png \"Logo Title Text 1\")\n", 12 | "\n", 13 | "## Why?\n", 14 | "\n", 15 | "![alt text](http://www.evansincorporated.com/wp-content/uploads/Centralize-Grid1.jpg \"Logo Title Text 1\")\n", 16 | "\n", 17 | "- In 1983, 90 percent of the U.S. news industry was owned and controlled by 50 different\n", 18 | "companies. \n", 19 | "- Thirty-four years later, 90 percent of American news coverag flows from just six media conglomerates\n", 20 | "- This affects how well the public perceives current events, due to a high degree of confirmation bias that veers toward groupthink.\n", 21 | "\n", 22 | "## What is it?\n", 23 | "\n", 24 | "![alt text](https://i.redd.it/92afmqjtw1rz.jpg \"Logo Title Text 1\")\n", 25 | "\n", 26 | "- DNN is a news platform that combines news creation with decentralized networks as a means to delivering factual content, curated by a community of readers, writers, and reviewers.\n", 27 | "- DNN's stack consists of Ethereum, IPFS, and ZeroNet.\n", 28 | "- DNN removes the need for advertisers because the platform will not source revenue from display ads. It uses its own token as a revenue model. \n", 29 | "- DNN’s system works to incentivize writers and reviewers, in a self-sustaining and autonomous environment\n", 30 | "- Compensation is derived from the community’s engagement, rather than external revenue streams such as native ads. \n", 31 | "- Open Source, transparent money, contributor c ontrolled environment, \n", 32 | "- By persisting the contents of published articles to IPFS, and making references to these articles directly in ethereum smart contracts, they can ensure that every article is as immutable and everlasting as the ethereum network\n", 33 | "- The blockchain decentralizes authority to publish content on DNN. \n", 34 | "- There is no single source that controls the message and feel of published works,\n", 35 | "- DNN is not tethered to any special interests or political agendas, nor is it vying for a substantial chunk of ad revenue, which puts it in a category separate from most publications that are tied down to a bigger entity.\n", 36 | "\n", 37 | "### Whats the stack? \n", 38 | "\n", 39 | "![alt text](https://ip.bitcointalk.org/?u=http%3A%2F%2Fi.imgur.com%2FTyllvER.jpg&t=587&c=xDQ_yqvBKIGO_Q \"Logo Title Text 1\")\n", 40 | "\n", 41 | "DNN uses Ethereum contracts, IPFS (in the long run Swarm or Filecoin), and ZeroNet.\n", 42 | "\n", 43 | "#### Ethereum (Consensus layer)\n", 44 | "\n", 45 | "\n", 46 | "```bash\n", 47 | "DNN.constants = {};\n", 48 | "DNN.constants.token = {\n", 49 | " name: \"DNN\",\n", 50 | " symbol: \"DNN\",\n", 51 | " denomination: 1000,\n", 52 | " faucetaddress: \"0x4cc65D82d4d66b1305EAaA2a62909bd07833f85E\"\n", 53 | "};\n", 54 | "\n", 55 | "```\n", 56 | "\n", 57 | "- Uses contracts written in solidity to verify written articles and process payouts\n", 58 | "\n", 59 | "\n", 60 | "#### The InterPlanetary File System (IPFS)\n", 61 | "\n", 62 | "```bash\n", 63 | " DNN.Request.get(IPFS.config.gateway+DNN.User.session.user.photo)\n", 64 | " .then(function(data) {\n", 65 | " content.find(\".image\").css(\"background-image\", \"url(\"+data+\")\");\n", 66 | " });\n", 67 | "```\n", 68 | "\n", 69 | "![alt text](https://cdn.hackaday.io/images/5211791461026701572.png \"Logo Title Text 1\")\n", 70 | "\n", 71 | "- Articles are stored in IPFS (Decentralized file store)\n", 72 | "- Only a reference to the article is put away inside Ethereum (i.e. an IPFS hash pointer to the article).\n", 73 | "- So the hash pointer utilized for the article will be a reference to its total substance in IPFS.\n", 74 | "\n", 75 | "#### ZeroNet\n", 76 | "\n", 77 | "![alt text](https://1re4xlezju-flywheel.netdna-ssl.com/wp-content/uploads/2016/06/screenshot-127.0.0.1-43110-2016-06-02-12-14-40-1170x585.png \"Logo Title Text 1\")\n", 78 | "\n", 79 | "- ZeroNet is a decentralized web-like network of peer-to-peer users. \n", 80 | "- Instead of having an IP address, sites are identified by a public key (specifically a bitcoin address).\n", 81 | "- The private key allows the owner of a site to sign and publish change, which propagate through the network. \n", 82 | "- Sites can be accessed through an ordinary web browser when using the ZeroNet application, which acts as a local webhost for such pages.\n", 83 | "- In addition to using bitcoin cryptography, ZeroNet uses trackers from the BitTorrent networkto negotiate connections between peer\n", 84 | "- ZeroNet works by seeding information — for this situation the DNN web application — to facilitating hubs that are occupied with utilizing the information.\n", 85 | "- Facilitating hubs, known as companions, download (\"siphon\") and transfer (\"seed\") the DNN web application between each other instead of through a brought together server. \n", 86 | "- All through the DNN, a huge number of facilitating hubs spread out crosswise over various land locales, containing complete duplicates of the whole DNN web application and making it accessible to intrigued watchers.\n", 87 | "\n", 88 | "\n", 89 | "### How does it work?\n", 90 | "\n", 91 | "![alt text](https://ip.bitcointalk.org/?u=http%3A%2F%2Fi.imgur.com%2F0JLzsJT.jpg&t=587&c=BxLz-DfimAgErw \"Logo Title Text 1\")\n", 92 | "\n", 93 | "- The DNN token is the essential instrument of significant worth that can be utilized to do activities on the stage. \n", 94 | "- For instance, essayists utilize DNN tokens to pay for the Writer Fee related with presenting their article to the system. \n", 95 | "- Once an article has been acknowledged, authors can procure DNN tokens through the engagement produced by their article.\n", 96 | "- Commentators utilize DNN tokens to be considered by the system as an analyst of a submitted article. \n", 97 | "- Perusers utilize DNN tokens to associate with articles through review, remarking, and tipping scholars.\n", 98 | "\n", 99 | "- Anyone can submit articles that will be reviewed by a handful of quasi-selected and anonymous contributors\n", 100 | "- During review, contributors check articles to ensure that they are in accordance with the network’s public set of editorial standards. \n", 101 | "- Each piece of news published on DNN is replicated across a series of community-hosted nodes and made available to the public. \n", 102 | "- Readers, writers, reviewers, and publishers earn tokens in proportion to the amount of positive contributions they make to the platform.\n", 103 | "\n", 104 | "\n", 105 | "- DNN is comprised of four types of actors that each have key roles and contributions that together, make up the underlying functions and framework of the network\n", 106 | "\n", 107 | "### Writers, Reviewers, Readers, Publishers\n", 108 | "\n", 109 | "```bash\n", 110 | "DNN.Article.submitReview = function(articleHash, personalVote, peerVote, feedback, account) {\n", 111 | " return new Promise(function(resolve, reject) {\n", 112 | " LI.show();\n", 113 | " IPFS.store({article:articleHash, feedback:feedback, user:DNN.User.session.user, created: (new Date()).toString()})\n", 114 | " .then(function(result) {\n", 115 | " var feedbackHash = result.files[0].hash;\n", 116 | " var _personalVote = personalVote ? \"1\" : \"2\";\n", 117 | " var _peerVote = peerVote ? \"1\" : \"2\";\n", 118 | " LI.hide();\n", 119 | " resolve({feedbackHash: feedbackHash});\n", 120 | "\n", 121 | " // backend.contracts.ReviewProcessContract.vote(articleHash, _personalVote, _peerVote, feedbackHash, {from: account})\n", 122 | " // .then(function(reviewTx) {\n", 123 | " // LI.hide();\n", 124 | " // console.log(reviewTx);\n", 125 | " // })\n", 126 | " // .catch(function() {\n", 127 | " // console.log(arguments);\n", 128 | " // LI.hide();\n", 129 | " // reject();\n", 130 | " // });\n", 131 | "\n", 132 | " })\n", 133 | " .catch(function() {\n", 134 | " LI.hide();\n", 135 | " reject();\n", 136 | " });\n", 137 | " });\n", 138 | "};\n", 139 | "```\n", 140 | "\n", 141 | "![alt text](https://dnn.media/assets/img/article-flow.png \"Logo Title Text 1\")\n", 142 | "\n", 143 | "#### WRITERS\n", 144 | "- Writers, or reporters, are individuals who submit news content in the form of articles. Whether\n", 145 | "- Since anyone can submit articles to DNN, getting published is not guaranteed.\n", 146 | "- To increase the chance of getting published writers should ensure that they closely comply with the DNN content guidelines to mitigate the chance of reviewers rejecting their piece due to infractions.\n", 147 | "\n", 148 | "#### REVIEWERS\n", 149 | "- Reviewers, or editors, read and vote upon submitted articles before an article is available for public consumption on the DNN’s article feed. \n", 150 | "- The review process includes basic tasks such as noting grammatical errors, pointing out inaccuracies and questionable statements, as well as content classification.\n", 151 | "- Reviewers do not have the ability to modify articles, but rather can accept (i.e. vote to have content published) or reject (i.e. vote to prevent content from being published) any written piece\n", 152 | "- To make sure that no single reviewer has the final say on whether or not an article should be publicly incorporated into the network, the network will assign seven random reviewers to validate the article. \n", 153 | "- The seven reviewers are chosen in a process called the Review Selection Bid\n", 154 | "- All seven reviewers are completely unaware of one another’s identities; they vote and leave feedback in complete isolation to avoid groupthink or any form of collusion\n", 155 | "\n", 156 | "#### READERS\n", 157 | "- Readers can comment, add notes, share, tip, bookmark articles of interest, and denote articles they deem questionable. \n", 158 | "- readers on DNN play an active role in helping to shape the news they read, which includes participating in Reader Suggestions whereby article topics are put forward by you, the news consumer.\n", 159 | "- Readers pay for access in DNN tokens. \n", 160 | "- As Ethereum continues to improve scalability with additions like sharding, state channels, and plasma, an ideal way to implement a subscription model, a pay-per-article model, or a combination of the two will be explored.\n", 161 | "\n", 162 | "#### PUBLISHERS\n", 163 | "\n", 164 | "- Publishers are server nodes which act as a proxy between human contributors and the DNN network residing on the Ethereum blockchain.\n", 165 | "- Specialized open source software consisting of the complete DNN contributor-interface and network interface, is bundled and installed on each publisher. \n", 166 | "- Publisher nodes are responsible for replicating published articles and ensuring that the DNN network remains available in the face of coordinated attacks.\n", 167 | "- Publisher nodes communicate with one another through a peer-to-peer protocol that makes use of the same cryptography behind Bitcoin and Ethereum. \n", 168 | "- Using this peer-to-peer protocol, publishers are able to relay details about their state to nearby node hosts.\n", 169 | "- The main purpose for publishers is to provide an attack resistant transport for the DNN software, rather than host the DNN software on a centralized server, which introduces a significant point of failure.\n", 170 | "\n", 171 | "\n", 172 | "#### Using the DNN Alpha\n", 173 | "\n", 174 | "Find the code here https://github.com/dnnmedia/dnn_site_demo\n", 175 | "\n", 176 | "## Installation\n", 177 | "\n", 178 | "To begin working on DNN's alpha, you must first install all of the dependent node modules within package.json. To do this, navigate to the root directory of the repo and run the following command.\n", 179 | "\n", 180 | "```bash\n", 181 | "npm install\n", 182 | "```\n", 183 | "\n", 184 | "Afterwards, in the same directory, run server.js to start the demo.\n", 185 | "\n", 186 | "```bash\n", 187 | "node server.js\n", 188 | "```\n", 189 | "\n", 190 | "To view DNN, open up your browser and navigate to `http://localhost:8002/onboard`" 191 | ] 192 | }, 193 | { 194 | "cell_type": "code", 195 | "execution_count": null, 196 | "metadata": {}, 197 | "outputs": [], 198 | "source": [] 199 | } 200 | ], 201 | "metadata": { 202 | "kernelspec": { 203 | "display_name": "Python 3", 204 | "language": "python", 205 | "name": "python3" 206 | }, 207 | "language_info": { 208 | "codemirror_mode": { 209 | "name": "ipython", 210 | "version": 3 211 | }, 212 | "file_extension": ".py", 213 | "mimetype": "text/x-python", 214 | "name": "python", 215 | "nbconvert_exporter": "python", 216 | "pygments_lexer": "ipython3", 217 | "version": "3.6.3" 218 | } 219 | }, 220 | "nbformat": 4, 221 | "nbformat_minor": 2 222 | } 223 | -------------------------------------------------------------------------------- /Module_guide.md: -------------------------------------------------------------------------------- 1 | # IPFS Module Guide 2 | 3 | This document is just a quick guide for if you want to implement IPFS -- its modelled after go-ipfs, and this serves as a template for both js-ipfs and py-ipfs. 4 | 5 | Sections: 6 | - IPFS Types 7 | - API Commands 8 | - API Transports 9 | - Implementing bindings for the HTTP API 10 | 11 | ## The Libraries 12 | 13 | There are lots of non-IPFS related modules that have been buiult for IPFS that acts as dependencies. 14 | 15 | ### libp2p 16 | 17 | There are some nontrivial peer to peer protocols necessary for IPFS. These have been abstracted and placed into an entirely seperate module called libp2p. This is a very thin wrapper around a lot of modules that interact with each other. 18 | 19 | Implementations: 20 | - [go-libp2p](https://github.com/libp2p/go-libp2p) 21 | - [js-libp2p](https://github.com/libp2p/js-libp2p) 22 | 23 | `libp2p` could very well be _the bulk_ of an ipfs implementation. The rest is very simple. 24 | 25 | ### The Multi libraries. Things to remember 26 | 27 | There are quite a number of self-describing protocols/formats in use all over ipfs. 28 | 29 | - [multiaddr](https://github.com/multiformats/multiaddr) 30 | - [multicodec](https://github.com/multiformats/multicodec) 31 | - [multihash](https://github.com/multiformats/multihash) 32 | - [multistream](https://github.com/multiformats/multistream) 33 | 34 | ## Core Pieces 35 | 36 | ### IPLD 37 | 38 | IPLD is the format for IPFS objects, but it can be used outside of ipfs (hence a module). It's layered on top of `multihash` and `multicodec`, and provides the heart of ipfs: the merkledag. 39 | 40 | Implementations: 41 | - [go-ipld](https://github.com/ipfs/go-ipld) 42 | - [js-ipld](https://github.com/ipld/js-ipld-dag-cbor) 43 | 44 | ### IPRS 45 | 46 | IPRS is the record system for IPFS, but it can be used outside of ipfs (hence a module). This deals with p2p system records -- it is also used by `libp2p`. 47 | 48 | Implementations: 49 | - [go-iprs](https://github.com/ipfs/go-iprs) 50 | - js-iprs _Forthcoming_ 51 | 52 | ### IPNS 53 | 54 | IPNS provides name resolution on top of IPRS -- and a choice of record routing system. 55 | 56 | ### IPFS-Repo 57 | 58 | The IPFS-Repo is an IPFS Node's "local storage" or "database", though the storage may not be in a database nor local at all (e.g. `s3-repo`). There are common formats so that multiple implementations can read and write to the same repos. Though today we only have one repo format, more are easy to add so that we can create IPFS nodes on top of other storage solutions. 59 | 60 | Implementations: 61 | - [go-ipfs-repo](https://github.com/ipfs/go-ipfs/tree/master/repo) 62 | - [js-ipfs-repo](https://github.com/ipfs/js-ipfs-repo) 63 | 64 | ## IPFS Core 65 | 66 | The Core of IPFS is an interface of functions layered over all the other pieces. 67 | 68 | ### IPFS Node 69 | 70 | The IPFS Node is an entity that bundles all the other pieces together, and implements the interface (described below). In its most basic sense, an IPFS node is really just: 71 | 72 | ```go 73 | type ipfs.Node struct { 74 | 75 | Config // has a configuration 76 | repo.Repo // has a Repo for storing all the local data 77 | libp2p.Node // has an embedded libp2p.Node, and thus a peer.ID, and keys 78 | dag.Store // has a DAG Store (over the repo + network) 79 | 80 | } 81 | ``` 82 | 83 | IPFS itself is very, very simple. The complexity lies within `libp2p.Node` and how the different IPFS commands should run depending on the `libp2p.Node` configuration. 84 | 85 | ### IPFS Node Config 86 | 87 | IPFS Nodes can be configured. The basic configuration format is a JSON file, and so naturally converters to other formats can be made. Eventually, the configuration will be an ipfs object itself. 88 | 89 | The config is stored in the IPFS Repo, but is separate because some implementations may give it knowledge of other packages (like routing, http, etc). 90 | 91 | ### IPFS Interface or API 92 | 93 | The IPFS Interface or API (not to be confused with the IPFS HTTP API) is the set of functions that IPFS Nodes must support. These are classified into sections, like _node, network, data, util_ etc. 94 | 95 | The IPFS Interface can be implemented: 96 | - as a library - first and foremost 97 | - as a commandline toolchain, so users can use it directly 98 | - as RPC API, so that other programs could use it 99 | - over HTTP (the IPFS HTTP API) 100 | - over unix domain sockets 101 | - over IPC 102 | 103 | One goal for the core interface libraries is to produce an interface that could operate on a local or a remote node. This means that, for example: 104 | 105 | ```go 106 | func Cat(n ipfs.Node, p ipfs.Path) io.Reader { ... } 107 | ``` 108 | should be able to work whether `n` represents a local node (in-process, local storage), or a remote node (over an RPC API, say HTTP). 109 | 110 | _**For now, i list these from the commandline, but the goal is to produce a proper typed function interface/API that we can all agree on.**_ 111 | 112 | #### Node Commands 113 | 114 | These are the for the node itself. 115 | 116 | - ipfs stats 117 | - ipfs diag 118 | - ipfs init 119 | - ipfs config 120 | - ipfs repo 121 | - ipfs repo gc 122 | 123 | #### Data Commands 124 | 125 | - ipfs pin 126 | - ipfs files 127 | - ipfs tar 128 | - ipfs resolve 129 | - ipfs block 130 | - ipfs object 131 | - ipfs {cat, ls, refs} 132 | 133 | #### Network Commands 134 | 135 | These are carried over from libp2p, so ideally the libp2p implementations do the heavy lifting here. 136 | 137 | - ipfs exchange 138 | - ipfs routing 139 | - ipfs bitswap 140 | - ipfs bootstrap 141 | - ipfs id 142 | - ipfs ping 143 | - ipfs swarm 144 | 145 | #### Naming commands 146 | 147 | These are carried over from IPNS (can make that its own tool/lib). 148 | 149 | - ipfs name 150 | - ipfs dns 151 | 152 | #### Tool Commands 153 | 154 | - ipfs log 155 | - ipfs update 156 | - ipfs daemon 157 | - ipfs version 158 | - ipfs tour 159 | 160 | ## IPFS Datastructures and Data Handling 161 | 162 | There are many useful datastructures on top of IPFS. Things like `unixfs`, `tar`, `keychain`, etc. And there are a number of ways of importing data -- whether posix files or not. 163 | 164 | ### IPLD Data Importing 165 | 166 | Importing data into IPFS can be done in a variety of ways. These are use-case specific, produce different datastructures, produce different graph topologies, and so on. These are not _strictly_ needed in an IPFS implementation, but definitely make it more useful. They are really tools on top of IPLD though, so these can be generic and separate from IPFS itself. 167 | 168 | - graph topologies - shape of the graphs 169 | - balanced - dumb, dead simple 170 | - trickledag - optimized for seeking 171 | - live stream 172 | - database indices 173 | - file chunking - how to split a continuous stream/file 174 | - fixed size 175 | - rabin fingerprinting 176 | - format chunking (use knowledge of formats, e.g. audio, video, etc) 177 | - special format datastructures 178 | - tar 179 | - document formats - pdf, doc, etc 180 | - audio and video formats - ogg, mpeg, etc 181 | - container and vm images 182 | - and many more 183 | 184 | 185 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DNN 2 | DNN 3 | --------------------------------------------------------------------------------