diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b27f5c96..b5beacc0 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -7,7 +7,7 @@ contribute to the project. We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, -body size, race, ethnicity, age, religion, or nationality. +body size, race, ethnicity, age, religion, nationality, or species--no picking on Wrigley for being a buffalo! Examples of unacceptable behavior by participants include: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a76edac2..c0975b0c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,11 +4,11 @@ There are many ways you can contribute to the BigchainDB project, some very easy ## Easy Ways to Contribute -The BigchainDB community has a Google Group and a Slack chat. Our [Community page](https://www.bigchaindb.com/community) has more information about those. +The BigchainDB community has a Google Group and a Gitter chatroom. Our [Community page](https://www.bigchaindb.com/community) has more information about those. -You can also follow us on Twitter [@BigchainDB](https://twitter.com/BigchainDB). +You can also follow us on Twitter [@BigchainDB](https://twitter.com/BigchainDB) or read [our blog on Medium](https://medium.com/the-bigchaindb-blog). -If you want to file a bug report, suggest a feature, or ask a code-related question, please go to the `BigchainDB/bigchaindb` repository on GitHub and [create a new Issue](https://github.com/bigchaindb/bigchaindb/issues/new). (You will need a [GitHub account](https://github.com/signup/free) (free).) Please describe the issue clearly, including steps to reproduce when it is a bug. +If you want to file a bug report, suggest a feature, or ask a code-related question, please go to the `bigchaindb/bigchaindb` repository on GitHub and [create a new Issue](https://github.com/bigchaindb/bigchaindb/issues/new). (You will need a [GitHub account](https://github.com/signup/free) (free).) Please describe the issue clearly, including steps to reproduce when it is a bug. ## How to Contribute Code or Documentation @@ -26,6 +26,8 @@ Familiarize yourself with how we do coding and documentation in the BigchainDB p * Note that we call the main branch `develop` rather than `master` * [semantic versioning](http://semver.org/) +Note: We have a slight variation on the GitHub Flow: we call the default branch `develop` rather than `master`. + ### Step 1 - Fork bigchaindb on GitHub In your web browser, go to [the BigchainDB repository on GitHub](https://github.com/bigchaindb/bigchaindb) and click the `Fork` button in the top right corner. This creates a new Git repository named `bigchaindb` in _your_ GitHub account. @@ -36,7 +38,7 @@ In your web browser, go to [the BigchainDB repository on GitHub](https://github. ```text git clone git@github.com:your-github-username/bigchaindb.git cd bigchaindb -git add upstream git@github.com:BigchainDB/bigchaindb.git +git add upstream git@github.com:bigchaindb/bigchaindb.git ``` ### Step 3 - Fetch and Merge the Latest from `upstream/develop` @@ -93,7 +95,7 @@ git push origin new-branch-name Go to the GitHub website and to _your_ remote bigchaindb repository (i.e. something like https://github.com/your-user-name/bigchaindb). -See [GitHub's documentation on how to initiate and send a pull request](https://help.github.com/articles/using-pull-requests/). Note that the destination repository should be `BigchainDB/bigchaindb` and the destination branch will be `develop` (usually, and if it's not, then we can change that if necessary). +See [GitHub's documentation on how to initiate and send a pull request](https://help.github.com/articles/using-pull-requests/). Note that the destination repository should be `bigchaindb/bigchaindb` and the destination branch will be `develop` (usually, and if it's not, then we can change that if necessary). If this is the first time you've submitted a pull request to BigchainDB, then you must read and accept the Contributor License Agreement (CLA) before we can merge your contributions. That can be found at [https://www.bigchaindb.com/cla](https://www.bigchaindb.com/cla). @@ -103,7 +105,7 @@ Someone will then merge your branch or suggest changes. If we suggsest changes, ## Quick Links -* [BigchainDB Community links](https://www.bigchaindb.com/community) (e.g. mailing list, Slack) +* [BigchainDB Community links](https://www.bigchaindb.com/community) * [General GitHub Documentation](https://help.github.com/) * [Code of Conduct](./CODE_OF_CONDUCT.md) * [BigchainDB Licenses](./LICENSES.md) diff --git a/README.md b/README.md index 948b879c..86a198e0 100644 --- a/README.md +++ b/README.md @@ -1,81 +1,36 @@ # BigchainDB +A scalable blockchain database. [The whitepaper](https://www.bigchaindb.com/whitepaper/) explains what that means. + [](https://gitter.im/bigchaindb/bigchaindb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://pypi.python.org/pypi/BigchainDB) [](https://travis-ci.org/bigchaindb/bigchaindb) [](https://codecov.io/github/bigchaindb/bigchaindb?branch=develop) [](http://bigchaindb.readthedocs.org/en/develop/?badge=develop) -## Documentation +## Quick Start -Documentation is available at https://bigchaindb.readthedocs.org/ +### [Install & Run BigchainDB](http://bigchaindb.readthedocs.org/en/develop/installing.html) +### [Run BigchainDB with Docker](http://bigchaindb.readthedocs.org/en/develop/installing.html#run-bigchaindb-with-docker) +### [Getting Started (Tutorial)](http://bigchaindb.readthedocs.org/en/develop/getting-started.html) -## Getting started +## Links for Everyone +* [BigchainDB.com](https://www.bigchaindb.com/) - the main BigchainDB website, including newsletter signup +* [Whitepaper](https://www.bigchaindb.com/whitepaper/) - outlines the motivations, goals and core algorithms of BigchainDB +* [Roadmap](ROADMAP.md) +* [Blog](https://medium.com/the-bigchaindb-blog) +* [Twitter](https://twitter.com/BigchainDB) +* [Google Group](https://groups.google.com/forum/#!forum/bigchaindb) -### Install RethinkDB +## Links for Developers +* [Documentation](http://bigchaindb.readthedocs.org/en/develop/#) - for developers +* [CONTRIBUTING.md](CONTRIBUTING.md) - how to contribute +* [Community guidelines](CODE_OF_CONDUCT.md) +* [Open issues](https://github.com/bigchaindb/bigchaindb/issues) +* [Open pull requests](https://github.com/bigchaindb/bigchaindb/pulls) +* [Gitter chatroom](https://gitter.im/bigchaindb/bigchaindb) -#### On Ubuntu -```sh -# install rethinkdb https://rethinkdb.com/docs/install/ubuntu/ -$ source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list -$ wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add - -$ sudo apt-get update -$ sudo apt-get install rethinkdb - -# start rethinkdb -$ rethinkdb -``` - -#### On other platforms -To install RethinkDB on other platform, please refer to [the official documentation](https://rethinkdb.com/docs/install/). - -### Install BigchainDB -```sh -$ pip install bigchaindb -``` - -### Running BigchainDB -Currently BigchainDB only supports Python 3.4+ - - -Start the main process. If it's the first time `bigchaindb` will generate a default -configuration file for you. -```sh -$ bigchaindb start -``` - -Generate some tests transactions: - -```sh -$ bigchaindb-benchmark load # add '-m' if you want to use all your cores -``` - -To know more about the bigchain command run -```sh -$ bigchaindb -h -``` - -#### Importing `BigchainDB` from the interpreter (python/ipython) -Make sure your `rethinkdb` process is running. - -```python ->>> from bigchaindb import Bigchain ->>> b = Bigchain() ->>> b.me -'2B8C8PJxhycFzn4wncRhBNmMWwE5Frr9nLBUa1dGGxj5W' -``` - -#### Configuration - -BigchainDB creates a default configuration file on `$HOME/.bigchaindb` on the -first run. - -```sh -$ bigchaindb show-config -``` - -#### Testing - -``` -$ py.test -v -``` +## Legal +* [Licenses](LICENSES.md) - open source & open content +* [Imprint](https://www.bigchaindb.com/imprint/) +* [Contact Us](https://www.bigchaindb.com/contact/) diff --git a/bigchaindb/core.py b/bigchaindb/core.py index 61c2ad2f..112af0db 100644 --- a/bigchaindb/core.py +++ b/bigchaindb/core.py @@ -190,7 +190,6 @@ class Bigchain(object): Returns: The transaction that used the `txid` as an input if it exists else it returns `None` """ - # checks if an input was already spent # checks if the bigchain has any transaction with input `transaction_id` response = r.table('bigchain').concat_map(lambda doc: doc['block']['transactions'])\ @@ -272,11 +271,12 @@ class Bigchain(object): raise exceptions.TransactionOwnerError('current_owner `{}` does not own the input `{}`'.format( transaction['transaction']['current_owner'], transaction['transaction']['input'])) - # check if the input was already spent + # check if the input was already spent by a transaction other then this one. spent = self.get_spent(tx_input['id']) if spent: - raise exceptions.DoubleSpend('input `{}` was already spent'.format( - transaction['transaction']['input'])) + if spent['id'] != transaction['id']: + raise exceptions.DoubleSpend('input `{}` was already spent'.format( + transaction['transaction']['input'])) util.check_hash_and_signature(transaction) return transaction @@ -406,14 +406,12 @@ class Bigchain(object): # 2. create the block with one transaction # 3. write the block to the bigchain - blocks_count = r.table('bigchain').count().run(self.conn) if blocks_count: raise GenesisBlockAlreadyExistsError('Cannot create the Genesis block') - - payload = {'message': 'Hello World from the Bigchain'} + payload = {'message': 'Hello World from the BigchainDB'} transaction = self.create_transaction(self.me, self.me, None, 'GENESIS', payload=payload) transaction_signed = self.sign_transaction(transaction, self.me_private) diff --git a/bigchaindb/web/views.py b/bigchaindb/web/views.py index 9d5afbe7..6f827cbb 100644 --- a/bigchaindb/web/views.py +++ b/bigchaindb/web/views.py @@ -19,7 +19,7 @@ def create_transaction(): val = {} tx = request.get_json(force=True) - if tx['operation'] == 'CREATE': + if tx['transaction']['operation'] == 'CREATE': tx = util.transform_create(tx) tx = util.sign_tx(tx, b.me_private) diff --git a/docs/source/_templates/license-template.html b/docs/source/_templates/license-template.html new file mode 100644 index 00000000..758cbb79 --- /dev/null +++ b/docs/source/_templates/license-template.html @@ -0,0 +1,4 @@ +
+This documentation is licensed under a Creative Commons Attribution 4.0 International License. +
\ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 4bdfa812..3651eb79 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -168,7 +168,8 @@ html_sidebars = { '**': ['sidebar-title-template.html', 'globaltoc.html', 'sidebar-links-template.html', - 'searchbox.html'], + 'searchbox.html', + 'license-template.html'], } # Additional templates that should be rendered to pages, maps page names to diff --git a/docs/source/installing.md b/docs/source/installing.md index 24053f47..ff51539c 100644 --- a/docs/source/installing.md +++ b/docs/source/installing.md @@ -47,6 +47,8 @@ sudo pip install bigchaindb ``` (or maybe `sudo pip3 install bigchaindb` or `sudo pip3.4 install bigchaindb`. The `sudo` may not be necessary.) +Note: You can use `pip` to upgrade bigchaindb to the latest version using `sudo pip install --upgrade bigchaindb` + ### How to Install BigchainDB from Source BigchainDB is in its early stages and being actively developed on its [GitHub repository](https://github.com/bigchaindb/bigchaindb). Contributions are highly appreciated. @@ -86,58 +88,51 @@ During its first run, BigchainDB takes care of configuring a single node environ **NOT for Production Use** For those who like using Docker and wish to experiment with BigchainDB in -non-production environments, we currently maintain a `Dockerfile` that can be +non-production environments, we currently maintain a `dockerfile` that can be used to build an image for `bigchaindb`, along with a `docker-compose.yml` file to manage a "standalone node", consisting mainly of two containers: one for -rethinkdb, and another for `bigchaindb`. +RethinkDB, and another for `bigchaindb`. Assuming you have `docker` and `docker-compose` installed, you would proceed as follows. In a terminal shell: - -```bash +```text $ git clone git@github.com:bigchaindb/bigchaindb.git ``` -Build the docker image - -```bash +Build the Docker image: +```text $ docker-compose build ``` -then, a one-time configuration step, to create the config file, which will be -stored on your host machine under ` ~/.bigchaindb_docker/config` - -```bash +then do a one-time configuration step to create the config file; it will be +stored on your host machine under ` ~/.bigchaindb_docker/config`: +```text $ docker-compose run --rm bigchaindb bigchaindb configure ``` -you can load test transactions via - -```bash +You can load test transactions via: +```text $ docker-compose run --rm bigchaindb bigchaindb-benchmark load ``` -you should then be able to start `bigchaindb`, via - -```bash +You should then be able to start `bigchaindb`, via: +```text $ docker-compose run --rm bigchaindb bigchaindb start ``` or - -```bash +```text $ docker-compose up ``` -You should be able to view the rethinkdb dashboard at - -``` +You should be able to view the RethinkDB dashboard at: +```text http://docker_host:58080/ ``` -where `docker_host` is the ip or hostname of the machine running the docker -engine. If you are developing on linux this most likely will be `localhost`, +where `docker_host` is the IP or hostname of the machine running the Docker +engine. If you are developing on Linux, this most likely will be `localhost`, whereas if you are running docker-machine (e.g.: on Mac OS X) this will be the -ip of the docher machine (`docker-machine ip machine_name`). +IP of the Docker machine (`docker-machine ip machine_name`). diff --git a/docs/source/introduction.md b/docs/source/introduction.md index 56ec1e07..e3f5ad75 100644 --- a/docs/source/introduction.md +++ b/docs/source/introduction.md @@ -8,4 +8,6 @@ BigchainDB is a scalable blockchain database. You can read about its motivations Right now, BigchainDB is fairly new, so there are no live, operational BigchainDB clusters. There are no BigchainDB drivers. Those things are coming. -What does exist is our in-development BigchainDB server software. Therefore all the documentation is about that, for now. \ No newline at end of file +What does exist is our in-development BigchainDB server software. Therefore all the documentation is about that, for now. + +If you're curious about what's coming in our roadmap, see [the ROADMAP.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/ROADMAP.md) and [the list of open issues](https://github.com/bigchaindb/bigchaindb/issues). If you want to request a feature or file a bug report, see [the CONTRIBUTING.md file](https://github.com/bigchaindb/bigchaindb/blob/develop/CONTRIBUTING.md). \ No newline at end of file diff --git a/docs/source/models.md b/docs/source/models.md index c239cfc8..267a1a84 100644 --- a/docs/source/models.md +++ b/docs/source/models.md @@ -1,6 +1,6 @@ # The Transaction, Block and Vote Models -Transactions, blocks and votes are represented using JSON documents with the following models (schemas). +Transactions, blocks and votes are represented using JSON documents with the following models (schemas). See [the section on cryptography](cryptography.html) for more information about how we calculate hashes and signatures. ## The Transaction Model @@ -22,64 +22,59 @@ Transactions, blocks and votes are represented using JSON documents with the fol } } }, - "signature": "