mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Compare commits
No commits in common. "master" and "v2.0.0b8" have entirely different histories.
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -13,6 +12,9 @@ if [[ -n ${TOXENV} ]]; then
|
||||
pip install --upgrade tox
|
||||
elif [[ ${BIGCHAINDB_CI_ABCI} == 'enable' ]]; then
|
||||
docker-compose build --no-cache --build-arg abci_status=enable bigchaindb
|
||||
elif [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then
|
||||
docker-compose build --build-arg python_version=3.5 --no-cache bigchaindb
|
||||
pip install --upgrade codecov
|
||||
elif [[ $BIGCHAINDB_INTEGRATION_TEST == 'enable' ]]; then
|
||||
docker-compose build bigchaindb python-driver
|
||||
else
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
3
.github/CONTRIBUTING.md
vendored
3
.github/CONTRIBUTING.md
vendored
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
30
.github/ISSUE_TEMPLATE/bug_report.md
vendored
30
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,30 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Logs or terminal output**
|
||||
If applicable, add add textual content to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- Distribution: [e.g. Ubuntu 18.04]
|
||||
- Bigchaindb version:
|
||||
- Tendermint version:
|
||||
- Mongodb version:
|
||||
- Python full version: [e.g. Python 3.6.6]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -95,5 +95,3 @@ network/*/data
|
||||
|
||||
# Docs that are fetched at build time
|
||||
docs/contributing/source/cross-project-policies/*.md
|
||||
|
||||
.DS_Store
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
43
.travis.yml
43
.travis.yml
@ -1,11 +1,10 @@
|
||||
# Copyright © 2020, 2021 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
sudo: required
|
||||
|
||||
dist: focal
|
||||
dist: trusty
|
||||
|
||||
services:
|
||||
- docker
|
||||
@ -14,19 +13,26 @@ language: python
|
||||
cache: pip
|
||||
|
||||
python:
|
||||
- 3.5
|
||||
- 3.6
|
||||
- 3.7
|
||||
- 3.8
|
||||
|
||||
env:
|
||||
global:
|
||||
- DOCKER_COMPOSE_VERSION=1.29.2
|
||||
- DOCKER_COMPOSE_VERSION=1.19.0
|
||||
matrix:
|
||||
- TOXENV=flake8
|
||||
- TOXENV=docsroot
|
||||
- TOXENV=docsserver
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
exclude:
|
||||
- python: 3.5
|
||||
env: TOXENV=flake8
|
||||
- python: 3.5
|
||||
env: TOXENV=docsroot
|
||||
- python: 3.5
|
||||
env: TOXENV=docsserver
|
||||
include:
|
||||
- python: 3.6
|
||||
env:
|
||||
@ -40,31 +46,6 @@ matrix:
|
||||
- python: 3.6
|
||||
env:
|
||||
- BIGCHAINDB_ACCEPTANCE_TEST=enable
|
||||
- python: 3.7
|
||||
env:
|
||||
- BIGCHAINDB_DATABASE_BACKEND=localmongodb
|
||||
- BIGCHAINDB_DATABASE_SSL=
|
||||
- python: 3.7
|
||||
env:
|
||||
- BIGCHAINDB_DATABASE_BACKEND=localmongodb
|
||||
- BIGCHAINDB_DATABASE_SSL=
|
||||
- BIGCHAINDB_CI_ABCI=enable
|
||||
- python: 3.7
|
||||
env:
|
||||
- BIGCHAINDB_ACCEPTANCE_TEST=enable
|
||||
- python: 3.8
|
||||
env:
|
||||
- BIGCHAINDB_DATABASE_BACKEND=localmongodb
|
||||
- BIGCHAINDB_DATABASE_SSL=
|
||||
- python: 3.8
|
||||
env:
|
||||
- BIGCHAINDB_DATABASE_BACKEND=localmongodb
|
||||
- BIGCHAINDB_DATABASE_SSL=
|
||||
- BIGCHAINDB_CI_ABCI=enable
|
||||
- python: 3.8
|
||||
env:
|
||||
- BIGCHAINDB_ACCEPTANCE_TEST=enable
|
||||
|
||||
|
||||
before_install: sudo .ci/travis-before-install.sh
|
||||
|
||||
|
56
CHANGELOG.md
56
CHANGELOG.md
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
@ -25,59 +24,6 @@ For reference, the possible headings are:
|
||||
* **Known Issues**
|
||||
* **Notes**
|
||||
|
||||
## [2.2.2] - 2020-08-12
|
||||
|
||||
### Security
|
||||
|
||||
Several dependencies updated including Flask that had vulnerability.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Updated priv_validator key format in stack script (#2707)
|
||||
|
||||
### External Contributors
|
||||
|
||||
* @aostrun - [#2708](https://github.com/bigchaindb/bigchaindb/pull/2708)
|
||||
|
||||
## [2.2.1] - 2020-04-14
|
||||
|
||||
### Fixed
|
||||
|
||||
Gevent library API update is incompatible with bigchaindb-abci 1.0.1 version.
|
||||
Updated bigchaindb-abci.
|
||||
|
||||
## [2.2.0] - 2020-02-20
|
||||
|
||||
### Added
|
||||
|
||||
Support for multiple ABCI versions.
|
||||
|
||||
## [2.1.0] - 2019-11-06
|
||||
|
||||
### Added
|
||||
|
||||
Option for last transaction retrieval added.
|
||||
|
||||
## [2.0] - 2019-09-26
|
||||
|
||||
### Changed
|
||||
|
||||
Migrated from Tendermint 0.22.8 to 0.31.5.
|
||||
|
||||
## [2.0 Beta 9] - 2018-11-27
|
||||
|
||||
### Changed
|
||||
|
||||
Removed support for TLSv1 and TLSv1.1 in all NGINX config files. Kept support for TLSv1.2 and added support for TLSv1.3. [Pull Request #2601](https://github.com/bigchaindb/bigchaindb/pull/2601)
|
||||
|
||||
### Fixed
|
||||
|
||||
Fixed two issues with schema validation. Pull requests [#2606](https://github.com/bigchaindb/bigchaindb/pull/2606) & [#2607](https://github.com/bigchaindb/bigchaindb/pull/2607)
|
||||
|
||||
### External Contributors
|
||||
|
||||
[@gamjapark](https://github.com/gamjapark) and team translated all the [BigchainDB root docs](https://docs.bigchaindb.com/en/latest/korean/index.html) into Korean. [Pull Request #2603](https://github.com/bigchaindb/bigchaindb/pull/2603)
|
||||
|
||||
## [2.0 Beta 8] - 2018-11-03
|
||||
|
||||
### Changed
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
@ -42,7 +41,7 @@ This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior directed at yourself or another community member may be
|
||||
reported by contacting a project maintainer at [contact@bigchaindb.com](mailto:contact@bigchaindb.com). All
|
||||
reported by contacting a project maintainer at [conduct@bigchaindb.com](mailto:conduct@bigchaindb.com). All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is appropriate to the circumstances. Maintainers are
|
||||
obligated to maintain confidentiality with regard to the reporter of an
|
||||
|
@ -1,12 +1,12 @@
|
||||
FROM python:3.6
|
||||
LABEL maintainer "contact@ipdb.global"
|
||||
LABEL maintainer "dev@bigchaindb.com"
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY . /usr/src/app/
|
||||
WORKDIR /usr/src/app
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get -y upgrade \
|
||||
&& apt-get install -y jq \
|
||||
&& pip install . \
|
||||
&& pip install --no-cache-dir --process-dependency-links . \
|
||||
&& apt-get autoremove \
|
||||
&& apt-get clean
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
FROM alpine:3.9
|
||||
LABEL maintainer "contact@ipdb.global"
|
||||
FROM alpine:latest
|
||||
LABEL maintainer "dev@bigchaindb.com"
|
||||
|
||||
ARG TM_VERSION=v0.31.5
|
||||
ARG TM_VERSION=0.22.8
|
||||
RUN mkdir -p /usr/src/app
|
||||
ENV HOME /root
|
||||
COPY . /usr/src/app/
|
||||
@ -13,7 +13,7 @@ RUN apk --update add sudo bash \
|
||||
libffi-dev openssl-dev build-base jq \
|
||||
&& apk add --no-cache libstdc++ dpkg gnupg \
|
||||
&& pip3 install --upgrade pip cffi \
|
||||
&& pip install -e . \
|
||||
&& pip install --no-cache-dir --process-dependency-links -e . \
|
||||
&& apk del build-dependencies \
|
||||
&& rm -f /var/cache/apk/*
|
||||
|
||||
@ -21,7 +21,7 @@ RUN apk --update add sudo bash \
|
||||
RUN apk --update add mongodb monit
|
||||
|
||||
# Install Tendermint
|
||||
RUN wget https://github.com/tendermint/tendermint/releases/download/${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.zip \
|
||||
RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.zip \
|
||||
&& unzip tendermint_${TM_VERSION}_linux_amd64.zip \
|
||||
&& mv tendermint /usr/local/bin/ \
|
||||
&& rm tendermint_${TM_VERSION}_linux_amd64.zip
|
||||
|
@ -1,15 +1,15 @@
|
||||
FROM alpine:latest
|
||||
LABEL maintainer "contact@ipdb.global"
|
||||
LABEL maintainer "dev@bigchaindb.com"
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY . /usr/src/app/
|
||||
WORKDIR /usr/src/app
|
||||
RUN apk --update add sudo \
|
||||
&& apk --update add python3 py-pip openssl ca-certificates git\
|
||||
&& apk --update add python3 openssl ca-certificates git\
|
||||
&& apk --update add --virtual build-dependencies python3-dev \
|
||||
libffi-dev openssl-dev build-base \
|
||||
&& apk add --no-cache libstdc++ \
|
||||
&& pip3 install --upgrade pip cffi \
|
||||
&& pip install -e . \
|
||||
&& pip install --no-cache-dir --process-dependency-links -e .[dev] \
|
||||
&& apk del build-dependencies \
|
||||
&& rm -f /var/cache/apk/*
|
||||
# When developing with Python in a docker container, we are using PYTHONBUFFERED
|
||||
|
@ -1,10 +1,11 @@
|
||||
ARG python_version=3.6
|
||||
FROM python:${python_version}
|
||||
LABEL maintainer "contact@ipdb.global"
|
||||
LABEL maintainer "dev@bigchaindb.com"
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y git \
|
||||
&& apt-get install -y vim \
|
||||
&& pip install -U pip \
|
||||
&& pip install pynacl \
|
||||
&& apt-get autoremove \
|
||||
&& apt-get clean
|
||||
|
||||
@ -31,5 +32,5 @@ ENV BIGCHAINDB_CI_ABCI ${abci_status}
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY . /usr/src/app/
|
||||
WORKDIR /usr/src/app
|
||||
RUN pip install -e .[dev]
|
||||
RUN bigchaindb -y configure
|
||||
RUN pip install --no-cache-dir --process-dependency-links -e .[dev]
|
||||
RUN bigchaindb -y configure
|
9
HOW_TO_HANDLE_PULL_REQUESTS.md
Normal file
9
HOW_TO_HANDLE_PULL_REQUESTS.md
Normal file
@ -0,0 +1,9 @@
|
||||
<!---
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
||||
# How to Handle External Pull Requests
|
||||
|
||||
See [BEP-16](https://github.com/bigchaindb/BEPs/tree/master/16).
|
@ -2,12 +2,10 @@
|
||||
|
||||
## Copyrights
|
||||
|
||||
For all the code and documentation in this repository, the copyright is owned by one or more of the following:
|
||||
Except as noted in the **Exceptions** section below, for all code and documentation in this repository, BigchainDB GmbH ("We") either:
|
||||
|
||||
- BigchainDB GmbH
|
||||
- A BigchainDB contributor who agreed to a BigchainDB Contributor License Agreement (CLA) with BigchainDB GmbH. (See [BEP-16](https://github.com/bigchaindb/BEPs/tree/master/16).)
|
||||
- A BigchainDB contributor who signed off on the Developer Certificate of Origin (DCO) for all their contributions. (See [BEP-24](https://github.com/bigchaindb/BEPs/tree/master/24).)
|
||||
- (Rarely, see the **Exceptions Section** below) A third pary who licensed the code in question under an open source license.
|
||||
1. owns the copyright, or
|
||||
2. owns the right to sublicense it under any license (because all external contributors must agree to a Contributor License Agreement).
|
||||
|
||||
## Code Licenses
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -88,6 +88,8 @@ cov: check-deps ## Check code coverage and open the result in the browser
|
||||
|
||||
doc: check-deps ## Generate HTML documentation and open it in the browser
|
||||
@$(DC) run --rm --no-deps bdocs make -C docs/root html
|
||||
@$(DC) run --rm --no-deps bdocs make -C docs/server html
|
||||
@$(DC) run --rm --no-deps bdocs make -C docs/contributing html
|
||||
$(BROWSER) docs/root/build/html/index.html
|
||||
|
||||
doc-acceptance: check-deps ## Create documentation for acceptance tests
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
@ -92,6 +91,6 @@ flake8 --max-line-length 119 bigchaindb/
|
||||
|
||||
## Writing and Running (Python) Tests
|
||||
|
||||
The content of this section was moved to [`bigchaindb/tests/README.md`](https://github.com/bigchaindb/bigchaindb/blob/master/tests/README.md).
|
||||
The content of this section was moved to [`bigchaindb/tests/README.md`](./tests/README.md).
|
||||
|
||||
Note: We automatically run all tests on all pull requests (using Travis CI), so you should definitely run all tests locally before you submit a pull request. See the above-linked README file for instructions.
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
@ -13,7 +12,7 @@ so show the latest GitHub release instead.
|
||||
[](https://codecov.io/github/bigchaindb/bigchaindb?branch=master)
|
||||
[](https://github.com/bigchaindb/bigchaindb/releases)
|
||||
[](https://pypi.org/project/BigchainDB/)
|
||||
[](https://travis-ci.com/bigchaindb/bigchaindb)
|
||||
[](https://travis-ci.org/bigchaindb/bigchaindb)
|
||||
[](https://docs.bigchaindb.com/projects/server/en/latest/)
|
||||
[](https://gitter.im/bigchaindb/bigchaindb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
|
77
README_cn.md
77
README_cn.md
@ -1,77 +0,0 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
||||
<!--- There is no shield to get the latest version
|
||||
(including pre-release versions) from PyPI,
|
||||
so show the latest GitHub release instead.
|
||||
--->
|
||||
|
||||
[](https://codecov.io/github/bigchaindb/bigchaindb?branch=master)
|
||||
[](https://github.com/bigchaindb/bigchaindb/releases)
|
||||
[](https://pypi.org/project/BigchainDB/)
|
||||
[](https://travis-ci.com/bigchaindb/bigchaindb)
|
||||
[](https://docs.bigchaindb.com/projects/server/en/latest/)
|
||||
[](https://gitter.im/bigchaindb/bigchaindb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
# BigchainDB 服务器
|
||||
|
||||
BigchainDB 是区块链数据库. 这是 _BigchainDB 服务器_ 的仓库.
|
||||
|
||||
## 基础知识
|
||||
|
||||
* [尝试快速开始](https://docs.bigchaindb.com/projects/server/en/latest/quickstart.html)
|
||||
* [阅读 BigchainDB 2.0 白皮书](https://www.bigchaindb.com/whitepaper/)
|
||||
* [查阅漫游指南](https://www.bigchaindb.com/developers/guide/)
|
||||
|
||||
## 运行和测试 `master` 分支的 BigchainDB 服务器
|
||||
|
||||
运行和测试最新版本的 BigchainDB 服务器非常简单. 确认你有安装最新版本的 [Docker Compose](https://docs.docker.com/compose/install/). 当你准备好了, 打开一个终端并运行:
|
||||
|
||||
```text
|
||||
git clone https://github.com/bigchaindb/bigchaindb.git
|
||||
cd bigchaindb
|
||||
make run
|
||||
```
|
||||
|
||||
BigchainDB 应该可以通过 `http://localhost:9984/` 访问.
|
||||
|
||||
这里也有一些其他的命令你可以运行:
|
||||
|
||||
* `make start`: 通过源码和守护进程的方式运行 BigchainDB (通过 `make stop` 停止).
|
||||
* `make stop`: 停止运行 BigchainDB.
|
||||
* `make logs`: 附在日志上.
|
||||
* `make test`: 运行所有单元和验收测试.
|
||||
* `make test-unit-watch`: 运行所有测试并等待. 每次更改代码时都会再次运行测试.
|
||||
* `make cov`: 检查代码覆盖率并在浏览器中打开结果.
|
||||
* `make doc`: 生成 HTML 文档并在浏览器中打开它.
|
||||
* `make clean`: 删除所有构建, 测试, 覆盖和 Python 生成物.
|
||||
* `make reset`: 停止并移除所有容器. 警告: 您将丢失存储在 BigchainDB 中的所有数据.
|
||||
|
||||
查看所有可用命令, 请运行 `make`.
|
||||
|
||||
## 一般人员链接
|
||||
|
||||
* [BigchainDB.com](https://www.bigchaindb.com/) - BigchainDB 主网站, 包括新闻订阅
|
||||
* [路线图](https://github.com/bigchaindb/org/blob/master/ROADMAP.md)
|
||||
* [博客](https://medium.com/the-bigchaindb-blog)
|
||||
* [推特](https://twitter.com/BigchainDB)
|
||||
|
||||
## 开发人员链接
|
||||
|
||||
* [所有的 BigchainDB 文档](https://docs.bigchaindb.com/en/latest/)
|
||||
* [BigchainDB 服务器 文档](https://docs.bigchaindb.com/projects/server/en/latest/index.html)
|
||||
* [CONTRIBUTING.md](.github/CONTRIBUTING.md) - how to contribute
|
||||
* [社区指南](CODE_OF_CONDUCT.md)
|
||||
* [公开问题](https://github.com/bigchaindb/bigchaindb/issues)
|
||||
* [公开的 pull request](https://github.com/bigchaindb/bigchaindb/pulls)
|
||||
* [Gitter 聊天室](https://gitter.im/bigchaindb/bigchaindb)
|
||||
|
||||
## 法律声明
|
||||
|
||||
* [许可](LICENSES.md) - 开源代码 & 开源内容
|
||||
* [印记](https://www.bigchaindb.com/imprint/)
|
||||
* [联系我们](https://www.bigchaindb.com/contact/)
|
@ -62,4 +62,4 @@ make run
|
||||
|
||||
* [라이선스](https://github.com/bigchaindb/bigchaindb/blob/master/LICENSES.md) - 오픈 소스 & 오픈 콘텐츠
|
||||
* [발행](https://www.bigchaindb.com/imprint/)
|
||||
* [연락처](https://www.bigchaindb.com/contact/)
|
||||
* [연락처](https://www.bigchaindb.com/contact/)
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
@ -46,39 +45,36 @@ The following steps are what we do to release a new version of _BigchainDB Serve
|
||||
- In `bigchaindb/version.py`:
|
||||
- update `__version__` to e.g. `0.9.0` (with no `.dev` on the end)
|
||||
- update `__short_version__` to e.g. `0.9` (with no `.dev` on the end)
|
||||
- In the docs about installing BigchainDB (and Tendermint), and in the associated scripts, recommend/install a version of Tendermint that _actually works_ with the soon-to-be-released version of BigchainDB. You can find all such references by doing a search for the previously-recommended version number, such as `0.31.5`.
|
||||
- In the docs about installing BigchainDB (and Tendermint), and in the associated scripts, recommend/install a version of Tendermint that _actually works_ with the soon-to-be-released version of BigchainDB. You can find all such references by doing a search for the previously-recommended version number, such as `0.22.8`.
|
||||
- In `setup.py`, _maybe_ update the development status item in the `classifiers` list. For example, one allowed value is `"Development Status :: 5 - Production/Stable"`. The [allowed values are listed at pypi.python.org](https://pypi.python.org/pypi?%3Aaction=list_classifiers).
|
||||
|
||||
2. **Wait for all the tests to pass!**
|
||||
3. Merge the pull request into the `master` branch.
|
||||
4. Go to the [bigchaindb/bigchaindb Releases page on GitHub](https://github.com/bigchaindb/bigchaindb/releases)
|
||||
1. **Wait for all the tests to pass!**
|
||||
1. Merge the pull request into the `master` branch.
|
||||
1. Go to the [bigchaindb/bigchaindb Releases page on GitHub](https://github.com/bigchaindb/bigchaindb/releases)
|
||||
and click the "Draft a new release" button.
|
||||
5. Fill in the details:
|
||||
1. Fill in the details:
|
||||
- **Tag version:** version number preceded by `v`, e.g. `v0.9.1`
|
||||
- **Target:** the last commit that was just merged. In other words, that commit will get a Git tag with the value given for tag version above.
|
||||
- **Title:** Same as tag version above, e.g `v0.9.1`
|
||||
- **Description:** The body of the changelog entry (Added, Changed, etc.)
|
||||
6. Click "Publish release" to publish the release on GitHub.
|
||||
7. On your local computer, make sure you're on the `master` branch and that it's up-to-date with the `master` branch in the bigchaindb/bigchaindb repository (e.g. `git pull upstream master`). We're going to use that to push a new `bigchaindb` package to PyPI.
|
||||
8. Make sure you have a `~/.pypirc` file containing credentials for PyPI.
|
||||
9. Do `make release` to build and publish the new `bigchaindb` package on PyPI. For this step you need to have `twine` installed. If you get an error like `Makefile:135: recipe for target 'clean-pyc' failed` then try doing
|
||||
1. Click "Publish release" to publish the release on GitHub.
|
||||
1. On your local computer, make sure you're on the `master` branch and that it's up-to-date with the `master` branch in the bigchaindb/bigchaindb repository (e.g. `git pull upstream master`). We're going to use that to push a new `bigchaindb` package to PyPI.
|
||||
1. Make sure you have a `~/.pypirc` file containing credentials for PyPI.
|
||||
1. Do `make release` to build and publish the new `bigchaindb` package on PyPI. For this step you need to have `twine` installed. If you get an error like `Makefile:135: recipe for target 'clean-pyc' failed` then try doing
|
||||
```text
|
||||
sudo chown -R $(whoami):$(whoami) .
|
||||
```
|
||||
10. [Log in to readthedocs.org](https://readthedocs.org/accounts/login/) and go to the **BigchainDB Server** project, then:
|
||||
- Click on "Builds", select "latest" from the drop-down menu, then click the "Build Version:" button.
|
||||
- Wait for the build of "latest" to finish. This can take a few minutes.
|
||||
1. [Log in to readthedocs.org](https://readthedocs.org/accounts/login/) and go to the **BigchainDB Server** project, then:
|
||||
- Go to Admin --> Advanced Settings
|
||||
and make sure that "Default branch:" (i.e. what "latest" points to)
|
||||
is set to the new release's tag, e.g. `v0.9.1`.
|
||||
(It won't be an option if you didn't wait for the build of "latest" to finish.)
|
||||
Then scroll to the bottom and click "Save".
|
||||
(Don't miss the `v` in front.)
|
||||
- Go to Admin --> Versions
|
||||
and under **Choose Active Versions**, do these things:
|
||||
1. Make sure that the new version's tag is "Active" and "Public"
|
||||
2. Make sure the **stable** branch is _not_ active.
|
||||
3. Scroll to the bottom of the page and click "Save".
|
||||
11. Go to [Docker Hub](https://hub.docker.com/) and sign in, then:
|
||||
1. Make sure the **stable** branch is _not_ active.
|
||||
1. Scroll to the bottom of the page and click the "Submit" button.
|
||||
1. Go to [Docker Hub](https://hub.docker.com/) and sign in, then:
|
||||
- Click on "Organizations"
|
||||
- Click on "bigchaindb"
|
||||
- Click on "bigchaindb/bigchaindb"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -66,12 +65,8 @@ def send_naughty_tx(asset, metadata):
|
||||
# Then she expects a nicely formatted error code
|
||||
status_code = sent_transaction.status_code
|
||||
error = sent_transaction.error
|
||||
regex = (
|
||||
r'\{\s*\n*'
|
||||
r'\s*"message":\s*"Invalid transaction \(ValidationError\):\s*'
|
||||
r'Invalid key name.*The key name cannot contain characters.*\n*'
|
||||
r'\s*"status":\s*400\n*'
|
||||
r'\s*\}\n*')
|
||||
regex = '\{"message":"Invalid transaction \\(ValidationError\\): Invalid key name .* in asset object. ' \
|
||||
'The key name cannot contain characters .* or null characters","status":400\}\n'
|
||||
assert status_code == 400
|
||||
assert re.fullmatch(regex, error), sent_transaction
|
||||
# Otherwise, she expects to see her transaction in the database
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -71,7 +70,6 @@ config = {
|
||||
'tendermint': {
|
||||
'host': 'localhost',
|
||||
'port': 26657,
|
||||
'version': 'v0.31.5', # look for __tm_supported_versions__
|
||||
},
|
||||
# FIXME: hardcoding to localmongodb for now
|
||||
'database': _database_map['localmongodb'],
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import logging
|
||||
from importlib import import_module
|
||||
from itertools import repeat
|
||||
from importlib import import_module
|
||||
import logging
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb.backend.exceptions import ConnectionError
|
||||
from bigchaindb.backend.utils import get_bigchaindb_config_value, get_bigchaindb_config_value_or_key_error
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
from bigchaindb.backend.exceptions import ConnectionError
|
||||
|
||||
|
||||
BACKENDS = {
|
||||
'localmongodb': 'bigchaindb.backend.localmongodb.connection.LocalMongoDBConnection',
|
||||
@ -48,10 +47,10 @@ def connect(backend=None, host=None, port=None, name=None, max_tries=None,
|
||||
Authentication failure after connecting to the database.
|
||||
"""
|
||||
|
||||
backend = backend or get_bigchaindb_config_value_or_key_error('backend')
|
||||
host = host or get_bigchaindb_config_value_or_key_error('host')
|
||||
port = port or get_bigchaindb_config_value_or_key_error('port')
|
||||
dbname = name or get_bigchaindb_config_value_or_key_error('name')
|
||||
backend = backend or bigchaindb.config['database']['backend']
|
||||
host = host or bigchaindb.config['database']['host']
|
||||
port = port or bigchaindb.config['database']['port']
|
||||
dbname = name or bigchaindb.config['database']['name']
|
||||
# Not sure how to handle this here. This setting is only relevant for
|
||||
# mongodb.
|
||||
# I added **kwargs for both RethinkDBConnection and MongoDBConnection
|
||||
@ -61,15 +60,15 @@ def connect(backend=None, host=None, port=None, name=None, max_tries=None,
|
||||
# UPD: RethinkDBConnection is not here anymore cause we no longer support RethinkDB.
|
||||
# The problem described above might be reconsidered next time we introduce a backend,
|
||||
# if it ever happens.
|
||||
replicaset = replicaset or get_bigchaindb_config_value('replicaset')
|
||||
ssl = ssl if ssl is not None else get_bigchaindb_config_value('ssl', False)
|
||||
login = login or get_bigchaindb_config_value('login')
|
||||
password = password or get_bigchaindb_config_value('password')
|
||||
ca_cert = ca_cert or get_bigchaindb_config_value('ca_cert')
|
||||
certfile = certfile or get_bigchaindb_config_value('certfile')
|
||||
keyfile = keyfile or get_bigchaindb_config_value('keyfile')
|
||||
keyfile_passphrase = keyfile_passphrase or get_bigchaindb_config_value('keyfile_passphrase', None)
|
||||
crlfile = crlfile or get_bigchaindb_config_value('crlfile')
|
||||
replicaset = replicaset or bigchaindb.config['database'].get('replicaset')
|
||||
ssl = ssl if ssl is not None else bigchaindb.config['database'].get('ssl', False)
|
||||
login = login or bigchaindb.config['database'].get('login')
|
||||
password = password or bigchaindb.config['database'].get('password')
|
||||
ca_cert = ca_cert or bigchaindb.config['database'].get('ca_cert', None)
|
||||
certfile = certfile or bigchaindb.config['database'].get('certfile', None)
|
||||
keyfile = keyfile or bigchaindb.config['database'].get('keyfile', None)
|
||||
keyfile_passphrase = keyfile_passphrase or bigchaindb.config['database'].get('keyfile_passphrase', None)
|
||||
crlfile = crlfile or bigchaindb.config['database'].get('crlfile', None)
|
||||
|
||||
try:
|
||||
module_name, _, class_name = BACKENDS[backend].rpartition('.')
|
||||
@ -118,7 +117,7 @@ class Connection:
|
||||
self.host = host or dbconf['host']
|
||||
self.port = port or dbconf['port']
|
||||
self.dbname = dbname or dbconf['name']
|
||||
self.connection_timeout = connection_timeout if connection_timeout is not None \
|
||||
self.connection_timeout = connection_timeout if connection_timeout is not None\
|
||||
else dbconf['connection_timeout']
|
||||
self.max_tries = max_tries if max_tries is not None else dbconf['max_tries']
|
||||
self.max_tries_counter = range(self.max_tries) if self.max_tries != 0 else repeat(0)
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -8,13 +7,13 @@ from ssl import CERT_REQUIRED
|
||||
|
||||
import pymongo
|
||||
|
||||
from bigchaindb.backend.connection import Connection
|
||||
import bigchaindb
|
||||
from bigchaindb.utils import Lazy
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
from bigchaindb.backend.exceptions import (DuplicateKeyError,
|
||||
OperationError,
|
||||
ConnectionError)
|
||||
from bigchaindb.backend.utils import get_bigchaindb_config_value
|
||||
from bigchaindb.common.exceptions import ConfigurationError
|
||||
from bigchaindb.utils import Lazy
|
||||
from bigchaindb.backend.connection import Connection
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -34,15 +33,15 @@ class LocalMongoDBConnection(Connection):
|
||||
"""
|
||||
|
||||
super().__init__(**kwargs)
|
||||
self.replicaset = replicaset or get_bigchaindb_config_value('replicaset')
|
||||
self.ssl = ssl if ssl is not None else get_bigchaindb_config_value('ssl', False)
|
||||
self.login = login or get_bigchaindb_config_value('login')
|
||||
self.password = password or get_bigchaindb_config_value('password')
|
||||
self.ca_cert = ca_cert or get_bigchaindb_config_value('ca_cert')
|
||||
self.certfile = certfile or get_bigchaindb_config_value('certfile')
|
||||
self.keyfile = keyfile or get_bigchaindb_config_value('keyfile')
|
||||
self.keyfile_passphrase = keyfile_passphrase or get_bigchaindb_config_value('keyfile_passphrase')
|
||||
self.crlfile = crlfile or get_bigchaindb_config_value('crlfile')
|
||||
self.replicaset = replicaset or bigchaindb.config['database'].get('replicaset')
|
||||
self.ssl = ssl if ssl is not None else bigchaindb.config['database'].get('ssl', False)
|
||||
self.login = login or bigchaindb.config['database'].get('login')
|
||||
self.password = password or bigchaindb.config['database'].get('password')
|
||||
self.ca_cert = ca_cert or bigchaindb.config['database'].get('ca_cert', None)
|
||||
self.certfile = certfile or bigchaindb.config['database'].get('certfile', None)
|
||||
self.keyfile = keyfile or bigchaindb.config['database'].get('keyfile', None)
|
||||
self.keyfile_passphrase = keyfile_passphrase or bigchaindb.config['database'].get('keyfile_passphrase', None)
|
||||
self.crlfile = crlfile or bigchaindb.config['database'].get('crlfile', None)
|
||||
|
||||
@property
|
||||
def db(self):
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -121,19 +120,29 @@ def store_block(conn, block):
|
||||
|
||||
|
||||
@register_query(LocalMongoDBConnection)
|
||||
def get_txids_filtered(conn, asset_id, operation=None, last_tx=None):
|
||||
def get_txids_filtered(conn, asset_id, operation=None):
|
||||
match_create = {
|
||||
'operation': 'CREATE',
|
||||
'id': asset_id
|
||||
}
|
||||
match_transfer = {
|
||||
'operation': 'TRANSFER',
|
||||
'asset.id': asset_id
|
||||
}
|
||||
|
||||
match = {
|
||||
Transaction.CREATE: {'operation': 'CREATE', 'id': asset_id},
|
||||
Transaction.TRANSFER: {'operation': 'TRANSFER', 'asset.id': asset_id},
|
||||
None: {'$or': [{'asset.id': asset_id}, {'id': asset_id}]},
|
||||
}[operation]
|
||||
|
||||
cursor = conn.run(conn.collection('transactions').find(match))
|
||||
|
||||
if last_tx:
|
||||
cursor = cursor.sort([('$natural', DESCENDING)]).limit(1)
|
||||
if operation == Transaction.CREATE:
|
||||
match = match_create
|
||||
elif operation == Transaction.TRANSFER:
|
||||
match = match_transfer
|
||||
else:
|
||||
match = {'$or': [match_create, match_transfer]}
|
||||
|
||||
pipeline = [
|
||||
{'$match': match}
|
||||
]
|
||||
cursor = conn.run(
|
||||
conn.collection('transactions')
|
||||
.aggregate(pipeline))
|
||||
return (elem['id'] for elem in cursor)
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -11,7 +10,7 @@ import logging
|
||||
import bigchaindb
|
||||
from bigchaindb.backend.connection import connect
|
||||
from bigchaindb.common.exceptions import ValidationError
|
||||
from bigchaindb.common.utils import validate_all_values_for_key_in_obj, validate_all_values_for_key_in_list
|
||||
from bigchaindb.common.utils import validate_all_values_for_key
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -102,9 +101,7 @@ def validate_language_key(obj, key):
|
||||
if backend == 'localmongodb':
|
||||
data = obj.get(key, {})
|
||||
if isinstance(data, dict):
|
||||
validate_all_values_for_key_in_obj(data, 'language', validate_language)
|
||||
elif isinstance(data, list):
|
||||
validate_all_values_for_key_in_list(data, 'language', validate_language)
|
||||
validate_all_values_for_key(data, 'language', validate_language)
|
||||
|
||||
|
||||
def validate_language(value):
|
||||
|
@ -1,10 +1,7 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import bigchaindb
|
||||
|
||||
|
||||
class ModuleDispatchRegistrationError(Exception):
|
||||
"""Raised when there is a problem registering dispatched functions for a
|
||||
@ -24,16 +21,6 @@ def module_dispatch_registrar(module):
|
||||
('`{module}` does not contain a single-dispatchable '
|
||||
'function named `{func}`. The module being registered '
|
||||
'was not implemented correctly!').format(
|
||||
func=func_name, module=module.__name__)) from ex
|
||||
|
||||
func=func_name, module=module.__name__)) from ex
|
||||
return wrapper
|
||||
|
||||
return dispatch_wrapper
|
||||
|
||||
|
||||
def get_bigchaindb_config_value(key, default_value=None):
|
||||
return bigchaindb.config['database'].get(key, default_value)
|
||||
|
||||
|
||||
def get_bigchaindb_config_value_or_key_error(key):
|
||||
return bigchaindb.config['database'][key]
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -17,7 +16,6 @@ import sys
|
||||
from bigchaindb.core import rollback
|
||||
from bigchaindb.migrations.chain_migration_election import ChainMigrationElection
|
||||
from bigchaindb.utils import load_node_key
|
||||
from bigchaindb.common.transaction_mode_types import BROADCAST_TX_COMMIT
|
||||
from bigchaindb.common.exceptions import (DatabaseDoesNotExist,
|
||||
ValidationError)
|
||||
from bigchaindb.elections.vote import Vote
|
||||
@ -133,7 +131,7 @@ def create_new_election(sk, bigchain, election_class, data):
|
||||
logger.error(fd_404)
|
||||
return False
|
||||
|
||||
resp = bigchain.write_transaction(election, BROADCAST_TX_COMMIT)
|
||||
resp = bigchain.write_transaction(election, 'broadcast_tx_commit')
|
||||
if resp == (202, ''):
|
||||
logger.info('[SUCCESS] Submitted proposal with id: {}'.format(election.id))
|
||||
return election.id
|
||||
@ -208,7 +206,7 @@ def run_election_approve(args, bigchain):
|
||||
tx.id).sign([key.private_key])
|
||||
approval.validate(bigchain)
|
||||
|
||||
resp = bigchain.write_transaction(approval, BROADCAST_TX_COMMIT)
|
||||
resp = bigchain.write_transaction(approval, 'broadcast_tx_commit')
|
||||
|
||||
if resp == (202, ''):
|
||||
logger.info('[SUCCESS] Your vote has been submitted')
|
||||
@ -263,6 +261,7 @@ def run_drop(args):
|
||||
return
|
||||
|
||||
conn = backend.connect()
|
||||
dbname = bigchaindb.config['database']['name']
|
||||
try:
|
||||
schema.drop_database(conn, dbname)
|
||||
except DatabaseDoesNotExist:
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,16 +1,11 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
# Separate all crypto code so that we can easily test several implementations
|
||||
from collections import namedtuple
|
||||
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
|
||||
import sha3
|
||||
from cryptoconditions import crypto
|
||||
|
||||
|
||||
@ -19,7 +14,7 @@ CryptoKeypair = namedtuple('CryptoKeypair', ('private_key', 'public_key'))
|
||||
|
||||
def hash_data(data):
|
||||
"""Hash the provided data using SHA3-256"""
|
||||
return sha3_256(data.encode()).hexdigest()
|
||||
return sha3.sha3_256(data.encode()).hexdigest()
|
||||
|
||||
|
||||
def generate_key_pair():
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -20,10 +19,7 @@ import base58
|
||||
from cryptoconditions import Fulfillment, ThresholdSha256, Ed25519Sha256
|
||||
from cryptoconditions.exceptions import (
|
||||
ParsingError, ASN1DecodeError, ASN1EncodeError, UnsupportedTypeError)
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
from sha3 import sha3_256
|
||||
from sha3 import sha3_256
|
||||
|
||||
from bigchaindb.common.crypto import PrivateKey, hash_data
|
||||
from bigchaindb.common.exceptions import (KeypairMismatchException,
|
||||
@ -78,7 +74,7 @@ class Input(object):
|
||||
if fulfills is not None and not isinstance(fulfills, TransactionLink):
|
||||
raise TypeError('`fulfills` must be a TransactionLink instance')
|
||||
if not isinstance(owners_before, list):
|
||||
raise TypeError('`owners_before` must be a list instance')
|
||||
raise TypeError('`owners_after` must be a list instance')
|
||||
|
||||
self.fulfillment = fulfillment
|
||||
self.fulfills = fulfills
|
||||
@ -546,7 +542,7 @@ class Transaction(object):
|
||||
elif (operation == self.TRANSFER and
|
||||
not (isinstance(asset, dict) and 'id' in asset)):
|
||||
raise TypeError(('`asset` must be a dict holding an `id` property '
|
||||
'for \'TRANSFER\' Transactions'))
|
||||
"for 'TRANSFER' Transactions".format(operation)))
|
||||
|
||||
if outputs and not isinstance(outputs, list):
|
||||
raise TypeError('`outputs` must be a list instance or None')
|
||||
@ -869,9 +865,8 @@ class Transaction(object):
|
||||
return cls._sign_threshold_signature_fulfillment(input_, message,
|
||||
key_pairs)
|
||||
else:
|
||||
raise ValueError(
|
||||
'Fulfillment couldn\'t be matched to '
|
||||
'Cryptocondition fulfillment type.')
|
||||
raise ValueError("Fulfillment couldn't be matched to "
|
||||
'Cryptocondition fulfillment type.')
|
||||
|
||||
@classmethod
|
||||
def _sign_simple_signature_fulfillment(cls, input_, message, key_pairs):
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
BROADCAST_TX_COMMIT = 'broadcast_tx_commit'
|
||||
BROADCAST_TX_ASYNC = 'broadcast_tx_async'
|
||||
BROADCAST_TX_SYNC = 'broadcast_tx_sync'
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -77,20 +76,10 @@ def validate_txn_obj(obj_name, obj, key, validation_fun):
|
||||
if backend == 'localmongodb':
|
||||
data = obj.get(key, {})
|
||||
if isinstance(data, dict):
|
||||
validate_all_keys_in_obj(obj_name, data, validation_fun)
|
||||
elif isinstance(data, list):
|
||||
validate_all_items_in_list(obj_name, data, validation_fun)
|
||||
validate_all_keys(obj_name, data, validation_fun)
|
||||
|
||||
|
||||
def validate_all_items_in_list(obj_name, data, validation_fun):
|
||||
for item in data:
|
||||
if isinstance(item, dict):
|
||||
validate_all_keys_in_obj(obj_name, item, validation_fun)
|
||||
elif isinstance(item, list):
|
||||
validate_all_items_in_list(obj_name, item, validation_fun)
|
||||
|
||||
|
||||
def validate_all_keys_in_obj(obj_name, obj, validation_fun):
|
||||
def validate_all_keys(obj_name, obj, validation_fun):
|
||||
"""Validate all (nested) keys in `obj` by using `validation_fun`.
|
||||
|
||||
Args:
|
||||
@ -108,12 +97,10 @@ def validate_all_keys_in_obj(obj_name, obj, validation_fun):
|
||||
for key, value in obj.items():
|
||||
validation_fun(obj_name, key)
|
||||
if isinstance(value, dict):
|
||||
validate_all_keys_in_obj(obj_name, value, validation_fun)
|
||||
elif isinstance(value, list):
|
||||
validate_all_items_in_list(obj_name, value, validation_fun)
|
||||
validate_all_keys(obj_name, value, validation_fun)
|
||||
|
||||
|
||||
def validate_all_values_for_key_in_obj(obj, key, validation_fun):
|
||||
def validate_all_values_for_key(obj, key, validation_fun):
|
||||
"""Validate value for all (nested) occurrence of `key` in `obj`
|
||||
using `validation_fun`.
|
||||
|
||||
@ -130,17 +117,7 @@ def validate_all_values_for_key_in_obj(obj, key, validation_fun):
|
||||
if vkey == key:
|
||||
validation_fun(value)
|
||||
elif isinstance(value, dict):
|
||||
validate_all_values_for_key_in_obj(value, key, validation_fun)
|
||||
elif isinstance(value, list):
|
||||
validate_all_values_for_key_in_list(value, key, validation_fun)
|
||||
|
||||
|
||||
def validate_all_values_for_key_in_list(input_list, key, validation_fun):
|
||||
for item in input_list:
|
||||
if isinstance(item, dict):
|
||||
validate_all_values_for_key_in_obj(item, key, validation_fun)
|
||||
elif isinstance(item, list):
|
||||
validate_all_values_for_key_in_list(item, key, validation_fun)
|
||||
validate_all_values_for_key(value, key, validation_fun)
|
||||
|
||||
|
||||
def validate_key(obj_name, key):
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -20,7 +19,7 @@ import os
|
||||
import copy
|
||||
import json
|
||||
import logging
|
||||
import collections.abc
|
||||
import collections
|
||||
from functools import lru_cache
|
||||
|
||||
from pkg_resources import iter_entry_points, ResolutionError
|
||||
@ -52,7 +51,7 @@ def map_leafs(func, mapping):
|
||||
path = []
|
||||
|
||||
for key, val in mapping.items():
|
||||
if isinstance(val, collections.abc.Mapping):
|
||||
if isinstance(val, collections.Mapping):
|
||||
_inner(val, path + [key])
|
||||
else:
|
||||
mapping[key] = func(val, path=path+[key])
|
||||
@ -80,7 +79,7 @@ def update(d, u):
|
||||
mapping: An updated version of d (updated by u).
|
||||
"""
|
||||
for k, v in u.items():
|
||||
if isinstance(v, collections.abc.Mapping):
|
||||
if isinstance(v, collections.Mapping):
|
||||
r = update(d.get(k, {}), v)
|
||||
d[k] = r
|
||||
else:
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -10,7 +9,15 @@ import logging
|
||||
import sys
|
||||
|
||||
from abci.application import BaseApplication
|
||||
from abci import CodeTypeOk
|
||||
from abci.types_pb2 import (
|
||||
ResponseInitChain,
|
||||
ResponseInfo,
|
||||
ResponseCheckTx,
|
||||
ResponseBeginBlock,
|
||||
ResponseDeliverTx,
|
||||
ResponseEndBlock,
|
||||
ResponseCommit,
|
||||
)
|
||||
|
||||
from bigchaindb import BigchainDB
|
||||
from bigchaindb.elections.election import Election
|
||||
@ -23,6 +30,7 @@ import bigchaindb.upsert_validator.validator_utils as vutils
|
||||
from bigchaindb.events import EventTypes, Event
|
||||
|
||||
|
||||
CodeTypeOk = 0
|
||||
CodeTypeError = 1
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -34,8 +42,7 @@ class App(BaseApplication):
|
||||
transaction logic to Tendermint Core.
|
||||
"""
|
||||
|
||||
def __init__(self, abci, bigchaindb=None, events_queue=None,):
|
||||
super().__init__(abci)
|
||||
def __init__(self, bigchaindb=None, events_queue=None):
|
||||
self.events_queue = events_queue
|
||||
self.bigchaindb = bigchaindb or BigchainDB()
|
||||
self.block_txn_ids = []
|
||||
@ -46,9 +53,9 @@ class App(BaseApplication):
|
||||
self.chain = self.bigchaindb.get_latest_abci_chain()
|
||||
|
||||
def log_abci_migration_error(self, chain_id, validators):
|
||||
logger.error('An ABCI chain migration is in process. '
|
||||
'Download the new ABCI client and configure it with '
|
||||
f'chain_id={chain_id} and validators={validators}.')
|
||||
logger.error(f'An ABCI chain migration is in process. ' +
|
||||
'Download the new ABCI client and configure it with ' +
|
||||
'chain_id={chain_id} and validators={validators}.')
|
||||
|
||||
def abort_if_abci_chain_is_not_synced(self):
|
||||
if self.chain is None or self.chain['is_synced']:
|
||||
@ -69,8 +76,8 @@ class App(BaseApplication):
|
||||
chain_id = known_chain['chain_id']
|
||||
|
||||
if known_chain['is_synced']:
|
||||
msg = (f'Got invalid InitChain ABCI request ({genesis}) - '
|
||||
f'the chain {chain_id} is already synced.')
|
||||
msg = f'Got invalid InitChain ABCI request ({genesis}) - ' + \
|
||||
'the chain {chain_id} is already synced.'
|
||||
logger.error(msg)
|
||||
sys.exit(1)
|
||||
|
||||
@ -101,7 +108,7 @@ class App(BaseApplication):
|
||||
genesis.chain_id, True)
|
||||
self.chain = {'height': abci_chain_height, 'is_synced': True,
|
||||
'chain_id': genesis.chain_id}
|
||||
return self.abci.ResponseInitChain()
|
||||
return ResponseInitChain()
|
||||
|
||||
def info(self, request):
|
||||
"""Return height of the latest committed block."""
|
||||
@ -116,7 +123,7 @@ class App(BaseApplication):
|
||||
|
||||
logger.info(f"Tendermint version: {request.version}")
|
||||
|
||||
r = self.abci.ResponseInfo()
|
||||
r = ResponseInfo()
|
||||
block = self.bigchaindb.get_latest_block()
|
||||
if block:
|
||||
chain_shift = 0 if self.chain is None else self.chain['height']
|
||||
@ -141,10 +148,10 @@ class App(BaseApplication):
|
||||
transaction = decode_transaction(raw_transaction)
|
||||
if self.bigchaindb.is_valid_transaction(transaction):
|
||||
logger.debug('check_tx: VALID')
|
||||
return self.abci.ResponseCheckTx(code=CodeTypeOk)
|
||||
return ResponseCheckTx(code=CodeTypeOk)
|
||||
else:
|
||||
logger.debug('check_tx: INVALID')
|
||||
return self.abci.ResponseCheckTx(code=CodeTypeError)
|
||||
return ResponseCheckTx(code=CodeTypeError)
|
||||
|
||||
def begin_block(self, req_begin_block):
|
||||
"""Initialize list of transaction.
|
||||
@ -161,7 +168,7 @@ class App(BaseApplication):
|
||||
|
||||
self.block_txn_ids = []
|
||||
self.block_transactions = []
|
||||
return self.abci.ResponseBeginBlock()
|
||||
return ResponseBeginBlock()
|
||||
|
||||
def deliver_tx(self, raw_transaction):
|
||||
"""Validate the transaction before mutating the state.
|
||||
@ -178,12 +185,12 @@ class App(BaseApplication):
|
||||
|
||||
if not transaction:
|
||||
logger.debug('deliver_tx: INVALID')
|
||||
return self.abci.ResponseDeliverTx(code=CodeTypeError)
|
||||
return ResponseDeliverTx(code=CodeTypeError)
|
||||
else:
|
||||
logger.debug('storing tx')
|
||||
self.block_txn_ids.append(transaction.id)
|
||||
self.block_transactions.append(transaction)
|
||||
return self.abci.ResponseDeliverTx(code=CodeTypeOk)
|
||||
return ResponseDeliverTx(code=CodeTypeOk)
|
||||
|
||||
def end_block(self, request_end_block):
|
||||
"""Calculate block hash using transaction ids and previous block
|
||||
@ -219,7 +226,7 @@ class App(BaseApplication):
|
||||
self.new_height,
|
||||
self.block_transactions)
|
||||
|
||||
return self.abci.ResponseEndBlock(validator_updates=validator_update)
|
||||
return ResponseEndBlock(validator_updates=validator_update)
|
||||
|
||||
def commit(self):
|
||||
"""Store the new height and along with block hash."""
|
||||
@ -250,7 +257,7 @@ class App(BaseApplication):
|
||||
})
|
||||
self.events_queue.put(event)
|
||||
|
||||
return self.abci.ResponseCommit(data=data)
|
||||
return ResponseCommit(data=data)
|
||||
|
||||
|
||||
def rollback(b):
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
from collections import OrderedDict
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -10,13 +9,12 @@ MongoDB.
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
from uuid import uuid4
|
||||
|
||||
import rapidjson
|
||||
|
||||
try:
|
||||
from hashlib import sha3_256
|
||||
except ImportError:
|
||||
# NOTE: needed for Python < 3.6
|
||||
# NOTE: neeeded for Python < 3.6
|
||||
from sha3 import sha3_256
|
||||
|
||||
import requests
|
||||
@ -27,9 +25,6 @@ from bigchaindb.models import Transaction
|
||||
from bigchaindb.common.exceptions import (SchemaValidationError,
|
||||
ValidationError,
|
||||
DoubleSpend)
|
||||
from bigchaindb.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
BROADCAST_TX_ASYNC,
|
||||
BROADCAST_TX_SYNC)
|
||||
from bigchaindb.tendermint_utils import encode_transaction, merkleroot
|
||||
from bigchaindb import exceptions as core_exceptions
|
||||
from bigchaindb.validation import BaseValidationRules
|
||||
@ -61,9 +56,9 @@ class BigchainDB(object):
|
||||
A connection to the database.
|
||||
"""
|
||||
config_utils.autoconfigure()
|
||||
self.mode_commit = BROADCAST_TX_COMMIT
|
||||
self.mode_list = (BROADCAST_TX_ASYNC,
|
||||
BROADCAST_TX_SYNC,
|
||||
self.mode_commit = 'broadcast_tx_commit'
|
||||
self.mode_list = ('broadcast_tx_async',
|
||||
'broadcast_tx_sync',
|
||||
self.mode_commit)
|
||||
self.tendermint_host = bigchaindb.config['tendermint']['host']
|
||||
self.tendermint_port = bigchaindb.config['tendermint']['port']
|
||||
@ -262,11 +257,11 @@ class BigchainDB(object):
|
||||
def get_transactions(self, txn_ids):
|
||||
return backend.query.get_transactions(self.connection, txn_ids)
|
||||
|
||||
def get_transactions_filtered(self, asset_id, operation=None, last_tx=None):
|
||||
def get_transactions_filtered(self, asset_id, operation=None):
|
||||
"""Get a list of transactions filtered on some criteria
|
||||
"""
|
||||
txids = backend.query.get_txids_filtered(self.connection, asset_id,
|
||||
operation, last_tx)
|
||||
operation)
|
||||
for txid in txids:
|
||||
yield self.get_transaction(txid)
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,20 +1,16 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
from bigchaindb.backend.schema import validate_language_key
|
||||
from bigchaindb.common.exceptions import (InvalidSignature,
|
||||
DuplicateTransaction)
|
||||
from bigchaindb.common.schema import validate_transaction_schema
|
||||
from bigchaindb.common.transaction import Transaction
|
||||
from bigchaindb.common.utils import (validate_txn_obj, validate_key)
|
||||
from bigchaindb.common.schema import validate_transaction_schema
|
||||
from bigchaindb.backend.schema import validate_language_key
|
||||
|
||||
|
||||
class Transaction(Transaction):
|
||||
ASSET = 'asset'
|
||||
METADATA = 'metadata'
|
||||
DATA = 'data'
|
||||
|
||||
def validate(self, bigchain, current_transactions=[]):
|
||||
"""Validate transaction spend
|
||||
@ -50,10 +46,9 @@ class Transaction(Transaction):
|
||||
@classmethod
|
||||
def validate_schema(cls, tx_body):
|
||||
validate_transaction_schema(tx_body)
|
||||
validate_txn_obj(cls.ASSET, tx_body[cls.ASSET], cls.DATA, validate_key)
|
||||
validate_txn_obj(cls.METADATA, tx_body, cls.METADATA, validate_key)
|
||||
validate_language_key(tx_body[cls.ASSET], cls.DATA)
|
||||
validate_language_key(tx_body, cls.METADATA)
|
||||
validate_txn_obj('asset', tx_body['asset'], 'data', validate_key)
|
||||
validate_txn_obj('metadata', tx_body, 'metadata', validate_key)
|
||||
validate_language_key(tx_body['asset'], 'data')
|
||||
|
||||
|
||||
class FastTransaction:
|
||||
|
@ -1,28 +1,31 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import multiprocessing as mp
|
||||
from collections import defaultdict
|
||||
|
||||
from bigchaindb import App, BigchainDB
|
||||
from abci.types_pb2 import ResponseCheckTx, ResponseDeliverTx
|
||||
|
||||
from bigchaindb import BigchainDB, App
|
||||
from bigchaindb.tendermint_utils import decode_transaction
|
||||
from abci import CodeTypeOk
|
||||
|
||||
|
||||
CodeTypeOk = 0
|
||||
|
||||
|
||||
class ParallelValidationApp(App):
|
||||
def __init__(self, bigchaindb=None, events_queue=None, abci=None):
|
||||
super().__init__(bigchaindb, events_queue, abci=abci)
|
||||
def __init__(self, bigchaindb=None, events_queue=None):
|
||||
super().__init__(bigchaindb, events_queue)
|
||||
self.parallel_validator = ParallelValidator()
|
||||
self.parallel_validator.start()
|
||||
|
||||
def check_tx(self, raw_transaction):
|
||||
return self.abci.ResponseCheckTx(code=CodeTypeOk)
|
||||
return ResponseCheckTx(code=CodeTypeOk)
|
||||
|
||||
def deliver_tx(self, raw_transaction):
|
||||
self.parallel_validator.validate(raw_transaction)
|
||||
return self.abci.ResponseDeliverTx(code=CodeTypeOk)
|
||||
return ResponseDeliverTx(code=CodeTypeOk)
|
||||
|
||||
def end_block(self, request_end_block):
|
||||
result = self.parallel_validator.result(timeout=30)
|
||||
|
@ -1,13 +1,10 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import logging
|
||||
import setproctitle
|
||||
|
||||
from abci import TmVersion, ABCI
|
||||
|
||||
import bigchaindb
|
||||
from bigchaindb.lib import BigchainDB
|
||||
from bigchaindb.core import App
|
||||
@ -22,8 +19,10 @@ logger = logging.getLogger(__name__)
|
||||
BANNER = """
|
||||
****************************************************************************
|
||||
* *
|
||||
* BigchainDB 2.2.2 *
|
||||
* codename "jumping sloth" *
|
||||
* ┏┓ ╻┏━╸┏━╸╻ ╻┏━┓╻┏┓╻╺┳┓┏┓ ┏━┓ ┏━┓ ╺┳┓┏━╸╻ ╻ *
|
||||
* ┣┻┓┃┃╺┓┃ ┣━┫┣━┫┃┃┗┫ ┃┃┣┻┓ ┏━┛ ┃┃┃ ┃┃┣╸ ┃┏┛ *
|
||||
* ┗━┛╹┗━┛┗━╸╹ ╹╹ ╹╹╹ ╹╺┻┛┗━┛ ┗━╸╹┗━┛╹╺┻┛┗━╸┗┛ *
|
||||
* codename "fluffy cat" *
|
||||
* Initialization complete. BigchainDB Server is ready and waiting. *
|
||||
* *
|
||||
* You can send HTTP requests via the HTTP API documented in the *
|
||||
@ -63,26 +62,15 @@ def start(args):
|
||||
# We need to import this after spawning the web server
|
||||
# because import ABCIServer will monkeypatch all sockets
|
||||
# for gevent.
|
||||
from abci.server import ABCIServer
|
||||
from abci import ABCIServer
|
||||
|
||||
setproctitle.setproctitle('bigchaindb')
|
||||
|
||||
# Start the ABCIServer
|
||||
abci = ABCI(TmVersion(bigchaindb.config['tendermint']['version']))
|
||||
if args.experimental_parallel_validation:
|
||||
app = ABCIServer(
|
||||
app=ParallelValidationApp(
|
||||
abci=abci.types,
|
||||
events_queue=exchange.get_publisher_queue(),
|
||||
)
|
||||
)
|
||||
app = ABCIServer(app=ParallelValidationApp(events_queue=exchange.get_publisher_queue()))
|
||||
else:
|
||||
app = ABCIServer(
|
||||
app=App(
|
||||
abci=abci.types,
|
||||
events_queue=exchange.get_publisher_queue(),
|
||||
)
|
||||
)
|
||||
app = ABCIServer(app=App(events_queue=exchange.get_publisher_queue()))
|
||||
app.run()
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,28 +1,20 @@
|
||||
import codecs
|
||||
import base64
|
||||
import binascii
|
||||
import codecs
|
||||
|
||||
import bigchaindb
|
||||
from abci import types_v0_22_8, types_v0_31_5, TmVersion
|
||||
from bigchaindb.common.exceptions import InvalidPublicKey, BigchainDBError
|
||||
from abci.types_pb2 import (Validator,
|
||||
PubKey)
|
||||
from bigchaindb.common.exceptions import InvalidPublicKey
|
||||
|
||||
|
||||
def encode_validator(v):
|
||||
ed25519_public_key = v['public_key']['value']
|
||||
# NOTE: tendermint expects public to be encoded in go-amino format
|
||||
try:
|
||||
version = TmVersion(bigchaindb.config["tendermint"]["version"])
|
||||
except ValueError:
|
||||
raise BigchainDBError('Invalid tendermint version, '
|
||||
'check BigchainDB configuration file')
|
||||
|
||||
validator_update_t, pubkey_t = {
|
||||
TmVersion.v0_22_8: (types_v0_22_8.Validator, types_v0_22_8.PubKey),
|
||||
TmVersion.v0_31_5: (types_v0_31_5.ValidatorUpdate, types_v0_31_5.PubKey)
|
||||
}[version]
|
||||
pub_key = pubkey_t(type='ed25519', data=bytes.fromhex(ed25519_public_key))
|
||||
|
||||
return validator_update_t(pub_key=pub_key, power=v['power'])
|
||||
pub_key = PubKey(type='ed25519',
|
||||
data=bytes.fromhex(ed25519_public_key))
|
||||
return Validator(pub_key=pub_key,
|
||||
address=b'',
|
||||
power=v['power'])
|
||||
|
||||
|
||||
def decode_validator(v):
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
__version__ = '2.2.2'
|
||||
__short_version__ = '2.2'
|
||||
__version__ = '2.0.0b8'
|
||||
__short_version__ = '2.0b8'
|
||||
|
||||
# Supported Tendermint versions
|
||||
__tm_supported_versions__ = ["0.31.5", "0.22.8"]
|
||||
__tm_supported_versions__ = ["0.22.8"]
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -37,10 +36,7 @@ def base_ws_uri():
|
||||
customized (typically when running behind NAT, firewall, etc.)
|
||||
"""
|
||||
|
||||
config_wsserver = config['wsserver']
|
||||
|
||||
scheme = config_wsserver['advertised_scheme']
|
||||
host = config_wsserver['advertised_host']
|
||||
port = config_wsserver['advertised_port']
|
||||
|
||||
scheme = config['wsserver']['advertised_scheme']
|
||||
host = config['wsserver']['advertised_host']
|
||||
port = config['wsserver']['advertised_port']
|
||||
return '{}://{}:{}'.format(scheme, host, port)
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,14 +1,9 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
import re
|
||||
|
||||
from bigchaindb.common.transaction_mode_types import (BROADCAST_TX_COMMIT,
|
||||
BROADCAST_TX_ASYNC,
|
||||
BROADCAST_TX_SYNC)
|
||||
|
||||
|
||||
def valid_txid(txid):
|
||||
if re.match('^[a-fA-F0-9]{64}$', txid):
|
||||
@ -43,9 +38,9 @@ def valid_operation(op):
|
||||
|
||||
def valid_mode(mode):
|
||||
if mode == 'async':
|
||||
return BROADCAST_TX_ASYNC
|
||||
return 'broadcast_tx_async'
|
||||
if mode == 'sync':
|
||||
return BROADCAST_TX_SYNC
|
||||
return 'broadcast_tx_sync'
|
||||
if mode == 'commit':
|
||||
return BROADCAST_TX_COMMIT
|
||||
return 'broadcast_tx_commit'
|
||||
raise ValueError('Mode must be "async", "sync" or "commit"')
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -12,7 +11,6 @@ import logging
|
||||
from flask import current_app, request, jsonify
|
||||
from flask_restful import Resource, reqparse
|
||||
|
||||
from bigchaindb.common.transaction_mode_types import BROADCAST_TX_ASYNC
|
||||
from bigchaindb.common.exceptions import SchemaValidationError, ValidationError
|
||||
from bigchaindb.web.views.base import make_error
|
||||
from bigchaindb.web.views import parameters
|
||||
@ -49,9 +47,8 @@ class TransactionListApi(Resource):
|
||||
parser.add_argument('operation', type=parameters.valid_operation)
|
||||
parser.add_argument('asset_id', type=parameters.valid_txid,
|
||||
required=True)
|
||||
parser.add_argument('last_tx', type=parameters.valid_bool,
|
||||
required=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
with current_app.config['bigchain_pool']() as bigchain:
|
||||
txs = bigchain.get_transactions_filtered(**args)
|
||||
|
||||
@ -65,7 +62,7 @@ class TransactionListApi(Resource):
|
||||
"""
|
||||
parser = reqparse.RequestParser()
|
||||
parser.add_argument('mode', type=parameters.valid_mode,
|
||||
default=BROADCAST_TX_ASYNC)
|
||||
default='broadcast_tx_async')
|
||||
args = parser.parse_args()
|
||||
mode = str(args['mode'])
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
@ -96,11 +95,12 @@ class Dispatcher:
|
||||
|
||||
del self.subscribers[uuid]
|
||||
|
||||
async def publish(self):
|
||||
@asyncio.coroutine
|
||||
def publish(self):
|
||||
"""Publish new events to the subscribers."""
|
||||
|
||||
while True:
|
||||
event = await self.event_source.get()
|
||||
event = yield from self.event_source.get()
|
||||
str_buffer = []
|
||||
|
||||
if event == POISON_PILL:
|
||||
@ -114,22 +114,23 @@ class Dispatcher:
|
||||
|
||||
for str_item in str_buffer:
|
||||
for _, websocket in self.subscribers.items():
|
||||
await websocket.send_str(str_item)
|
||||
yield from websocket.send_str(str_item)
|
||||
|
||||
|
||||
async def websocket_handler(request):
|
||||
@asyncio.coroutine
|
||||
def websocket_handler(request):
|
||||
"""Handle a new socket connection."""
|
||||
|
||||
logger.debug('New websocket connection.')
|
||||
websocket = web.WebSocketResponse()
|
||||
await websocket.prepare(request)
|
||||
yield from websocket.prepare(request)
|
||||
uuid = uuid4()
|
||||
request.app['dispatcher'].subscribe(uuid, websocket)
|
||||
|
||||
while True:
|
||||
# Consume input buffer
|
||||
try:
|
||||
msg = await websocket.receive()
|
||||
msg = yield from websocket.receive()
|
||||
except RuntimeError as e:
|
||||
logger.debug('Websocket exception: %s', str(e))
|
||||
break
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
# BigchainDB and IPDB software contributors.
|
||||
# Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
version: '2.2'
|
||||
version: '2.1'
|
||||
|
||||
services:
|
||||
# Build: docker-compose build -d bigchaindb
|
||||
@ -13,7 +12,6 @@ services:
|
||||
ports:
|
||||
- "27017:27017"
|
||||
command: mongod
|
||||
restart: always
|
||||
bigchaindb:
|
||||
depends_on:
|
||||
- mongodb
|
||||
@ -49,9 +47,8 @@ services:
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
command: '.ci/entrypoint.sh'
|
||||
restart: always
|
||||
tendermint:
|
||||
image: tendermint/tendermint:v0.31.5
|
||||
image: tendermint/tendermint:0.22.8
|
||||
# volumes:
|
||||
# - ./tmdata:/tendermint
|
||||
entrypoint: ''
|
||||
@ -59,7 +56,6 @@ services:
|
||||
- "26656:26656"
|
||||
- "26657:26657"
|
||||
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --proxy_app=tcp://bigchaindb:26658"
|
||||
restart: always
|
||||
bdb:
|
||||
image: busybox
|
||||
depends_on:
|
||||
@ -96,10 +92,10 @@ services:
|
||||
backend: localmongodb
|
||||
volumes:
|
||||
- .:/usr/src/app/
|
||||
command: make -C docs/root html
|
||||
command: make -C docs/server html
|
||||
vdocs:
|
||||
image: nginx
|
||||
ports:
|
||||
- '33333:80'
|
||||
volumes:
|
||||
- ./docs/root/build/html:/usr/share/nginx/html
|
||||
- ./docs/server/build/html:/usr/share/nginx/html
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!---
|
||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
||||
BigchainDB and IPDB software contributors.
|
||||
Copyright BigchainDB GmbH and BigchainDB contributors
|
||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
--->
|
||||
@ -45,7 +44,7 @@ You can also use [Docker Compose](https://docs.docker.com/compose/) to build and
|
||||
$ docker-compose up -d bdocs
|
||||
```
|
||||
|
||||
The docs will be hosted on port **33333**, and can be accessed over [localhost](http://localhost:33333), [127.0.0.1](http://127.0.0.1:33333)
|
||||
The docs will be hosted on port **33333**, and can be accessed over [localhost](http:/localhost:33333), [127.0.0.1](http:/127.0.0.1:33333)
|
||||
OR http:/HOST_IP:33333.
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user