{"action":"created","comment":{"url":"https://api.github.com/repos/mediachain/mediachain/pulls/comments/59569189","id":59569189,"diff_hunk":"@@ -0,0 +1,435 @@\n+# RFC 1: The Mediachain Datastore\n+\n+Status: DRAFT\n+\n+Author: vyzo\n+\n+## Overview\n+\n+The Mediachain[1] is a decentralized system designed for tracking\n+metadata related to Creative Works and Internet Media.\n+It is being developed as an Open Source, Open Data system with\n+decentralized stakeholders.\n+\n+This document serves as a  specification of the Mediachain data\n+model and the shape of the distributed store at the heart of\n+system.\n+It is intended to provide a stable basis for bootstrapping the\n+system from a small-scale proof of concept to a fully distributed,\n+Open Data Peer-to-Peer network.\n+\n+## The Mediachain Data Model\n+\n+### Data Objects\n+\n+The Mediachain is stored in a distributed append-only datastore with\n+content addressable access. This maps well to the IPFS[2] peer-to-peer\n+network, which names and accesses data using the SHA256 hash of\n+the content. Objects stored in the network are immutable and persistent;\n+their hashes become their _Canonical_ identifiers through which they can\n+be referenced.\n+\n+Mediachain objects follow the IPLD[3] data model,\n+allowing for storage of key-valued pairs where keys\n+are strings and values are other key-valued pairs or strings.\n+\n+Thus we have:\n+```\n+DataObject = {\n+ \"type\" : <String>\n+ <Key> : <Value>  ...\n+ }\n+\n+Key   = <String>\n+Value = <String> | <CompoundValue>\n+CompoundValue = {\n+ <Key> : <Value> ...\n+ }\n+\n+```\n+All Mediachain data objects have a mandatory `type` field that represents\n+the data type of the object.\n+Links can be embedded between data objects by using the IPLD `@link`\n+special key, allowing us to construct Merkle DAGs.\n+\n+### Entities and Artefacts\n+\n+There are two principal types of objects in the mediachain:\n+entities and artefacts. An _Entity_ represents a person or organization\n+who may associate with artefacts, for example by creating or posting\n+a reference to the artefact. _Artefacts_ represent media works as tracked\n+by the Mediachain. They can be images, video, text, or any other\n+common media found in the Internet. \n+\n+In the Mediachain schema, entities are instances of data objects with\n+their type field set to `entity` and a mandatory `name` field.\n+Artefacts are instances of data objects with their type field set\n+to `artefact`, a mandatory name and optional `description` and creation\n+date fields.\n+\n+Artefacts can also have associated their data stored in IPFS, so that media\n+can be directly accessed from references to their Canonicals.\n+If this is the case, then the artefact object will contain a link to\n+the IPFS datablob in its `data` field\n+\n+Finally, both types carry a set of cryptographic signatures that assert their\n+validity. The signatures come from _signatories_ with known keys in the\n+system; any entity that contains a public key in its data can act\n+as a signatory.\n+\n+We can make things more concrete with the following schema:\n+```\n+Entity = {\n+ \"type\" : \"entity\"\n+ \"name\" : <String>\n+ [\"key\" : <Reference>]\n+ \"signatures\" : <Signatures>\n+ <Key> : <Value> ... ; entity metadata\n+ }\n+\n+Artefact = {\n+ \"type\" : \"artefact\"\n+ \"name\" : <String>\n+ [\"created\" : <Date>]\n+ [\"description\" : <String>]\n+ [\"data\" : <Reference>]\n+ \"signatures\" : <Signatures>\n+ <Key> : <Value> ... ; artefact metadata\n+ }\n+\n+Reference = {\n+ \"@link\" = <Canonical>\n+ }\n+\n+Signatures = {\n+ \"_1\" : {\n+  \"entity\" : <Reference>\n+  \"signature\" : <IPRSSignature>\n+ }\n+ \"_2\" : ...\n+ ...\n+ }\n+\n+IPRSSignature = {\n+ \"value\" : <Reference>\n+ }\n+\n+```\n+\n+### Chains and Links\n+\n+The fundamental operation of the Mediachain is to link entities and\n+artefacts with labeled relationships and metadata.  The data model\n+described so far is disconnected: it contains independent entities and\n+artefacts. In order to track the evolving relationships between\n+entities and artefacts we need to construct chains of updates for each\n+entity and artefact in the datastore.\n+\n+The natural way to model chains in a distributed append-only store is\n+through linked lists. Thus for each entity and artefact in the\n+system, we also have an associated chain which initially points to the\n+canonical of a global `Nil` object:\n+```\n+Chain = <ChainCell> | <Nil>\n+ChainCell = {\n+ \"type\" : ...\n+ \"chain\" : <Reference>\n+ <Key> : <Value> ...\n+ }\n+Nil = { \"type\" : \"nil\" }\n+```\n+\n+The entity and artefact chains differ on the type of relationships\n+they store. They both support metadata update cells, which simply\n+provide new metadata to the base object as arbitray key-value pairs.\n+\n+The entity chain also allows for linking two entities, for example\n+having a pseudonymous artist publicly revealing a true name that\n+points to another entity in the system.\n+\n+The artefact chain further stores links to entities that\n+represent creation and potential Intellectual Property rights,\n+references in the Internet media-space, and derivative relations\n+to other artefacts.\n+\n+Each chain cell carries also carries one or more signatures by\n+signatory entities in the system.\n+\n+Note that the types of cells that can appear in either type of\n+chain it is not limited to the types of relationships described\n+above. These are merely the minimum schema to support the\n+functionality of the Mediachain.\n+\n+Keeping this in mind, we can model the chains with the following\n+schema:\n+```\n+EntityChainCell =","path":"rfc/mediachain-rfc-1.md","position":163,"original_position":166,"commit_id":"1d983d62306523ba47ffa8467389530aaf047a79","original_commit_id":"ad45ced4c29a5518739b6dbe301c0a48cb4c36d8","user":{"login":"parkan","id":204986,"avatar_url":"https://avatars.githubusercontent.com/u/204986?v=3","gravatar_id":"","url":"https://api.github.com/users/parkan","html_url":"https://github.com/parkan","followers_url":"https://api.github.com/users/parkan/followers","following_url":"https://api.github.com/users/parkan/following{/other_user}","gists_url":"https://api.github.com/users/parkan/gists{/gist_id}","starred_url":"https://api.github.com/users/parkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkan/subscriptions","organizations_url":"https://api.github.com/users/parkan/orgs","repos_url":"https://api.github.com/users/parkan/repos","events_url":"https://api.github.com/users/parkan/events{/privacy}","received_events_url":"https://api.github.com/users/parkan/received_events","type":"User","site_admin":false},"body":"Ah but there's an `ArtefactCreationCell`, this should be consistent, in either direction -- no preference","created_at":"2016-04-13T15:26:56Z","updated_at":"2016-04-13T15:26:56Z","html_url":"https://github.com/mediachain/mediachain/pull/2#discussion_r59569189","pull_request_url":"https://api.github.com/repos/mediachain/mediachain/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/mediachain/mediachain/pulls/comments/59569189"},"html":{"href":"https://github.com/mediachain/mediachain/pull/2#discussion_r59569189"},"pull_request":{"href":"https://api.github.com/repos/mediachain/mediachain/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/mediachain/mediachain/pulls/2","id":66305359,"html_url":"https://github.com/mediachain/mediachain/pull/2","diff_url":"https://github.com/mediachain/mediachain/pull/2.diff","patch_url":"https://github.com/mediachain/mediachain/pull/2.patch","issue_url":"https://api.github.com/repos/mediachain/mediachain/issues/2","number":2,"state":"open","locked":false,"title":"RFC1: The Mediachain Datastore","user":{"login":"vyzo","id":36426,"avatar_url":"https://avatars.githubusercontent.com/u/36426?v=3","gravatar_id":"","url":"https://api.github.com/users/vyzo","html_url":"https://github.com/vyzo","followers_url":"https://api.github.com/users/vyzo/followers","following_url":"https://api.github.com/users/vyzo/following{/other_user}","gists_url":"https://api.github.com/users/vyzo/gists{/gist_id}","starred_url":"https://api.github.com/users/vyzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vyzo/subscriptions","organizations_url":"https://api.github.com/users/vyzo/orgs","repos_url":"https://api.github.com/users/vyzo/repos","events_url":"https://api.github.com/users/vyzo/events{/privacy}","received_events_url":"https://api.github.com/users/vyzo/received_events","type":"User","site_admin":false},"body":"The branch adds rfc/mediachain-rfc-1.md which contains the Mediachain Datastore specification in markdown.\r\n\r\nChanges since last review:\r\nDataModel:\r\n- Cleaned up the signature and key structures to be consistent and carry references\r\n- Added an EntityLinkCell to the entity chains so that we can have linkage between entities and support deduplication.\r\n\r\nStructure:\r\n- Added Overview, Example, and References sections\r\n","created_at":"2016-04-13T11:27:38Z","updated_at":"2016-04-13T15:26:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aaafcdf6fb86e7dea02abd62e573d3d91374db9f","assignee":{"login":"parkan","id":204986,"avatar_url":"https://avatars.githubusercontent.com/u/204986?v=3","gravatar_id":"","url":"https://api.github.com/users/parkan","html_url":"https://github.com/parkan","followers_url":"https://api.github.com/users/parkan/followers","following_url":"https://api.github.com/users/parkan/following{/other_user}","gists_url":"https://api.github.com/users/parkan/gists{/gist_id}","starred_url":"https://api.github.com/users/parkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkan/subscriptions","organizations_url":"https://api.github.com/users/parkan/orgs","repos_url":"https://api.github.com/users/parkan/repos","events_url":"https://api.github.com/users/parkan/events{/privacy}","received_events_url":"https://api.github.com/users/parkan/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mediachain/mediachain/pulls/2/commits","review_comments_url":"https://api.github.com/repos/mediachain/mediachain/pulls/2/comments","review_comment_url":"https://api.github.com/repos/mediachain/mediachain/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mediachain/mediachain/issues/2/comments","statuses_url":"https://api.github.com/repos/mediachain/mediachain/statuses/1d983d62306523ba47ffa8467389530aaf047a79","head":{"label":"mediachain:vyzo-rfc1","ref":"vyzo-rfc1","sha":"1d983d62306523ba47ffa8467389530aaf047a79","user":{"login":"mediachain","id":16711838,"avatar_url":"https://avatars.githubusercontent.com/u/16711838?v=3","gravatar_id":"","url":"https://api.github.com/users/mediachain","html_url":"https://github.com/mediachain","followers_url":"https://api.github.com/users/mediachain/followers","following_url":"https://api.github.com/users/mediachain/following{/other_user}","gists_url":"https://api.github.com/users/mediachain/gists{/gist_id}","starred_url":"https://api.github.com/users/mediachain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediachain/subscriptions","organizations_url":"https://api.github.com/users/mediachain/orgs","repos_url":"https://api.github.com/users/mediachain/repos","events_url":"https://api.github.com/users/mediachain/events{/privacy}","received_events_url":"https://api.github.com/users/mediachain/received_events","type":"Organization","site_admin":false},"repo":{"id":49516983,"name":"mediachain","full_name":"mediachain/mediachain","owner":{"login":"mediachain","id":16711838,"avatar_url":"https://avatars.githubusercontent.com/u/16711838?v=3","gravatar_id":"","url":"https://api.github.com/users/mediachain","html_url":"https://github.com/mediachain","followers_url":"https://api.github.com/users/mediachain/followers","following_url":"https://api.github.com/users/mediachain/following{/other_user}","gists_url":"https://api.github.com/users/mediachain/gists{/gist_id}","starred_url":"https://api.github.com/users/mediachain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediachain/subscriptions","organizations_url":"https://api.github.com/users/mediachain/orgs","repos_url":"https://api.github.com/users/mediachain/repos","events_url":"https://api.github.com/users/mediachain/events{/privacy}","received_events_url":"https://api.github.com/users/mediachain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mediachain/mediachain","description":"A distributed metadata protocol","fork":false,"url":"https://api.github.com/repos/mediachain/mediachain","forks_url":"https://api.github.com/repos/mediachain/mediachain/forks","keys_url":"https://api.github.com/repos/mediachain/mediachain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mediachain/mediachain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mediachain/mediachain/teams","hooks_url":"https://api.github.com/repos/mediachain/mediachain/hooks","issue_events_url":"https://api.github.com/repos/mediachain/mediachain/issues/events{/number}","events_url":"https://api.github.com/repos/mediachain/mediachain/events","assignees_url":"https://api.github.com/repos/mediachain/mediachain/assignees{/user}","branches_url":"https://api.github.com/repos/mediachain/mediachain/branches{/branch}","tags_url":"https://api.github.com/repos/mediachain/mediachain/tags","blobs_url":"https://api.github.com/repos/mediachain/mediachain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mediachain/mediachain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mediachain/mediachain/git/refs{/sha}","trees_url":"https://api.github.com/repos/mediachain/mediachain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mediachain/mediachain/statuses/{sha}","languages_url":"https://api.github.com/repos/mediachain/mediachain/languages","stargazers_url":"https://api.github.com/repos/mediachain/mediachain/stargazers","contributors_url":"https://api.github.com/repos/mediachain/mediachain/contributors","subscribers_url":"https://api.github.com/repos/mediachain/mediachain/subscribers","subscription_url":"https://api.github.com/repos/mediachain/mediachain/subscription","commits_url":"https://api.github.com/repos/mediachain/mediachain/commits{/sha}","git_commits_url":"https://api.github.com/repos/mediachain/mediachain/git/commits{/sha}","comments_url":"https://api.github.com/repos/mediachain/mediachain/comments{/number}","issue_comment_url":"https://api.github.com/repos/mediachain/mediachain/issues/comments{/number}","contents_url":"https://api.github.com/repos/mediachain/mediachain/contents/{+path}","compare_url":"https://api.github.com/repos/mediachain/mediachain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mediachain/mediachain/merges","archive_url":"https://api.github.com/repos/mediachain/mediachain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mediachain/mediachain/downloads","issues_url":"https://api.github.com/repos/mediachain/mediachain/issues{/number}","pulls_url":"https://api.github.com/repos/mediachain/mediachain/pulls{/number}","milestones_url":"https://api.github.com/repos/mediachain/mediachain/milestones{/number}","notifications_url":"https://api.github.com/repos/mediachain/mediachain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mediachain/mediachain/labels{/name}","releases_url":"https://api.github.com/repos/mediachain/mediachain/releases{/id}","deployments_url":"https://api.github.com/repos/mediachain/mediachain/deployments","created_at":"2016-01-12T17:29:52Z","updated_at":"2016-04-11T09:00:01Z","pushed_at":"2016-04-13T15:24:18Z","git_url":"git://github.com/mediachain/mediachain.git","ssh_url":"git@github.com:mediachain/mediachain.git","clone_url":"https://github.com/mediachain/mediachain.git","svn_url":"https://github.com/mediachain/mediachain","homepage":"https://medium.com/mine-labs/mediachain-483f49cbe37a","size":11,"stargazers_count":27,"watchers_count":27,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":27,"default_branch":"master"}},"base":{"label":"mediachain:master","ref":"master","sha":"739556bef85706d1dfb264452a9e9269741cd52e","user":{"login":"mediachain","id":16711838,"avatar_url":"https://avatars.githubusercontent.com/u/16711838?v=3","gravatar_id":"","url":"https://api.github.com/users/mediachain","html_url":"https://github.com/mediachain","followers_url":"https://api.github.com/users/mediachain/followers","following_url":"https://api.github.com/users/mediachain/following{/other_user}","gists_url":"https://api.github.com/users/mediachain/gists{/gist_id}","starred_url":"https://api.github.com/users/mediachain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediachain/subscriptions","organizations_url":"https://api.github.com/users/mediachain/orgs","repos_url":"https://api.github.com/users/mediachain/repos","events_url":"https://api.github.com/users/mediachain/events{/privacy}","received_events_url":"https://api.github.com/users/mediachain/received_events","type":"Organization","site_admin":false},"repo":{"id":49516983,"name":"mediachain","full_name":"mediachain/mediachain","owner":{"login":"mediachain","id":16711838,"avatar_url":"https://avatars.githubusercontent.com/u/16711838?v=3","gravatar_id":"","url":"https://api.github.com/users/mediachain","html_url":"https://github.com/mediachain","followers_url":"https://api.github.com/users/mediachain/followers","following_url":"https://api.github.com/users/mediachain/following{/other_user}","gists_url":"https://api.github.com/users/mediachain/gists{/gist_id}","starred_url":"https://api.github.com/users/mediachain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mediachain/subscriptions","organizations_url":"https://api.github.com/users/mediachain/orgs","repos_url":"https://api.github.com/users/mediachain/repos","events_url":"https://api.github.com/users/mediachain/events{/privacy}","received_events_url":"https://api.github.com/users/mediachain/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mediachain/mediachain","description":"A distributed metadata protocol","fork":false,"url":"https://api.github.com/repos/mediachain/mediachain","forks_url":"https://api.github.com/repos/mediachain/mediachain/forks","keys_url":"https://api.github.com/repos/mediachain/mediachain/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mediachain/mediachain/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mediachain/mediachain/teams","hooks_url":"https://api.github.com/repos/mediachain/mediachain/hooks","issue_events_url":"https://api.github.com/repos/mediachain/mediachain/issues/events{/number}","events_url":"https://api.github.com/repos/mediachain/mediachain/events","assignees_url":"https://api.github.com/repos/mediachain/mediachain/assignees{/user}","branches_url":"https://api.github.com/repos/mediachain/mediachain/branches{/branch}","tags_url":"https://api.github.com/repos/mediachain/mediachain/tags","blobs_url":"https://api.github.com/repos/mediachain/mediachain/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mediachain/mediachain/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mediachain/mediachain/git/refs{/sha}","trees_url":"https://api.github.com/repos/mediachain/mediachain/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mediachain/mediachain/statuses/{sha}","languages_url":"https://api.github.com/repos/mediachain/mediachain/languages","stargazers_url":"https://api.github.com/repos/mediachain/mediachain/stargazers","contributors_url":"https://api.github.com/repos/mediachain/mediachain/contributors","subscribers_url":"https://api.github.com/repos/mediachain/mediachain/subscribers","subscription_url":"https://api.github.com/repos/mediachain/mediachain/subscription","commits_url":"https://api.github.com/repos/mediachain/mediachain/commits{/sha}","git_commits_url":"https://api.github.com/repos/mediachain/mediachain/git/commits{/sha}","comments_url":"https://api.github.com/repos/mediachain/mediachain/comments{/number}","issue_comment_url":"https://api.github.com/repos/mediachain/mediachain/issues/comments{/number}","contents_url":"https://api.github.com/repos/mediachain/mediachain/contents/{+path}","compare_url":"https://api.github.com/repos/mediachain/mediachain/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mediachain/mediachain/merges","archive_url":"https://api.github.com/repos/mediachain/mediachain/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mediachain/mediachain/downloads","issues_url":"https://api.github.com/repos/mediachain/mediachain/issues{/number}","pulls_url":"https://api.github.com/repos/mediachain/mediachain/pulls{/number}","milestones_url":"https://api.github.com/repos/mediachain/mediachain/milestones{/number}","notifications_url":"https://api.github.com/repos/mediachain/mediachain/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mediachain/mediachain/labels{/name}","releases_url":"https://api.github.com/repos/mediachain/mediachain/releases{/id}","deployments_url":"https://api.github.com/repos/mediachain/mediachain/deployments","created_at":"2016-01-12T17:29:52Z","updated_at":"2016-04-11T09:00:01Z","pushed_at":"2016-04-13T15:24:18Z","git_url":"git://github.com/mediachain/mediachain.git","ssh_url":"git@github.com:mediachain/mediachain.git","clone_url":"https://github.com/mediachain/mediachain.git","svn_url":"https://github.com/mediachain/mediachain","homepage":"https://medium.com/mine-labs/mediachain-483f49cbe37a","size":11,"stargazers_count":27,"watchers_count":27,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mediachain/mediachain/pulls/2"},"html":{"href":"https://github.com/mediachain/mediachain/pull/2"},"issue":{"href":"https://api.github.com/repos/mediachain/mediachain/issues/2"},"comments":{"href":"https://api.github.com/repos/mediachain/mediachain/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/mediachain/mediachain/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/mediachain/mediachain/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mediachain/mediachain/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/mediachain/mediachain/statuses/1d983d62306523ba47ffa8467389530aaf047a79"}}}}