diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..139c68e --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,43 @@ +## creative commons + +# CC0 1.0 Universal + +CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. + +### Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. __Copyright and Related Rights.__ A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; + + ii. moral rights retained by the original author(s) and/or performer(s); + + iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; + + iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; + + v. rights protecting the extraction, dissemination, use and reuse of data in a Work; + + vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and + + vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. + +2. __Waiver.__ To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. + +3. __Public License Fallback.__ Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. + +4. __Limitations and Disclaimers.__ + + a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. + + b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. + + c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. + + d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. diff --git a/README.md b/README.md index ac67f48..0bd5e64 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,117 @@ -# CRVC -## Cryptoeconomic Release & Version Control +

CRVC

+

Cryptoeconomic Release & Version Control

-### Summary +CRVC is an extension to [Git](https://git-scm.com) that allows for the coordination of source code and binary releases among unknown and untrusted participants. -CRVC is a custom `git-remote` and a collection of cryptoeconomic games to allow anonymous actors to trustlessly coordinate git repositories and software releases. +* [Introduction](#introduction) + * [Purpose](#purpose) + * [Features](#features) + * [Who is it for?](#who-is-it-for) + * [What CRVC isn't](#what-crvc-isnt) + * [Where does this tool come from?](#where-does-this-tool-come-from) +* [Get started](#get-started) + * [Requirements](#requirements) +* [Contribute](#contribute) + * [As a community](#as-a-community) +* [Contribute as a developer](#contribute-as-a-developer) +* [Principles, vision, goals](#principles-vision-goals) + * [Principles](#principles) + * [Vision](#vision) + * [Goals](#goals) +* [Todo](#todo) +* [Public Domain](#public-domain) + +## Introduction + +CRVC aims to be secure source-control oriented software distribution method. This means you can download binaries and source code that are cryptoeconomically verified by multiple builders. + +CRVC encourages the use of a deterministic build process to allow multiple builders to create identical binaries. This allows multiple parties to sign the resulting binaries, creating high assurances that the binaries and tool chain were not tampered with and that the same source was used. It attempts to remove the build and distribution process as a single point of failure. + +CRVC is a custom `git-remote`, a helper binary and a collection of cryptoeconomic games to allow anonymous actors to trustlessly coordinate git repositories and software releases. The current idea is to treat git commit history and release binary hashes as [Schelling Points](https://en.wikipedia.org/wiki/Focal_point_(game_theory)). Git Objects are deployed on decentralized file storage (Swarm/IPFS) and are extended to provide hash of the content that is more robust than SHA1. The work is a generalization of the discussion for providing a voluntary update mechanism to Status and encourage deterministic builds , which [can be found here](https://discuss.status.im/t/self-updating-status/964). -Inspired by [mango](https://github.com/axic/mango) and [pando](https://github.com/pandonetwork/pando). +Inspired by [mango](https://github.com/axic/mango), [pando](https://github.com/pandonetwork/pando) and [Gitian](https://gitian.org). + +### Purpose + +To allow coordination of source code and binary releases among a group of actors you don't know. + +### Features + +- TODO + +### Who is it for? + +CRVC is for developers that cannot rely on access control lists (and therefore trust and unique identities) to manage their software repositories. + +### What CRVC isn't + + * CRVC is not a decentralized Github + * CRVC is not a unique Version Control System + +### Where does this tool come from? + +While it's my belief that the introduction of Australia's Telecommunications and Other Legislation Amendment (Assistance and Access) Act 2018 and the recent FATF Recommendations are well-intentioned, it is clear that these rules are alarming, harmful and prematurely stifle innovation, preventing us from discovering newer, more efficient ways of protecting users and upholding [human rights](http://www.un.org/en/universal-declaration-human-rights/). + +As a result, these actions point to a future where I or Status Research & Development GmbH nay be prevented from producing & distributing binaries that do not comply with distribution channel terms of service and jurisdictional policies. CRVC is a foot in the door, it may allow for a future where future generations can create software that better upholds [human rights](http://www.un.org/en/universal-declaration-human-rights/). + +## Get started + +`nimble build` + +### Requirements + +- Nim 0.19 or above +- Git +- An Ethereum Node +- IPFS/Swarm Node + +## Contribute + +Do you want to help? That's awesome. Here are simple things you can do. + +### As a community + +* Unlike Fight Club, the best way to help is **to actually talk about the project** as much as you can (blog post, articles, Twitter, Facebook). +* You can answer questions in [the issue tracker](https://github.com/status-im/crvc/issues) to help other community members. + +## Contribute as a developer + +* Read our [Contribution Guide](/CONTRIBUTING.md). +* Install the developer version locally so you can start contributing [instructions](/docs/contribute/index.md). +* Look for [issues labelled bugs](https://github.com/status-im/crvc/issues?q=is%3Aopen+is%3Aissue+label%3Abug) if you are looking to have an immediate impact on the project. +* Look for [issues labelled Help wanted](https://github.com/status-im/crvc/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) These are issues that you can solve relatively easily. +* Look for [issues labelled Good first issue](https://github.com/status-im/crvc/labels/good%20first%20issue) These issues are for people who want to contribute, but try to work on a small feature first. +* If you are an advanced developer, you can try to tackle [issues labelled feature requests](https://github.com/status-im/crvc/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature+request%22). Beware though - they are harder to do and will require a lot of back and forth with the repository administrator in order to make sure we are going to the right direction with the product. + +We welcome contributions of all kinds from anyone. + +## Principles, vision, goals + +Software are cultural artefacts, and as such I want to embed in them the ability to uphold [human rights](http://www.un.org/en/universal-declaration-human-rights/). + +### Principles + +You can read [Status' Principles here](https://our.status.im/our-principles/). + +* Liberty +* Censorship resistance +* Security +* Privacy +* Transparency +* Openness +* Decentralization +* Inclusivity +* Continuance +* Resourcefulness + +### Vision + +CRVC's vision is to **help people write the software of the future, even when the walls have closed in**. ### Goals @@ -26,3 +127,8 @@ Inspired by [mango](https://github.com/axic/mango) and [pando](https://github.co - Contract Games - Create a Git-Remote - Pretty much everything + +## Public Domain + +This software is released into the public domain to the full extent the law allows. [View CC0](/LICENSE.md). +(oh the irony). \ No newline at end of file diff --git a/crvc.nimble b/crvc.nimble index c0effe1..f71f303 100644 --- a/crvc.nimble +++ b/crvc.nimble @@ -6,7 +6,7 @@ description = "Cryptoeconomic Release and Version Control" license = "MIT" srcDir = "src" binDir = "bin" -bin = @["crvc"] # TODO rename to "git-remote-crvc" ? +bin = @["crvc", "git_remote_crvc"] # TODO best way to change --out to git-remote-crvc? # Dependencies diff --git a/src/crvc.nim b/src/crvc.nim index e95a956..d52dc18 100644 --- a/src/crvc.nim +++ b/src/crvc.nim @@ -1,69 +1,14 @@ -import os, strformat, strutils, rdstdin - -const - gitEnv = "GIT_DIR" - protocol = "crvc" - -proc setup(gitEnv: string, protocol: string): (string, string, string) = - # Checks the Environment and returns the git Working directory, the protocol, the remote and url - - if paramCount() < 2: - raise newException(ValueError, fmt"Usage: {getAppFilename()} ") - - let - remote = paramStr(1) # - url = paramStr(2) # - gitDir = getEnv(gitEnv) - - # Check if GIT_DIR Environment Variable is set - if gitDir.isNilOrWhitespace: - raise newException(OSError, fmt"{gitEnv} is not set") - - # Check if the .git directory exists - if not existsDir(gitDir): - raise newException(OSError, fmt"{gitDir} does not appear to be a git repository") - - # Create our Working Directory if it doesn't exist - let path = joinPath(gitDir, remote) - if not existsDir(path): - createDir(path) - # TODO process url and pass to processStdio parseUrl? - return (path, remote, url) - -proc processStdio (env: tuple): void = - # Supports the Git Remote Helper stdio protocol - # https://git-scm.com/docs/git-remote-helpers - let (path, remote, url) = env - - while true: - var - response: string - line: string = readLine(stdin) # TODO something better here ? https://nim-lang.org/docs/streams.html - # echo line - - # Git sends the remote helper a list of commands on standard input, one per line. - # The first command is always the capabilities command, in response to which the remote helper must print a list of the capabilities it supports followed by a blank line. - case line: - of "capabilities": - response = "capabilities response" - of "list": - response = "list response" - of "export": - response = "export response" - else: - raise newException(IOError, fmt"Unrecognised command: {line}") - write(stdout, response) - - -proc bail() {.noconv.} = - quit() +import os when isMainModule: - setControlCHook(bail) + # TODO read getCurrentDir() .crvc + # if not exists, read getomeDir, .config .crvc + # check if env already set - try: - processStdio(setup(gitEnv, protocol)) - except: - echo getCurrentExceptionMsg() - finally: - quit() \ No newline at end of file + os.putEnv("CRVC_KEY", "") + os.putEnv("CRVC_SIGNER", "") + os.putEnv("CRVC_MODE", "") + os.putEnv("CRVC_BUILDCMD", "") + os.putEnv("CRVC_BINOUT", "") + + echo "one day I will set environment variables for git-remote-crvc, act as a passthrough for git and general convenience" \ No newline at end of file diff --git a/src/git_remote_crvc.nim b/src/git_remote_crvc.nim new file mode 100644 index 0000000..e95a956 --- /dev/null +++ b/src/git_remote_crvc.nim @@ -0,0 +1,69 @@ +import os, strformat, strutils, rdstdin + +const + gitEnv = "GIT_DIR" + protocol = "crvc" + +proc setup(gitEnv: string, protocol: string): (string, string, string) = + # Checks the Environment and returns the git Working directory, the protocol, the remote and url + + if paramCount() < 2: + raise newException(ValueError, fmt"Usage: {getAppFilename()} ") + + let + remote = paramStr(1) # + url = paramStr(2) # + gitDir = getEnv(gitEnv) + + # Check if GIT_DIR Environment Variable is set + if gitDir.isNilOrWhitespace: + raise newException(OSError, fmt"{gitEnv} is not set") + + # Check if the .git directory exists + if not existsDir(gitDir): + raise newException(OSError, fmt"{gitDir} does not appear to be a git repository") + + # Create our Working Directory if it doesn't exist + let path = joinPath(gitDir, remote) + if not existsDir(path): + createDir(path) + # TODO process url and pass to processStdio parseUrl? + return (path, remote, url) + +proc processStdio (env: tuple): void = + # Supports the Git Remote Helper stdio protocol + # https://git-scm.com/docs/git-remote-helpers + let (path, remote, url) = env + + while true: + var + response: string + line: string = readLine(stdin) # TODO something better here ? https://nim-lang.org/docs/streams.html + # echo line + + # Git sends the remote helper a list of commands on standard input, one per line. + # The first command is always the capabilities command, in response to which the remote helper must print a list of the capabilities it supports followed by a blank line. + case line: + of "capabilities": + response = "capabilities response" + of "list": + response = "list response" + of "export": + response = "export response" + else: + raise newException(IOError, fmt"Unrecognised command: {line}") + write(stdout, response) + + +proc bail() {.noconv.} = + quit() + +when isMainModule: + setControlCHook(bail) + + try: + processStdio(setup(gitEnv, protocol)) + except: + echo getCurrentExceptionMsg() + finally: + quit() \ No newline at end of file