resolved merge conflicts
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
# Planetmint 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
|
|
||||||
|
|
||||||
|
|
||||||
set -e -x
|
|
||||||
|
|
||||||
if [[ -z ${TOXENV} ]] && [[ ${PLANETMINT_CI_ABCI} != 'enable' ]] && [[ ${PLANETMINT_ACCEPTANCE_TEST} != 'enable' ]]; then
|
|
||||||
codecov -v -f htmlcov/coverage.xml
|
|
||||||
fi
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
# Planetmint 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
|
|
||||||
|
|
||||||
if [[ -n ${TOXENV} ]]; then
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install zsh
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z ${TOXENV} ]]; then
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
|
||||||
|
|
||||||
sudo rm /usr/local/bin/docker-compose
|
|
||||||
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
|
||||||
chmod +x docker-compose
|
|
||||||
sudo mv docker-compose /usr/local/bin
|
|
||||||
fi
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
# Planetmint 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
|
|
||||||
|
|
||||||
|
|
||||||
set -e -x
|
|
||||||
|
|
||||||
if [[ -z ${TOXENV} ]]; then
|
|
||||||
|
|
||||||
if [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
|
||||||
docker-compose up -d planetmint
|
|
||||||
else
|
|
||||||
docker-compose up -d bdb
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
# Planetmint 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
|
|
||||||
|
|
||||||
|
|
||||||
set -e -x
|
|
||||||
|
|
||||||
pip install --upgrade pip
|
|
||||||
|
|
||||||
if [[ -n ${TOXENV} ]]; then
|
|
||||||
pip install --upgrade tox
|
|
||||||
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
|
||||||
docker-compose build --no-cache --build-arg abci_status=enable planetmint
|
|
||||||
else
|
|
||||||
docker-compose build --no-cache planetmint
|
|
||||||
pip install --upgrade codecov
|
|
||||||
fi
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
# Planetmint 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
|
|
||||||
|
|
||||||
|
|
||||||
set -e -x
|
|
||||||
|
|
||||||
if [[ -n ${TOXENV} ]]; then
|
|
||||||
tox -e ${TOXENV}
|
|
||||||
elif [[ ${PLANETMINT_CI_ABCI} == 'enable' ]]; then
|
|
||||||
docker-compose exec planetmint pytest -v -m abci
|
|
||||||
elif [[ ${PLANETMINT_ACCEPTANCE_TEST} == 'enable' ]]; then
|
|
||||||
./scripts/run-acceptance-test.sh
|
|
||||||
elif [[ ${PLANETMINT_INTEGRATION_TEST} == 'enable' ]]; then
|
|
||||||
docker-compose down # TODO: remove after ci optimization
|
|
||||||
./scripts/run-integration-test.sh
|
|
||||||
else
|
|
||||||
docker-compose exec planetmint pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml
|
|
||||||
fi
|
|
||||||
14
.github/CONTRIBUTING.md
vendored
@ -1,14 +0,0 @@
|
|||||||
<!---
|
|
||||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
Planetmint 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
|
|
||||||
--->
|
|
||||||
|
|
||||||
# How to Contribute to the Planetmint Project
|
|
||||||
|
|
||||||
There are many ways you can contribute to the Planetmint project, some very easy and others more involved.
|
|
||||||
|
|
||||||
All of that is documented elsewhere: go to the "[Contributing to Planetmint" docs on ReadTheDocs](https://docs.planetmint.com/projects/contributing/en/latest/index.html).
|
|
||||||
|
|
||||||
Note: GitHub automatically links to this file (`.github/CONTRIBUTING.md`) when a contributor creates a new issue or pull request, so you shouldn't delete it. Just use it to point people to full and proper help elsewhere.
|
|
||||||
20
.github/ISSUE_TEMPLATE.md
vendored
@ -1,20 +0,0 @@
|
|||||||
# Do you want to:
|
|
||||||
|
|
||||||
- make a bug report? Then read below about what should go in a bug report.
|
|
||||||
- make a feature request or proposal? Then read [the page about how to make a feature request or proposal](https://docs.planetmint.com/projects/contributing/en/latest/ways-can-contribute/make-a-feature-request-or-proposal.html).
|
|
||||||
- ask a question about Planetmint? Then [go to Gitter](https://gitter.im/planetmint/planetmint) (our chat room) and ask it there.
|
|
||||||
- share your neat idea or realization? Then [go to Gitter](https://gitter.im/planetmint/planetmint) (our chat room) and share it there.
|
|
||||||
|
|
||||||
# What Should Go in a Bug Report
|
|
||||||
|
|
||||||
- What computer are you on (hardware)?
|
|
||||||
- What operating system are you using, including version. e.g. Ubuntu 14.04? Fedora 23?
|
|
||||||
- What version of Planetmint software were you using? Is that the latest version?
|
|
||||||
- What, exactly, did you do to get to the point where you got stuck? Describe all the steps so we can get there too. Show screenshots or copy-and-paste text to GitHub.
|
|
||||||
- Show what actually happened.
|
|
||||||
- Say what you tried to do to resolve the problem.
|
|
||||||
- Provide details to convince us that it matters to you. Is it for a school project, a job, a contract with a deadline, a child who needs it for Christmas?
|
|
||||||
|
|
||||||
We will do our best but please understand that we don't have time to help everyone, especially people who don't care to help us help them. "It doesn't work." is not going to get any reaction from us. We need _details_.
|
|
||||||
|
|
||||||
Tip: Use Github code block formatting to make code render pretty in GitHub. To do that, put three backticks followed by a string to set the type of code (e.g. `Python`), then the code, and then end with three backticks. There's more information about [inserting code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/) in the GitHub help pages.
|
|
||||||
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.9.3]
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
18
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,18 +0,0 @@
|
|||||||
Make sure the title of this pull request has the form:
|
|
||||||
|
|
||||||
**Problem: A short statement of the problem.**
|
|
||||||
|
|
||||||
## Solution
|
|
||||||
|
|
||||||
A short statement about how this PR solves the **Problem**.
|
|
||||||
|
|
||||||
## Issues Resolved
|
|
||||||
|
|
||||||
What issues does this PR resolve, if any? Please include lines like the following (i.e. "Resolves #NNNN), so that when this PR gets merged, GitHub will automatically close those issues.
|
|
||||||
|
|
||||||
Resolves #NNNN
|
|
||||||
Resolves #MMMM
|
|
||||||
|
|
||||||
## BEPs Implemented
|
|
||||||
|
|
||||||
What [BEPs](https://github.com/planetmint/beps) does this pull request implement, if any?
|
|
||||||
22
.github/workflows/acceptance-test.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
name: Acceptance tests
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
if: ${{ false }
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Start container
|
||||||
|
run: docker-compose up -d planetmint
|
||||||
|
|
||||||
|
- name: Run test
|
||||||
|
run: docker-compose -f docker-compose.yml run --rm python-acceptance pytest /src
|
||||||
36
.github/workflows/audit.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
name: Audit
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
audit:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
|
||||||
|
- name: Install pip-audit
|
||||||
|
run: pip install --upgrade pip pip-audit
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install .
|
||||||
|
|
||||||
|
- name: Create requirements.txt
|
||||||
|
run: pip freeze > requirements.txt
|
||||||
|
|
||||||
|
- name: Audit dependencies
|
||||||
|
run: pip-audit
|
||||||
|
|
||||||
|
|
||||||
35
.github/workflows/documenation.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
name: Documentation
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
documentation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
|
||||||
|
- name: Install tox
|
||||||
|
run: python -m pip install --upgrade tox tox-gh-actions
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install .'[dev]'
|
||||||
|
|
||||||
|
- name: Run tox
|
||||||
|
run: tox -e docsroot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
19
.github/workflows/integration-test.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
name: Integration tests
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
if: ${{ false }
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Start test run
|
||||||
|
run: docker-compose -f docker-compose.integration.yml up test
|
||||||
17
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
name: Lint
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: psf/black@stable
|
||||||
|
with:
|
||||||
|
options: "--check -l 119"
|
||||||
|
src: "."
|
||||||
109
.github/workflows/unit-test.yml
vendored
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
name: Unit tests
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- abci_enabled: "ABCI enabled"
|
||||||
|
abci: "enabled"
|
||||||
|
- abci_disabled: "ABCI disabled"
|
||||||
|
abci: "disabled"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build container
|
||||||
|
run: |
|
||||||
|
if [[ "${{ matrix.abci }}" == "enabled" ]]; then
|
||||||
|
docker-compose -f docker-compose.yml build --no-cache --build-arg abci_status=enable planetmint
|
||||||
|
fi
|
||||||
|
if [[ ""${{ matrix.abci }}" == "disabled"" ]]; then
|
||||||
|
docker-compose -f docker-compose.yml build --no-cache planetmint
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Save image
|
||||||
|
run: docker save -o planetmint.tar planetmint_planetmint
|
||||||
|
|
||||||
|
- name: Upload image
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: planetmint-abci-${{matrix.abci}}
|
||||||
|
path: planetmint.tar
|
||||||
|
retention-days: 5
|
||||||
|
|
||||||
|
|
||||||
|
test-with-abci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- db: "MongoDB with ABCI"
|
||||||
|
host: "mongodb"
|
||||||
|
port: 27017
|
||||||
|
abci: "enabled"
|
||||||
|
- db: "Tarantool with ABCI"
|
||||||
|
host: "tarantool"
|
||||||
|
port: 3303
|
||||||
|
abci: "enabled"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Download planetmint
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: planetmint-abci-enabled
|
||||||
|
|
||||||
|
- name: Load planetmint
|
||||||
|
run: docker load -i planetmint.tar
|
||||||
|
|
||||||
|
- name: Start containers
|
||||||
|
run: docker-compose -f docker-compose.yml up -d planetmint
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: docker exec planetmint_planetmint_1 pytest -v -m abci
|
||||||
|
|
||||||
|
test-without-abci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- db: "MongoDB without ABCI"
|
||||||
|
host: "mongodb"
|
||||||
|
port: 27017
|
||||||
|
- db: "Tarantool without ABCI"
|
||||||
|
host: "tarantool"
|
||||||
|
port: 3303
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Download planetmint
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: planetmint-abci-disabled
|
||||||
|
|
||||||
|
- name: Load planetmint
|
||||||
|
run: docker load -i planetmint.tar
|
||||||
|
|
||||||
|
- name: Start containers
|
||||||
|
run: docker-compose -f docker-compose.yml up -d bdb
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: docker exec planetmint_planetmint_1 pytest -v --cov=planetmint --cov-report xml:htmlcov/coverage.xml
|
||||||
|
|
||||||
|
- name: Upload Coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
planetmint_environment/
|
||||||
|
.idea/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
|
|||||||
54
.travis.yml
@ -1,54 +0,0 @@
|
|||||||
# Copyright © 2020, 2021 Interplanetary Database Association e.V.,
|
|
||||||
# Planetmint 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
|
|
||||||
|
|
||||||
sudo: required
|
|
||||||
|
|
||||||
dist: focal
|
|
||||||
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
language: python
|
|
||||||
cache: pip
|
|
||||||
|
|
||||||
python:
|
|
||||||
- 3.9
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- DOCKER_COMPOSE_VERSION=1.29.2
|
|
||||||
matrix:
|
|
||||||
- TOXENV=flake8
|
|
||||||
- TOXENV=docsroot
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
include:
|
|
||||||
- python: 3.9
|
|
||||||
env:
|
|
||||||
- PLANETMINT_DATABASE_BACKEND=localmongodb
|
|
||||||
- PLANETMINT_DATABASE_SSL=
|
|
||||||
- python: 3.9
|
|
||||||
env:
|
|
||||||
- PLANETMINT_DATABASE_BACKEND=localmongodb
|
|
||||||
- PLANETMINT_DATABASE_SSL=
|
|
||||||
- PLANETMINT_CI_ABCI=enable
|
|
||||||
- python: 3.9
|
|
||||||
env:
|
|
||||||
- PLANETMINT_ACCEPTANCE_TEST=enable
|
|
||||||
- python: 3.9
|
|
||||||
env:
|
|
||||||
- PLANETMINT_INTEGRATION_TEST=enable
|
|
||||||
|
|
||||||
|
|
||||||
before_install: sudo .ci/travis-before-install.sh
|
|
||||||
|
|
||||||
install: .ci/travis-install.sh
|
|
||||||
|
|
||||||
before_script: .ci/travis-before-script.sh
|
|
||||||
|
|
||||||
script: .ci/travis_script.sh
|
|
||||||
|
|
||||||
after_success: .ci/travis-after-success.sh
|
|
||||||
55
CHANGELOG.md
@ -25,6 +25,59 @@ For reference, the possible headings are:
|
|||||||
* **Known Issues**
|
* **Known Issues**
|
||||||
* **Notes**
|
* **Notes**
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
* **Changed** replaced transaction module with planetmint-transactions package
|
||||||
|
* **Changed** moved transaction network validation to Planetmint class
|
||||||
|
* **Changed** adjusted test cases
|
||||||
|
|
||||||
|
## [1.2.1] - 2022-20-09
|
||||||
|
* **Changed** Create model now validates for CID strings for asset["data"] and metadata
|
||||||
|
* **Changed** adjusted test cases
|
||||||
|
|
||||||
|
## [1.2.0] - 2022-09-05
|
||||||
|
* **Changed** disabled acceptance and integration tests, they have a circular dep. to the python driver
|
||||||
|
* **Changed** Metadata and asset["data"] types to string containing an IPLD hash
|
||||||
|
* **Fixed** Transaction generation bug that automatically assigned 'assets' to asset["data"]
|
||||||
|
* **Changed** adjusted test cases
|
||||||
|
|
||||||
|
|
||||||
|
## [1.1.0] - 2022-09-05
|
||||||
|
* **Changed** adjusted to zenroom calling convention of PRP #13 (breaking change)
|
||||||
|
* **Changed** zenroom test cases to comply to the new calling convention
|
||||||
|
* **Fixed** zenroom signing bug (call of wrong function)
|
||||||
|
* **Changed** using cryptoconditions 0.10.0
|
||||||
|
* **Deprecated** usage of ripde160md as a address generation algorithm, isn't available from python 3.9.14 on, skipping these tests from now on.
|
||||||
|
* **Changed** script/ouptut tag to be of type array or object for schema v3.0 and v2.0
|
||||||
|
* **Changed** added 'script' handling to the common/transactions.py class
|
||||||
|
* **Fixed** data input handling to the transaction fullfillment methods
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [1.0.1] - 2022-07-07
|
||||||
|
updated documentation
|
||||||
|
|
||||||
|
## [1.0.0] - 2022-07-05
|
||||||
|
### Feature Update
|
||||||
|
Tarantool integration
|
||||||
|
|
||||||
|
## [0.9.8] - 2022-06-27
|
||||||
|
|
||||||
|
### Feature Update
|
||||||
|
Changed license to AGPLv3
|
||||||
|
|
||||||
|
|
||||||
|
## [0.9.7] - 2022-06-17
|
||||||
|
|
||||||
|
### Feature Update
|
||||||
|
Deep Zenroom integration
|
||||||
|
|
||||||
|
## [0.9.6] - 2022-06-08
|
||||||
|
|
||||||
|
### Maintenance
|
||||||
|
|
||||||
|
* removed Korean documentation
|
||||||
|
* removed Korean and Chinese README
|
||||||
|
|
||||||
## [2.2.2] - 2020-08-12
|
## [2.2.2] - 2020-08-12
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
@ -1157,6 +1210,6 @@ The first public release of Planetmint, including:
|
|||||||
- Initial documentation (in `planetmint/docs`).
|
- Initial documentation (in `planetmint/docs`).
|
||||||
- Initial `README.md`, `ROADMAP.md`, `CODE_OF_CONDUCT.md`, and `CONTRIBUTING.md`.
|
- Initial `README.md`, `ROADMAP.md`, `CODE_OF_CONDUCT.md`, and `CONTRIBUTING.md`.
|
||||||
- Packaging for PyPI, including `setup.py` and `setup.cfg`.
|
- Packaging for PyPI, including `setup.py` and `setup.cfg`.
|
||||||
- Initial `Dockerfile` and `docker-compose.yml` (for deployment using Docker and Docker Compose).
|
- Initial `Dockerfile` and `docker compose.yml` (for deployment using Docker and Docker Compose).
|
||||||
- Initial `.gitignore` (list of things for git to ignore).
|
- Initial `.gitignore` (list of things for git to ignore).
|
||||||
- Initial `.travis.yml` (used by Travis CI).
|
- Initial `.travis.yml` (used by Travis CI).
|
||||||
|
|||||||
@ -42,7 +42,7 @@ This Code of Conduct applies both within project spaces and in public spaces
|
|||||||
when an individual is representing the project or its community.
|
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
|
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@planetmint.com](mailto:contact@planetmint.com). All
|
reported by contacting a project maintainer at [mail@planetmint.io](mailto:contact@planetmint.io). All
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
is appropriate to the circumstances. Maintainers are
|
is appropriate to the circumstances. Maintainers are
|
||||||
obligated to maintain confidentiality with regard to the reporter of an
|
obligated to maintain confidentiality with regard to the reporter of an
|
||||||
|
|||||||
@ -7,6 +7,7 @@ RUN apt-get -qq update \
|
|||||||
&& apt-get -y upgrade \
|
&& apt-get -y upgrade \
|
||||||
&& apt-get install -y jq vim zsh build-essential cmake\
|
&& apt-get install -y jq vim zsh build-essential cmake\
|
||||||
&& pip install . \
|
&& pip install . \
|
||||||
|
&& pip install pynacl==1.4.0 base58==2.1.1 pyasn1==0.4.8 zenroom==2.1.0.dev1655293214 cryptography==3.4.7\
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& apt-get clean
|
&& apt-get clean
|
||||||
|
|
||||||
|
|||||||
@ -16,12 +16,11 @@ RUN apt-get update \
|
|||||||
&& pip install -e . \
|
&& pip install -e . \
|
||||||
&& apt-get autoremove
|
&& apt-get autoremove
|
||||||
|
|
||||||
# Install mongodb and monit
|
# Install tarantool and monit
|
||||||
RUN apt-get install -y dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
|
RUN apt-get install -y dirmngr gnupg apt-transport-https software-properties-common ca-certificates curl
|
||||||
RUN wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
|
|
||||||
RUN echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y mongodb-org monit
|
RUN curl -L https://tarantool.io/wrATeGF/release/2/installer.sh | bash
|
||||||
|
RUN apt-get install -y tarantool monit
|
||||||
|
|
||||||
# Install Tendermint
|
# Install Tendermint
|
||||||
RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.tar.gz \
|
RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSION}/tendermint_${TM_VERSION}_linux_amd64.tar.gz \
|
||||||
@ -31,13 +30,10 @@ RUN wget https://github.com/tendermint/tendermint/releases/download/v${TM_VERSIO
|
|||||||
|
|
||||||
ENV TMHOME=/tendermint
|
ENV TMHOME=/tendermint
|
||||||
|
|
||||||
# Set permissions required for mongodb
|
|
||||||
RUN mkdir -p /data/db /data/configdb \
|
|
||||||
&& chown -R mongodb:mongodb /data/db /data/configdb
|
|
||||||
|
|
||||||
# Planetmint enviroment variables
|
# Planetmint enviroment variables
|
||||||
ENV PLANETMINT_DATABASE_PORT 27017
|
ENV PLANETMINT_DATABASE_PORT 3303
|
||||||
ENV PLANETMINT_DATABASE_BACKEND localmongodb
|
ENV PLANETMINT_DATABASE_BACKEND tarantool_db
|
||||||
|
ENV PLANETMINT_DATABASE_HOST localhost
|
||||||
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
|
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
|
||||||
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
|
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
|
||||||
ENV PLANETMINT_WSSERVER_SCHEME ws
|
ENV PLANETMINT_WSSERVER_SCHEME ws
|
||||||
@ -50,4 +46,7 @@ VOLUME /data/db /data/configdb /tendermint
|
|||||||
|
|
||||||
EXPOSE 27017 28017 9984 9985 26656 26657 26658
|
EXPOSE 27017 28017 9984 9985 26656 26657 26658
|
||||||
|
|
||||||
|
RUN pip install pynacl==1.4.0 base58==2.1.1 pyasn1==0.4.8 zenroom==2.1.0.dev1655293214 cryptography==3.4.7
|
||||||
|
|
||||||
|
|
||||||
WORKDIR $HOME
|
WORKDIR $HOME
|
||||||
@ -1,13 +1,14 @@
|
|||||||
ARG python_version=3.9
|
ARG python_version=3.9
|
||||||
FROM python:${python_version}
|
FROM python:${python_version}-slim
|
||||||
LABEL maintainer "contact@ipdb.global"
|
LABEL maintainer "contact@ipdb.global"
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y git zsh-common vim build-essential cmake\
|
&& apt-get install -y git zsh curl\
|
||||||
|
&& apt-get install -y tarantool-common\
|
||||||
|
&& apt-get install -y vim build-essential cmake\
|
||||||
&& pip install -U pip \
|
&& pip install -U pip \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& apt-get clean
|
&& apt-get clean
|
||||||
|
|
||||||
ARG backend
|
ARG backend
|
||||||
ARG abci_status
|
ARG abci_status
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ ARG abci_status
|
|||||||
# to force stdin, stdout and stderr to be totally unbuffered and to capture logs/outputs
|
# to force stdin, stdout and stderr to be totally unbuffered and to capture logs/outputs
|
||||||
ENV PYTHONUNBUFFERED 0
|
ENV PYTHONUNBUFFERED 0
|
||||||
|
|
||||||
ENV PLANETMINT_DATABASE_PORT 27017
|
ENV PLANETMINT_DATABASE_PORT 3303
|
||||||
ENV PLANETMINT_DATABASE_BACKEND $backend
|
ENV PLANETMINT_DATABASE_BACKEND $backend
|
||||||
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
|
ENV PLANETMINT_SERVER_BIND 0.0.0.0:9984
|
||||||
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
|
ENV PLANETMINT_WSSERVER_HOST 0.0.0.0
|
||||||
@ -32,4 +33,6 @@ RUN mkdir -p /usr/src/app
|
|||||||
COPY . /usr/src/app/
|
COPY . /usr/src/app/
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
RUN pip install -e .[dev]
|
RUN pip install -e .[dev]
|
||||||
|
RUN pip install flask-cors
|
||||||
|
RUN pip install pynacl==1.4.0 base58==2.1.1 pyasn1==0.4.8 zenroom==2.1.0.dev1655293214 cryptography==3.4.7
|
||||||
RUN planetmint -y configure
|
RUN planetmint -y configure
|
||||||
|
|||||||
796
LICENSE
@ -1,201 +1,661 @@
|
|||||||
Apache License
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 2.0, January 2004
|
Version 3, 19 November 2007
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
1. Definitions.
|
Preamble
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
The licenses for most software and other practical works are designed
|
||||||
the copyright owner that is granting the License.
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
When we speak of free software, we are referring to freedom, not
|
||||||
other entities that control, are controlled by, or are under common
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
control with that entity. For the purposes of this definition,
|
have the freedom to distribute copies of free software (and charge for
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
them if you wish), that you receive source code or can get it if you
|
||||||
direction or management of such entity, whether by contract or
|
want it, that you can change the software or use pieces of it in new
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
free programs, and that you know you can do these things.
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
Developers that use our General Public Licenses protect your rights
|
||||||
exercising permissions granted by this License.
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
A secondary benefit of defending all users' freedom is that
|
||||||
including but not limited to software source code, documentation
|
improvements made in alternate versions of the program, if they
|
||||||
source, and configuration files.
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
The GNU Affero General Public License is designed specifically to
|
||||||
transformation or translation of a Source form, including but
|
ensure that, in such cases, the modified source code becomes available
|
||||||
not limited to compiled object code, generated documentation,
|
to the community. It requires the operator of a network server to
|
||||||
and conversions to other media types.
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
An older license, called the Affero General Public License and
|
||||||
Object form, made available under the License, as indicated by a
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
copyright notice that is included in or attached to the work
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
(an example is provided in the Appendix below).
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
The precise terms and conditions for copying, distribution and
|
||||||
form, that is based on (or derived from) the Work and for which the
|
modification follow.
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
TERMS AND CONDITIONS
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
0. Definitions.
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
works, such as semiconductor masks.
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
modifications, and in Source or Object form, provided that You
|
"recipients" may be individuals or organizations.
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
Derivative Works a copy of this License; and
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
A "covered work" means either the unmodified Program or a work based
|
||||||
stating that You changed the files; and
|
on the Program.
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
To "propagate" a work means to do anything with it that, without
|
||||||
that You distribute, all copyright, patent, trademark, and
|
permission, would make you directly or secondarily liable for
|
||||||
attribution notices from the Source form of the Work,
|
infringement under applicable copyright law, except executing it on a
|
||||||
excluding those notices that do not pertain to any part of
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
the Derivative Works; and
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
To "convey" a work means any kind of propagation that enables other
|
||||||
distribution, then any Derivative Works that You distribute must
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
include a readable copy of the attribution notices contained
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
may provide additional or different license terms and conditions
|
to the extent that it includes a convenient and prominently visible
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
tells the user that there is no warranty for the work (except to the
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
extent that warranties are provided), that licensees may convey the
|
||||||
the conditions stated in this License.
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
1. Source Code.
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
The "source code" for a work means the preferred form of the work
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
for making modifications to it. "Object code" means any non-source
|
||||||
except as required for reasonable and customary use in describing the
|
form of a work.
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
A "Standard Interface" means an interface that either is an official
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
standard defined by a recognized standards body, or, in the case of
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
interfaces specified for a particular programming language, one that
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
is widely used among developers working in that language.
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
The "System Libraries" of an executable work include anything, other
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
unless required by applicable law (such as deliberate and grossly
|
packaging a Major Component, but which is not part of that Major
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
Component, and (b) serves only to enable use of the work with that
|
||||||
liable to You for damages, including any direct, indirect, special,
|
Major Component, or to implement a Standard Interface for which an
|
||||||
incidental, or consequential damages of any character arising as a
|
implementation is available to the public in source code form. A
|
||||||
result of this License or out of the use or inability to use the
|
"Major Component", in this context, means a major essential component
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
(kernel, window system, and so on) of the specific operating system
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
other commercial damages or losses), even if such Contributor
|
produce the work, or an object code interpreter used to run it.
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
The "Corresponding Source" for a work in object code form means all
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
the source code needed to generate, install, and (for an executable
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
work) run the object code and to modify the work, including scripts to
|
||||||
or other liability obligations and/or rights consistent with this
|
control those activities. However, it does not include the work's
|
||||||
License. However, in accepting such obligations, You may act only
|
System Libraries, or general-purpose tools or generally available free
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
programs which are used unmodified in performing those activities but
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
which are not part of the work. For example, Corresponding Source
|
||||||
defend, and hold each Contributor harmless for any liability
|
includes interface definition files associated with source files for
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
the work, and the source code for shared libraries and dynamically
|
||||||
of your accepting any such warranty or additional liability.
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
If you develop a new program, and you want it to be of the greatest
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
possible use to the public, the best way to achieve this is to make it
|
||||||
replaced with your own identifying information. (Don't include
|
free software which everyone can redistribute and change under these terms.
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
you may not use this file except in compliance with the License.
|
Copyright (C) <year> <name of author>
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
This program is distributed in the hope that it will be useful,
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
See the License for the specific language governing permissions and
|
GNU Affero General Public License for more details.
|
||||||
limitations under the License.
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
21
Makefile
@ -47,6 +47,7 @@ HELP := python -c "$$PRINT_HELP_PYSCRIPT"
|
|||||||
ECHO := /usr/bin/env echo
|
ECHO := /usr/bin/env echo
|
||||||
|
|
||||||
IS_DOCKER_COMPOSE_INSTALLED := $(shell command -v docker-compose 2> /dev/null)
|
IS_DOCKER_COMPOSE_INSTALLED := $(shell command -v docker-compose 2> /dev/null)
|
||||||
|
IS_BLACK_INSTALLED := $(shell command -v black 2> /dev/null)
|
||||||
|
|
||||||
################
|
################
|
||||||
# Main targets #
|
# Main targets #
|
||||||
@ -56,10 +57,10 @@ help: ## Show this help
|
|||||||
@$(HELP) < $(MAKEFILE_LIST)
|
@$(HELP) < $(MAKEFILE_LIST)
|
||||||
|
|
||||||
run: check-deps ## Run Planetmint from source (stop it with ctrl+c)
|
run: check-deps ## Run Planetmint from source (stop it with ctrl+c)
|
||||||
# although planetmint has tendermint and mongodb in depends_on,
|
# although planetmint has tendermint and tarantool in depends_on,
|
||||||
# launch them first otherwise tendermint will get stuck upon sending yet another log
|
# launch them first otherwise tendermint will get stuck upon sending yet another log
|
||||||
# due to some docker-compose issue; does not happen when containers are run as daemons
|
# due to some docker-compose issue; does not happen when containers are run as daemons
|
||||||
@$(DC) up --no-deps mongodb tendermint planetmint
|
@$(DC) up --no-deps tarantool tendermint planetmint
|
||||||
|
|
||||||
start: check-deps ## Run Planetmint from source and daemonize it (stop with `make stop`)
|
start: check-deps ## Run Planetmint from source and daemonize it (stop with `make stop`)
|
||||||
@$(DC) up -d planetmint
|
@$(DC) up -d planetmint
|
||||||
@ -70,8 +71,11 @@ stop: check-deps ## Stop Planetmint
|
|||||||
logs: check-deps ## Attach to the logs
|
logs: check-deps ## Attach to the logs
|
||||||
@$(DC) logs -f planetmint
|
@$(DC) logs -f planetmint
|
||||||
|
|
||||||
lint: check-deps ## Lint the project
|
lint: check-py-deps ## Lint the project
|
||||||
@$(DC) up lint
|
black --check -l 119 .
|
||||||
|
|
||||||
|
format: check-py-deps ## Format the project
|
||||||
|
black -l 119 .
|
||||||
|
|
||||||
test: check-deps test-unit test-acceptance ## Run unit and acceptance tests
|
test: check-deps test-unit test-acceptance ## Run unit and acceptance tests
|
||||||
|
|
||||||
@ -132,3 +136,12 @@ ifndef IS_DOCKER_COMPOSE_INSTALLED
|
|||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@$(DC) # docker-compose is not installed, so we call it to generate an error and exit
|
@$(DC) # docker-compose is not installed, so we call it to generate an error and exit
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
check-py-deps:
|
||||||
|
ifndef IS_BLACK_INSTALLED
|
||||||
|
@$(ECHO) "Error: black is not installed"
|
||||||
|
@$(ECHO)
|
||||||
|
@$(ECHO) "You need to activate your virtual environment and install the test dependencies"
|
||||||
|
black # black is not installed, so we call it to generate an error and exit
|
||||||
|
endif
|
||||||
|
|
||||||
|
|||||||
@ -82,11 +82,11 @@ x = 'name: {}; score: {}'.format(name, n)
|
|||||||
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
|
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
|
||||||
|
|
||||||
|
|
||||||
## Running the Flake8 Style Checker
|
## Running the Black Style Checker
|
||||||
|
|
||||||
We use [Flake8](http://flake8.pycqa.org/en/latest/index.html) to check our Python code style. Once you have it installed, you can run it using:
|
We use [Black](https://black.readthedocs.io/en/stable/) to check our Python code style. Once you have it installed, you can run it using:
|
||||||
```text
|
```text
|
||||||
flake8 --max-line-length 119 planetmint/
|
black --check -l 119 .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
README.md
@ -18,13 +18,11 @@ so show the latest GitHub release instead.
|
|||||||
|
|
||||||
# Planetmint Server
|
# Planetmint Server
|
||||||
|
|
||||||
Planetmint is the blockchain database. This repository is for _BigchainDB Server_.
|
Planetmint is the blockchain database. This repository is for _Planetmint Server_.
|
||||||
|
|
||||||
## The Basics
|
## The Basics
|
||||||
|
|
||||||
* [Try the Quickstart](https://docs.planetmint.com/projects/server/en/latest/quickstart.html)
|
* [Try the Quickstart](https://docs.planetmint.io/en/latest/introduction/index.html#quickstart)
|
||||||
* [Read the Planetmint 2.0 whitepaper](https://www.planetmint.com/whitepaper/)
|
|
||||||
* [Check out the _Hitchiker's Guide to BigchainDB_](https://www.planetmint.com/developers/guide/)
|
|
||||||
|
|
||||||
## Run and Test Planetmint Server from the `master` Branch
|
## Run and Test Planetmint Server from the `master` Branch
|
||||||
|
|
||||||
@ -55,15 +53,11 @@ To view all commands available, run `make`.
|
|||||||
|
|
||||||
## Links for Everyone
|
## Links for Everyone
|
||||||
|
|
||||||
* [Planetmint.com](https://www.planetmint.com/) - the main Planetmint website, including newsletter signup
|
* [Planetmint.io](https://www.planetmint.io/) - the main Planetmint website, including newsletter signup
|
||||||
* [Roadmap](https://github.com/planetmint/org/blob/master/ROADMAP.md)
|
|
||||||
* [Blog](https://medium.com/the-planetmint-blog)
|
|
||||||
* [Twitter](https://twitter.com/Planetmint)
|
|
||||||
|
|
||||||
## Links for Developers
|
## Links for Developers
|
||||||
|
|
||||||
* [All Planetmint Documentation](https://docs.planetmint.com/en/latest/)
|
* [All Planetmint Documentation](https://docs.planetmint.io/en/latest/)
|
||||||
* [Planetmint Server Documentation](https://docs.planetmint.com/projects/server/en/latest/index.html)
|
|
||||||
* [CONTRIBUTING.md](.github/CONTRIBUTING.md) - how to contribute
|
* [CONTRIBUTING.md](.github/CONTRIBUTING.md) - how to contribute
|
||||||
* [Community guidelines](CODE_OF_CONDUCT.md)
|
* [Community guidelines](CODE_OF_CONDUCT.md)
|
||||||
* [Open issues](https://github.com/planetmint/planetmint/issues)
|
* [Open issues](https://github.com/planetmint/planetmint/issues)
|
||||||
@ -73,5 +67,3 @@ To view all commands available, run `make`.
|
|||||||
## Legal
|
## Legal
|
||||||
|
|
||||||
* [Licenses](LICENSES.md) - open source & open content
|
* [Licenses](LICENSES.md) - open source & open content
|
||||||
* [Imprint](https://www.planetmint.com/imprint/)
|
|
||||||
* [Contact Us](https://www.planetmint.com/contact/)
|
|
||||||
|
|||||||
77
README_cn.md
@ -1,77 +0,0 @@
|
|||||||
<!---
|
|
||||||
Copyright © 2020 Interplanetary Database Association e.V.,
|
|
||||||
Planetmint 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/planetmint/planetmint?branch=master)
|
|
||||||
[](https://github.com/planetmint/planetmint/releases)
|
|
||||||
[](https://pypi.org/project/Planetmint/)
|
|
||||||
[](https://travis-ci.com/planetmint/planetmint)
|
|
||||||
[](https://docs.planetmint.com/projects/server/en/latest/)
|
|
||||||
[](https://gitter.im/planetmint/planetmint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
||||||
|
|
||||||
# Planetmint 服务器
|
|
||||||
|
|
||||||
Planetmint 是区块链数据库. 这是 _BigchainDB 服务器_ 的仓库.
|
|
||||||
|
|
||||||
## 基础知识
|
|
||||||
|
|
||||||
* [尝试快速开始](https://docs.planetmint.com/projects/server/en/latest/quickstart.html)
|
|
||||||
* [阅读 Planetmint 2.0 白皮书](https://www.planetmint.com/whitepaper/)
|
|
||||||
* [查阅漫游指南](https://www.planetmint.com/developers/guide/)
|
|
||||||
|
|
||||||
## 运行和测试 `master` 分支的 Planetmint 服务器
|
|
||||||
|
|
||||||
运行和测试最新版本的 Planetmint 服务器非常简单. 确认你有安装最新版本的 [Docker Compose](https://docs.docker.com/compose/install/). 当你准备好了, 打开一个终端并运行:
|
|
||||||
|
|
||||||
```text
|
|
||||||
git clone https://github.com/planetmint/planetmint.git
|
|
||||||
cd planetmint
|
|
||||||
make run
|
|
||||||
```
|
|
||||||
|
|
||||||
Planetmint 应该可以通过 `http://localhost:9984/` 访问.
|
|
||||||
|
|
||||||
这里也有一些其他的命令你可以运行:
|
|
||||||
|
|
||||||
* `make start`: 通过源码和守护进程的方式运行 Planetmint (通过 `make stop` 停止).
|
|
||||||
* `make stop`: 停止运行 Planetmint.
|
|
||||||
* `make logs`: 附在日志上.
|
|
||||||
* `make test`: 运行所有单元和验收测试.
|
|
||||||
* `make test-unit-watch`: 运行所有测试并等待. 每次更改代码时都会再次运行测试.
|
|
||||||
* `make cov`: 检查代码覆盖率并在浏览器中打开结果.
|
|
||||||
* `make doc`: 生成 HTML 文档并在浏览器中打开它.
|
|
||||||
* `make clean`: 删除所有构建, 测试, 覆盖和 Python 生成物.
|
|
||||||
* `make reset`: 停止并移除所有容器. 警告: 您将丢失存储在 Planetmint 中的所有数据.
|
|
||||||
|
|
||||||
查看所有可用命令, 请运行 `make`.
|
|
||||||
|
|
||||||
## 一般人员链接
|
|
||||||
|
|
||||||
* [Planetmint.com](https://www.planetmint.com/) - Planetmint 主网站, 包括新闻订阅
|
|
||||||
* [路线图](https://github.com/planetmint/org/blob/master/ROADMAP.md)
|
|
||||||
* [博客](https://medium.com/the-planetmint-blog)
|
|
||||||
* [推特](https://twitter.com/Planetmint)
|
|
||||||
|
|
||||||
## 开发人员链接
|
|
||||||
|
|
||||||
* [所有的 Planetmint 文档](https://docs.planetmint.com/en/latest/)
|
|
||||||
* [Planetmint 服务器 文档](https://docs.planetmint.com/projects/server/en/latest/index.html)
|
|
||||||
* [CONTRIBUTING.md](.github/CONTRIBUTING.md) - how to contribute
|
|
||||||
* [社区指南](CODE_OF_CONDUCT.md)
|
|
||||||
* [公开问题](https://github.com/planetmint/planetmint/issues)
|
|
||||||
* [公开的 pull request](https://github.com/planetmint/planetmint/pulls)
|
|
||||||
* [Gitter 聊天室](https://gitter.im/planetmint/planetmint)
|
|
||||||
|
|
||||||
## 法律声明
|
|
||||||
|
|
||||||
* [许可](LICENSES.md) - 开源代码 & 开源内容
|
|
||||||
* [印记](https://www.planetmint.com/imprint/)
|
|
||||||
* [联系我们](https://www.planetmint.com/contact/)
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
[](https://codecov.io/github/planetmint/planetmint?branch=master)
|
|
||||||
[](https://github.com/planetmint/planetmint/releases)
|
|
||||||
[](https://pypi.org/project/Planetmint/)
|
|
||||||
[](https://travis-ci.org/planetmint/planetmint)
|
|
||||||
[](https://docs.planetmint.com/projects/server/en/latest/)
|
|
||||||
[](https://gitter.im/planetmint/planetmint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
||||||
|
|
||||||
# Planetmint 서버
|
|
||||||
|
|
||||||
BigchaingDB는 블록체인 데이터베이스입니다. 이 저장소는 _BigchaingDB 서버_를 위한 저장소입니다.
|
|
||||||
|
|
||||||
### 기본 사항
|
|
||||||
|
|
||||||
* [빠른 시작 사용해보기](https://docs.planetmint.com/projects/server/en/latest/quickstart.html)
|
|
||||||
* [Planetmint 2.0 백서 읽기](https://www.planetmint.com/whitepaper/)
|
|
||||||
* [BigchainDB에 대한 _Hitchiker's Guide_를 확인십시오.](https://www.planetmint.com/developers/guide/)
|
|
||||||
|
|
||||||
### `master` Branch에서 Planetmint 서버 실행 및 테스트
|
|
||||||
|
|
||||||
BigchaingDB 서버의 최신 버전을 실행하고 테스트하는 것은 어렵지 않습니다. [Docker Compose](https://docs.docker.com/compose/install/)의 최신 버전이 설치되어 있는지 확인하십시오. 준비가 되었다면, 터미널에서 다음을 실행하십시오.
|
|
||||||
|
|
||||||
```text
|
|
||||||
git clone https://github.com/planetmint/planetmint.git
|
|
||||||
cd planetmint
|
|
||||||
make run
|
|
||||||
```
|
|
||||||
|
|
||||||
이제 BigchainDB는 `http://localhost:9984/`에 연결되어야 합니다.
|
|
||||||
|
|
||||||
또한, 실행시키기 위한 다른 명령어들도 있습니다.
|
|
||||||
|
|
||||||
* `make start` : 소스로부터 BigchainDB를 실행하고 데몬화합니다. \(이는 `make stop` 을 하면 중지합니다.\)
|
|
||||||
* `make stop` : BigchainDB를 중지합니다.
|
|
||||||
* `make logs` : 로그에 첨부합니다.
|
|
||||||
* `make text` : 모든 유닛과 허가 테스트를 실행합니다.
|
|
||||||
* `make test-unit-watch` : 모든 테스트를 수행하고 기다립니다. 코드를 변경할 때마다 테스트는 다시 실행될 것입니다.
|
|
||||||
* `make cov` : 코드 커버리지를 확인하고 브라우저에서 결과를 엽니다.
|
|
||||||
* `make doc` : HTML 문서를 만들고, 브라우저에서 엽니다.
|
|
||||||
* `make clean` : 모든 빌드와 테스트, 커버리지 및 파이썬 아티팩트를 제거합니다.
|
|
||||||
* `make reset` : 모든 컨테이너들을 중지하고 제거합니다. 경고 : BigchainDB에 저장된 모든 데이터를 잃을 수 있습니다.
|
|
||||||
|
|
||||||
사용 가능한 모든 명령어를 보기 위해서는 `make` 를 실행하십시오.
|
|
||||||
|
|
||||||
### 모두를 위한 링크들
|
|
||||||
|
|
||||||
* [Planetmint.com ](https://www.planetmint.com/)- 뉴스 레터 가입을 포함하는 Planetmint 주요 웹 사이트
|
|
||||||
* [로드맵](https://github.com/planetmint/org/blob/master/ROADMAP.md)
|
|
||||||
* [블로그](https://medium.com/the-planetmint-blog)
|
|
||||||
* [트위터](https://twitter.com/Planetmint)
|
|
||||||
|
|
||||||
### 개발자들을 위한 링크들
|
|
||||||
|
|
||||||
* [모든 Planetmint 문서](https://docs.planetmint.com/en/latest/)
|
|
||||||
* [Planetmint 서버 문서](https://docs.planetmint.com/projects/server/en/latest/index.html)
|
|
||||||
* [CONTRIBUTING.md](https://github.com/planetmint/planetmint/blob/master/.github/CONTRIBUTING.md) - 기여를 하는 방법
|
|
||||||
* [커뮤니티 가이드라인](https://github.com/planetmint/planetmint/blob/master/CODE_OF_CONDUCT.md)
|
|
||||||
* [이슈 작성](https://github.com/planetmint/planetmint/issues)
|
|
||||||
* [pull request 하기](https://github.com/planetmint/planetmint/pulls)
|
|
||||||
* [Gitter 채팅방](https://gitter.im/planetmint/planetmint)
|
|
||||||
|
|
||||||
### 합법
|
|
||||||
|
|
||||||
* [라이선스](https://github.com/planetmint/planetmint/blob/master/LICENSES.md) - 오픈 소스 & 오픈 콘텐츠
|
|
||||||
* [발행](https://www.planetmint.com/imprint/)
|
|
||||||
* [연락처](https://www.planetmint.com/contact/)
|
|
||||||
@ -4,18 +4,17 @@ RUN apt-get update \
|
|||||||
&& pip install -U pip \
|
&& pip install -U pip \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& apt-get clean
|
&& apt-get clean
|
||||||
RUN apt-get install -y vim zsh build-essential cmake
|
RUN apt-get install -y vim zsh build-essential cmake git
|
||||||
|
|
||||||
RUN mkdir -p /src
|
RUN mkdir -p /src
|
||||||
RUN /usr/local/bin/python -m pip install --upgrade pip
|
RUN /usr/local/bin/python -m pip install --upgrade pip
|
||||||
RUN pip install --upgrade meson ninja
|
RUN pip install --upgrade meson ninja
|
||||||
RUN pip install zenroom==2.0.0.dev1644927841
|
|
||||||
RUN pip install --upgrade \
|
RUN pip install --upgrade \
|
||||||
pycco \
|
pycco \
|
||||||
websocket-client~=0.47.0 \
|
websocket-client~=0.47.0 \
|
||||||
pytest~=3.0 \
|
pytest~=3.0 \
|
||||||
# planetmint-cryptoconditions>=0.9.4\
|
planetmint-cryptoconditions>=0.10.0\
|
||||||
# planetmint-driver>=0.9.0 \
|
planetmint-driver>=0.9.2 \
|
||||||
git+https://github.com/planetmint/cryptoconditions.git@asset-migration \
|
|
||||||
git+https://github.com/planetmint/planetmint-driver-python.git@asset-migration \
|
|
||||||
blns
|
blns
|
||||||
|
RUN pip install base58>=2.1.1 pynacl==1.4.0 zenroom==2.1.0.dev1655293214 pyasn1==0.4.8 cryptography==3.4.7
|
||||||
|
RUN pip install planetmint-ipld>=0.0.3
|
||||||
|
|||||||
@ -5,40 +5,35 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
GENERATE_KEYPAIR = \
|
CONDITION_SCRIPT = """Scenario 'ecdh': create the signature of an object
|
||||||
"""Rule input encoding base58
|
Given I have the 'keyring'
|
||||||
Rule output encoding base58
|
Given that I have a 'string dictionary' named 'houses'
|
||||||
Scenario 'ecdh': Create the keypair
|
When I create the signature of 'houses'
|
||||||
Given that I am known as 'Pippo'
|
Then print the 'signature'"""
|
||||||
When I create the ecdh key
|
|
||||||
When I create the testnet key
|
|
||||||
Then print data"""
|
|
||||||
|
|
||||||
# secret key to public key
|
FULFILL_SCRIPT = """Scenario 'ecdh': Bob verifies the signature from Alice
|
||||||
SK_TO_PK = \
|
|
||||||
"""Rule input encoding base58
|
|
||||||
Rule output encoding base58
|
|
||||||
Scenario 'ecdh': Create the keypair
|
|
||||||
Given that I am known as '{}'
|
|
||||||
Given I have the 'keys'
|
|
||||||
When I create the ecdh public key
|
|
||||||
When I create the testnet address
|
|
||||||
Then print my 'ecdh public key'
|
|
||||||
Then print my 'testnet address'"""
|
|
||||||
|
|
||||||
FULFILL_SCRIPT = \
|
|
||||||
"""Rule input encoding base58
|
|
||||||
Rule output encoding base58
|
|
||||||
Scenario 'ecdh': Bob verifies the signature from Alice
|
|
||||||
Given I have a 'ecdh public key' from 'Alice'
|
Given I have a 'ecdh public key' from 'Alice'
|
||||||
Given that I have a 'string dictionary' named 'houses' inside 'asset'
|
Given that I have a 'string dictionary' named 'houses'
|
||||||
Given I have a 'signature' named 'data.signature' inside 'result'
|
Given I have a 'signature' named 'signature'
|
||||||
When I verify the 'houses' has a signature in 'data.signature' by 'Alice'
|
When I verify the 'houses' has a signature in 'signature' by 'Alice'
|
||||||
Then print the string 'ok'"""
|
Then print the string 'ok'"""
|
||||||
|
|
||||||
HOUSE_ASSETS = [
|
SK_TO_PK = """Scenario 'ecdh': Create the keypair
|
||||||
{
|
Given that I am known as '{}'
|
||||||
"data": {
|
Given I have the 'keyring'
|
||||||
|
When I create the ecdh public key
|
||||||
|
When I create the bitcoin address
|
||||||
|
Then print my 'ecdh public key'
|
||||||
|
Then print my 'bitcoin address'"""
|
||||||
|
|
||||||
|
GENERATE_KEYPAIR = """Scenario 'ecdh': Create the keypair
|
||||||
|
Given that I am known as 'Pippo'
|
||||||
|
When I create the ecdh key
|
||||||
|
When I create the bitcoin key
|
||||||
|
Then print data"""
|
||||||
|
|
||||||
|
INITIAL_STATE = {"also": "more data"}
|
||||||
|
SCRIPT_INPUT = {
|
||||||
"houses": [
|
"houses": [
|
||||||
{
|
{
|
||||||
"name": "Harry",
|
"name": "Harry",
|
||||||
@ -47,44 +42,44 @@ HOUSE_ASSETS = [
|
|||||||
{
|
{
|
||||||
"name": "Draco",
|
"name": "Draco",
|
||||||
"team": "Slytherin",
|
"team": "Slytherin",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
ZENROOM_DATA = {
|
|
||||||
'also': 'more data'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CONDITION_SCRIPT = """Rule input encoding base58
|
metadata = {"units": 300, "type": "KG"}
|
||||||
Rule output encoding base58
|
|
||||||
Scenario 'ecdh': create the signature of an object
|
ZENROOM_DATA = {"that": "is my data"}
|
||||||
Given I have the 'keys'
|
|
||||||
Given that I have a 'string dictionary' named 'houses' inside 'asset'
|
|
||||||
When I create the signature of 'houses'
|
|
||||||
When I rename the 'signature' to 'data.signature'
|
|
||||||
Then print the 'data.signature'"""
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def gen_key_zencode():
|
def gen_key_zencode():
|
||||||
return GENERATE_KEYPAIR
|
return GENERATE_KEYPAIR
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def secret_key_to_private_key_zencode():
|
def secret_key_to_private_key_zencode():
|
||||||
return SK_TO_PK
|
return SK_TO_PK
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fulfill_script_zencode():
|
def fulfill_script_zencode():
|
||||||
return FULFILL_SCRIPT
|
return FULFILL_SCRIPT
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def condition_script_zencode():
|
def condition_script_zencode():
|
||||||
return CONDITION_SCRIPT
|
return CONDITION_SCRIPT
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def zenroom_house_assets():
|
def zenroom_house_assets():
|
||||||
return HOUSE_ASSETS
|
return SCRIPT_INPUT
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def zenroom_script_input():
|
||||||
|
return SCRIPT_INPUT
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def zenroom_data():
|
def zenroom_data():
|
||||||
|
|||||||
174
acceptance/python/src/test_analyse_tx.py
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
# Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
# Planetmint 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
|
||||||
|
|
||||||
|
# # Basic Acceptance Test
|
||||||
|
# Here we check that the primitives of the system behave as expected.
|
||||||
|
# As you will see, this script tests basic stuff like:
|
||||||
|
#
|
||||||
|
# - create a transaction
|
||||||
|
# - check if the transaction is stored
|
||||||
|
# - check for the outputs of a given public key
|
||||||
|
# - transfer the transaction to another key
|
||||||
|
#
|
||||||
|
# We run a series of checks for each steps, that is retrieving the transaction from
|
||||||
|
# the remote system, and also checking the `outputs` of a given public key.
|
||||||
|
|
||||||
|
# ## Imports
|
||||||
|
# We need some utils from the `os` package, we will interact with
|
||||||
|
# env variables.
|
||||||
|
import os
|
||||||
|
|
||||||
|
# For this test case we import and use the Python Driver.
|
||||||
|
from planetmint_driver import Planetmint
|
||||||
|
from planetmint_driver.crypto import generate_keypair
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_tests():
|
||||||
|
# ## Set up a connection to Planetmint
|
||||||
|
# To use BighainDB we need a connection. Here we create one. By default we
|
||||||
|
# connect to localhost, but you can override this value using the env variable
|
||||||
|
# called `PLANETMINT_ENDPOINT`, a valid value must include the schema:
|
||||||
|
# `https://example.com:9984`
|
||||||
|
bdb = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
|
|
||||||
|
# ## Create keypairs
|
||||||
|
# This test requires the interaction between two actors with their own keypair.
|
||||||
|
# The two keypairs will be called—drum roll—Alice and Bob.
|
||||||
|
alice, bob = generate_keypair(), generate_keypair()
|
||||||
|
|
||||||
|
# ## Alice registers her bike in Planetmint
|
||||||
|
# Alice has a nice bike, and here she creates the "digital twin"
|
||||||
|
# of her bike.
|
||||||
|
bike = {"data": multihash(marshal({"bicycle": {"serial_number": 420420}}))}
|
||||||
|
|
||||||
|
# She prepares a `CREATE` transaction...
|
||||||
|
prepared_creation_tx = bdb.transactions.prepare(operation="CREATE", signers=alice.public_key, asset=bike)
|
||||||
|
|
||||||
|
# ... and she fulfills it with her private key.
|
||||||
|
fulfilled_creation_tx = bdb.transactions.fulfill(prepared_creation_tx, private_keys=alice.private_key)
|
||||||
|
|
||||||
|
# We will use the `id` of this transaction several time, so we store it in
|
||||||
|
# a variable with a short and easy name
|
||||||
|
bike_id = fulfilled_creation_tx["id"]
|
||||||
|
|
||||||
|
# Now she is ready to send it to the Planetmint Network.
|
||||||
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_creation_tx)
|
||||||
|
|
||||||
|
# And just to be 100% sure, she also checks if she can retrieve
|
||||||
|
# it from the Planetmint node.
|
||||||
|
assert bdb.transactions.retrieve(bike_id), "Cannot find transaction {}".format(bike_id)
|
||||||
|
|
||||||
|
# Alice is now the proud owner of one unspent asset.
|
||||||
|
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 1
|
||||||
|
assert bdb.outputs.get(alice.public_key)[0]["transaction_id"] == bike_id
|
||||||
|
|
||||||
|
# ## Alice transfers her bike to Bob
|
||||||
|
# After registering her bike, Alice is ready to transfer it to Bob.
|
||||||
|
# She needs to create a new `TRANSFER` transaction.
|
||||||
|
|
||||||
|
# A `TRANSFER` transaction contains a pointer to the original asset. The original asset
|
||||||
|
# is identified by the `id` of the `CREATE` transaction that defined it.
|
||||||
|
transfer_asset = {"id": bike_id}
|
||||||
|
|
||||||
|
# Alice wants to spend the one and only output available, the one with index `0`.
|
||||||
|
output_index = 0
|
||||||
|
output = fulfilled_creation_tx["outputs"][output_index]
|
||||||
|
|
||||||
|
# Here, she defines the `input` of the `TRANSFER` transaction. The `input` contains
|
||||||
|
# several keys:
|
||||||
|
#
|
||||||
|
# - `fulfillment`, taken from the previous `CREATE` transaction.
|
||||||
|
# - `fulfills`, that specifies which condition she is fulfilling.
|
||||||
|
# - `owners_before`.
|
||||||
|
transfer_input = {
|
||||||
|
"fulfillment": output["condition"]["details"],
|
||||||
|
"fulfills": {"output_index": output_index, "transaction_id": fulfilled_creation_tx["id"]},
|
||||||
|
"owners_before": output["public_keys"],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now that all the elements are set, she creates the actual transaction...
|
||||||
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
|
operation="TRANSFER", asset=transfer_asset, inputs=transfer_input, recipients=bob.public_key
|
||||||
|
)
|
||||||
|
|
||||||
|
# ... and signs it with her private key.
|
||||||
|
fulfilled_transfer_tx = bdb.transactions.fulfill(prepared_transfer_tx, private_keys=alice.private_key)
|
||||||
|
|
||||||
|
# She finally sends the transaction to a Planetmint node.
|
||||||
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
||||||
|
|
||||||
|
# And just to be 100% sure, she also checks if she can retrieve
|
||||||
|
# it from the Planetmint node.
|
||||||
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"]) == sent_transfer_tx
|
||||||
|
|
||||||
|
# Now Alice has zero unspent transactions.
|
||||||
|
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 0
|
||||||
|
|
||||||
|
# While Bob has one.copy
|
||||||
|
assert len(bdb.outputs.get(bob.public_key, spent=False)) == 1
|
||||||
|
|
||||||
|
# Bob double checks what he got was the actual bike.
|
||||||
|
bob_tx_id = bdb.outputs.get(bob.public_key, spent=False)[0]["transaction_id"]
|
||||||
|
assert bdb.transactions.retrieve(bob_tx_id) == sent_transfer_tx
|
||||||
|
|
||||||
|
transfer_asset = {"id": bike_id}
|
||||||
|
|
||||||
|
# Alice wants to spend the one and only output available, the one with index `0`.
|
||||||
|
output_index = 0
|
||||||
|
output = fulfilled_transfer_tx["outputs"][output_index]
|
||||||
|
|
||||||
|
# Here, she defines the `input` of the `TRANSFER` transaction. The `input` contains
|
||||||
|
# several keys:
|
||||||
|
#
|
||||||
|
# - `fulfillment`, taken from the previous `CREATE` transaction.
|
||||||
|
# - `fulfills`, that specifies which condition she is fulfilling.
|
||||||
|
# - `owners_before`.
|
||||||
|
transfer_input = {
|
||||||
|
"fulfillment": output["condition"]["details"],
|
||||||
|
"fulfills": {"output_index": output_index, "transaction_id": fulfilled_transfer_tx["id"]},
|
||||||
|
"owners_before": output["public_keys"],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now that all the elements are set, she creates the actual transaction...
|
||||||
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
|
operation="TRANSFER", asset=transfer_asset, inputs=transfer_input, recipients=bob.public_key
|
||||||
|
)
|
||||||
|
|
||||||
|
# ... and signs it with her private key.
|
||||||
|
fulfilled_transfer_tx = bdb.transactions.fulfill(prepared_transfer_tx, private_keys=bob.private_key)
|
||||||
|
|
||||||
|
# She finally sends the transaction to a Planetmint node.
|
||||||
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
||||||
|
|
||||||
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"]) == sent_transfer_tx
|
||||||
|
|
||||||
|
# from urllib3 import request
|
||||||
|
import urllib3
|
||||||
|
import json
|
||||||
|
|
||||||
|
http = urllib3.PoolManager()
|
||||||
|
|
||||||
|
# verify that 3 transactions contain the asset_id
|
||||||
|
asset_id = bike_id
|
||||||
|
url = "http://planetmint:9984/api/v1/transactions?asset_id=" + asset_id
|
||||||
|
r = http.request("GET", url)
|
||||||
|
tmp_json = http.request("GET", url)
|
||||||
|
tmp_json = json.loads(tmp_json.data.decode("utf-8"))
|
||||||
|
assert len(tmp_json) == 3
|
||||||
|
|
||||||
|
# verify that one transaction is the create TX
|
||||||
|
url = "http://planetmint:9984/api/v1/transactions?asset_id=" + asset_id + "&operation=CREATE"
|
||||||
|
r = http.request("GET", url)
|
||||||
|
tmp_json = http.request("GET", url)
|
||||||
|
tmp_json = json.loads(tmp_json.data.decode("utf-8"))
|
||||||
|
assert len(tmp_json) == 1
|
||||||
|
|
||||||
|
# verify that 2 transactoins are of type transfer
|
||||||
|
url = "http://planetmint:9984/api/v1/transactions?asset_id=" + asset_id + "&operation=transfer"
|
||||||
|
r = http.request("GET", url)
|
||||||
|
tmp_json = http.request("GET", url)
|
||||||
|
tmp_json = json.loads(tmp_json.data.decode("utf-8"))
|
||||||
|
assert len(tmp_json) == 2
|
||||||
@ -14,9 +14,6 @@
|
|||||||
#
|
#
|
||||||
# We run a series of checks for each steps, that is retrieving the transaction from
|
# We run a series of checks for each steps, that is retrieving the transaction from
|
||||||
# the remote system, and also checking the `outputs` of a given public key.
|
# the remote system, and also checking the `outputs` of a given public key.
|
||||||
#
|
|
||||||
# This acceptance test is a rip-off of our
|
|
||||||
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
|
|
||||||
|
|
||||||
# ## Imports
|
# ## Imports
|
||||||
# We need some utils from the `os` package, we will interact with
|
# We need some utils from the `os` package, we will interact with
|
||||||
@ -26,6 +23,7 @@ import os
|
|||||||
# For this test case we import and use the Python Driver.
|
# For this test case we import and use the Python Driver.
|
||||||
from planetmint_driver import Planetmint
|
from planetmint_driver import Planetmint
|
||||||
from planetmint_driver.crypto import generate_keypair
|
from planetmint_driver.crypto import generate_keypair
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
|
|
||||||
def test_basic():
|
def test_basic():
|
||||||
@ -34,7 +32,7 @@ def test_basic():
|
|||||||
# connect to localhost, but you can override this value using the env variable
|
# connect to localhost, but you can override this value using the env variable
|
||||||
# called `PLANETMINT_ENDPOINT`, a valid value must include the schema:
|
# called `PLANETMINT_ENDPOINT`, a valid value must include the schema:
|
||||||
# `https://example.com:9984`
|
# `https://example.com:9984`
|
||||||
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
|
bdb = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
|
|
||||||
# ## Create keypairs
|
# ## Create keypairs
|
||||||
# This test requires the interaction between two actors with their own keypair.
|
# This test requires the interaction between two actors with their own keypair.
|
||||||
@ -44,33 +42,28 @@ def test_basic():
|
|||||||
# ## Alice registers her bike in Planetmint
|
# ## Alice registers her bike in Planetmint
|
||||||
# Alice has a nice bike, and here she creates the "digital twin"
|
# Alice has a nice bike, and here she creates the "digital twin"
|
||||||
# of her bike.
|
# of her bike.
|
||||||
bike = [{'data': {'bicycle': {'serial_number': 420420}}}]
|
bike = [{"data": multihash(marshal({"bicycle": {"serial_number": 420420}}))}]
|
||||||
|
|
||||||
# She prepares a `CREATE` transaction...
|
# She prepares a `CREATE` transaction...
|
||||||
prepared_creation_tx = bdb.transactions.prepare(
|
prepared_creation_tx = bdb.transactions.prepare(operation="CREATE", signers=alice.public_key, assets=bike)
|
||||||
operation='CREATE',
|
|
||||||
signers=alice.public_key,
|
|
||||||
assets=bike)
|
|
||||||
|
|
||||||
# ... and she fulfills it with her private key.
|
# ... and she fulfills it with her private key.
|
||||||
fulfilled_creation_tx = bdb.transactions.fulfill(
|
fulfilled_creation_tx = bdb.transactions.fulfill(prepared_creation_tx, private_keys=alice.private_key)
|
||||||
prepared_creation_tx,
|
|
||||||
private_keys=alice.private_key)
|
|
||||||
|
|
||||||
# We will use the `id` of this transaction several time, so we store it in
|
# We will use the `id` of this transaction several time, so we store it in
|
||||||
# a variable with a short and easy name
|
# a variable with a short and easy name
|
||||||
bike_id = fulfilled_creation_tx['id']
|
bike_id = fulfilled_creation_tx["id"]
|
||||||
|
|
||||||
# Now she is ready to send it to the Planetmint Network.
|
# Now she is ready to send it to the Planetmint Network.
|
||||||
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_creation_tx)
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_creation_tx)
|
||||||
|
|
||||||
# And just to be 100% sure, she also checks if she can retrieve
|
# And just to be 100% sure, she also checks if she can retrieve
|
||||||
# it from the Planetmint node.
|
# it from the Planetmint node.
|
||||||
assert bdb.transactions.retrieve(bike_id), 'Cannot find transaction {}'.format(bike_id)
|
assert bdb.transactions.retrieve(bike_id), "Cannot find transaction {}".format(bike_id)
|
||||||
|
|
||||||
# Alice is now the proud owner of one unspent asset.
|
# Alice is now the proud owner of one unspent asset.
|
||||||
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 1
|
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 1
|
||||||
assert bdb.outputs.get(alice.public_key)[0]['transaction_id'] == bike_id
|
assert bdb.outputs.get(alice.public_key)[0]["transaction_id"] == bike_id
|
||||||
|
|
||||||
# ## Alice transfers her bike to Bob
|
# ## Alice transfers her bike to Bob
|
||||||
# After registering her bike, Alice is ready to transfer it to Bob.
|
# After registering her bike, Alice is ready to transfer it to Bob.
|
||||||
@ -78,11 +71,11 @@ def test_basic():
|
|||||||
|
|
||||||
# A `TRANSFER` transaction contains a pointer to the original asset. The original asset
|
# A `TRANSFER` transaction contains a pointer to the original asset. The original asset
|
||||||
# is identified by the `id` of the `CREATE` transaction that defined it.
|
# is identified by the `id` of the `CREATE` transaction that defined it.
|
||||||
transfer_assets = [{'id': bike_id}]
|
transfer_assets = [{"id": bike_id}]
|
||||||
|
|
||||||
# Alice wants to spend the one and only output available, the one with index `0`.
|
# Alice wants to spend the one and only output available, the one with index `0`.
|
||||||
output_index = 0
|
output_index = 0
|
||||||
output = fulfilled_creation_tx['outputs'][output_index]
|
output = fulfilled_creation_tx["outputs"][output_index]
|
||||||
|
|
||||||
# Here, she defines the `input` of the `TRANSFER` transaction. The `input` contains
|
# Here, she defines the `input` of the `TRANSFER` transaction. The `input` contains
|
||||||
# several keys:
|
# several keys:
|
||||||
@ -90,29 +83,26 @@ def test_basic():
|
|||||||
# - `fulfillment`, taken from the previous `CREATE` transaction.
|
# - `fulfillment`, taken from the previous `CREATE` transaction.
|
||||||
# - `fulfills`, that specifies which condition she is fulfilling.
|
# - `fulfills`, that specifies which condition she is fulfilling.
|
||||||
# - `owners_before`.
|
# - `owners_before`.
|
||||||
transfer_input = {'fulfillment': output['condition']['details'],
|
transfer_input = {
|
||||||
'fulfills': {'output_index': output_index,
|
"fulfillment": output["condition"]["details"],
|
||||||
'transaction_id': fulfilled_creation_tx['id']},
|
"fulfills": {"output_index": output_index, "transaction_id": fulfilled_creation_tx["id"]},
|
||||||
'owners_before': output['public_keys']}
|
"owners_before": output["public_keys"],
|
||||||
|
}
|
||||||
|
|
||||||
# Now that all the elements are set, she creates the actual transaction...
|
# Now that all the elements are set, she creates the actual transaction...
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation="TRANSFER", assets=transfer_assets, inputs=transfer_input, recipients=bob.public_key
|
||||||
assets=transfer_assets,
|
)
|
||||||
inputs=transfer_input,
|
|
||||||
recipients=bob.public_key)
|
|
||||||
|
|
||||||
# ... and signs it with her private key.
|
# ... and signs it with her private key.
|
||||||
fulfilled_transfer_tx = bdb.transactions.fulfill(
|
fulfilled_transfer_tx = bdb.transactions.fulfill(prepared_transfer_tx, private_keys=alice.private_key)
|
||||||
prepared_transfer_tx,
|
|
||||||
private_keys=alice.private_key)
|
|
||||||
|
|
||||||
# She finally sends the transaction to a Planetmint node.
|
# She finally sends the transaction to a Planetmint node.
|
||||||
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
||||||
|
|
||||||
# And just to be 100% sure, she also checks if she can retrieve
|
# And just to be 100% sure, she also checks if she can retrieve
|
||||||
# it from the Planetmint node.
|
# it from the Planetmint node.
|
||||||
assert bdb.transactions.retrieve(fulfilled_transfer_tx['id']) == sent_transfer_tx
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"]) == sent_transfer_tx
|
||||||
|
|
||||||
# Now Alice has zero unspent transactions.
|
# Now Alice has zero unspent transactions.
|
||||||
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 0
|
assert len(bdb.outputs.get(alice.public_key, spent=False)) == 0
|
||||||
@ -121,5 +111,5 @@ def test_basic():
|
|||||||
assert len(bdb.outputs.get(bob.public_key, spent=False)) == 1
|
assert len(bdb.outputs.get(bob.public_key, spent=False)) == 1
|
||||||
|
|
||||||
# Bob double checks what he got was the actual bike.
|
# Bob double checks what he got was the actual bike.
|
||||||
bob_tx_id = bdb.outputs.get(bob.public_key, spent=False)[0]['transaction_id']
|
bob_tx_id = bdb.outputs.get(bob.public_key, spent=False)[0]["transaction_id"]
|
||||||
assert bdb.transactions.retrieve(bob_tx_id) == sent_transfer_tx
|
assert bdb.transactions.retrieve(bob_tx_id) == sent_transfer_tx
|
||||||
|
|||||||
@ -15,9 +15,6 @@
|
|||||||
# We run a series of checks for each step, that is retrieving
|
# We run a series of checks for each step, that is retrieving
|
||||||
# the transaction from the remote system, and also checking the `amount`
|
# the transaction from the remote system, and also checking the `amount`
|
||||||
# of a given transaction.
|
# of a given transaction.
|
||||||
#
|
|
||||||
# This integration test is a rip-off of our
|
|
||||||
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
|
|
||||||
|
|
||||||
# ## Imports
|
# ## Imports
|
||||||
# We need some utils from the `os` package, we will interact with
|
# We need some utils from the `os` package, we will interact with
|
||||||
@ -31,13 +28,14 @@ from planetmint_driver.exceptions import BadRequest
|
|||||||
# For this test case we import and use the Python Driver.
|
# For this test case we import and use the Python Driver.
|
||||||
from planetmint_driver import Planetmint
|
from planetmint_driver import Planetmint
|
||||||
from planetmint_driver.crypto import generate_keypair
|
from planetmint_driver.crypto import generate_keypair
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
|
|
||||||
def test_divisible_assets():
|
def test_divisible_assets():
|
||||||
# ## Set up a connection to Planetmint
|
# ## Set up a connection to Planetmint
|
||||||
# Check [test_basic.py](./test_basic.html) to get some more details
|
# Check [test_basic.py](./test_basic.html) to get some more details
|
||||||
# about the endpoint.
|
# about the endpoint.
|
||||||
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
|
bdb = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
|
|
||||||
# Oh look, it is Alice again and she brought her friend Bob along.
|
# Oh look, it is Alice again and she brought her friend Bob along.
|
||||||
alice, bob = generate_keypair(), generate_keypair()
|
alice, bob = generate_keypair(), generate_keypair()
|
||||||
@ -51,42 +49,36 @@ def test_divisible_assets():
|
|||||||
# the bike for one hour.
|
# the bike for one hour.
|
||||||
|
|
||||||
bike_token = [{
|
bike_token = [{
|
||||||
'data': {
|
"data": multihash(
|
||||||
'token_for': {
|
marshal(
|
||||||
'bike': {
|
{
|
||||||
'serial_number': 420420
|
"token_for": {"bike": {"serial_number": 420420}},
|
||||||
|
"description": "Time share token. Each token equals one hour of riding.",
|
||||||
}
|
}
|
||||||
},
|
)
|
||||||
'description': 'Time share token. Each token equals one hour of riding.',
|
),
|
||||||
},
|
|
||||||
}]
|
}]
|
||||||
|
|
||||||
# She prepares a `CREATE` transaction and issues 10 tokens.
|
# She prepares a `CREATE` transaction and issues 10 tokens.
|
||||||
# Here, Alice defines in a tuple that she wants to assign
|
# Here, Alice defines in a tuple that she wants to assign
|
||||||
# these 10 tokens to Bob.
|
# these 10 tokens to Bob.
|
||||||
prepared_token_tx = bdb.transactions.prepare(
|
prepared_token_tx = bdb.transactions.prepare(
|
||||||
operation='CREATE',
|
operation="CREATE", signers=alice.public_key, recipients=[([bob.public_key], 10)], assets=bike_token
|
||||||
signers=alice.public_key,
|
)
|
||||||
recipients=[([bob.public_key], 10)],
|
|
||||||
assets=bike_token)
|
|
||||||
|
|
||||||
# She fulfills and sends the transaction.
|
# She fulfills and sends the transaction.
|
||||||
fulfilled_token_tx = bdb.transactions.fulfill(
|
fulfilled_token_tx = bdb.transactions.fulfill(prepared_token_tx, private_keys=alice.private_key)
|
||||||
prepared_token_tx,
|
|
||||||
private_keys=alice.private_key)
|
|
||||||
|
|
||||||
bdb.transactions.send_commit(fulfilled_token_tx)
|
bdb.transactions.send_commit(fulfilled_token_tx)
|
||||||
|
|
||||||
# We store the `id` of the transaction to use it later on.
|
# We store the `id` of the transaction to use it later on.
|
||||||
bike_token_id = fulfilled_token_tx['id']
|
bike_token_id = fulfilled_token_tx["id"]
|
||||||
|
|
||||||
# Let's check if the transaction was successful.
|
# Let's check if the transaction was successful.
|
||||||
assert bdb.transactions.retrieve(bike_token_id), \
|
assert bdb.transactions.retrieve(bike_token_id), "Cannot find transaction {}".format(bike_token_id)
|
||||||
'Cannot find transaction {}'.format(bike_token_id)
|
|
||||||
|
|
||||||
# Bob owns 10 tokens now.
|
# Bob owns 10 tokens now.
|
||||||
assert bdb.transactions.retrieve(bike_token_id)['outputs'][0][
|
assert bdb.transactions.retrieve(bike_token_id)["outputs"][0]["amount"] == "10"
|
||||||
'amount'] == '10'
|
|
||||||
|
|
||||||
# ## Bob wants to use the bike
|
# ## Bob wants to use the bike
|
||||||
# Now that Bob got the tokens and the sun is shining, he wants to get out
|
# Now that Bob got the tokens and the sun is shining, he wants to get out
|
||||||
@ -94,49 +86,45 @@ def test_divisible_assets():
|
|||||||
# To use the bike he has to send the tokens back to Alice.
|
# To use the bike he has to send the tokens back to Alice.
|
||||||
# To learn about the details of transferring a transaction check out
|
# To learn about the details of transferring a transaction check out
|
||||||
# [test_basic.py](./test_basic.html)
|
# [test_basic.py](./test_basic.html)
|
||||||
transfer_assets = [{'id': bike_token_id}]
|
transfer_assets = [{"id": bike_token_id}]
|
||||||
|
|
||||||
output_index = 0
|
output_index = 0
|
||||||
output = fulfilled_token_tx['outputs'][output_index]
|
output = fulfilled_token_tx["outputs"][output_index]
|
||||||
transfer_input = {'fulfillment': output['condition']['details'],
|
transfer_input = {
|
||||||
'fulfills': {'output_index': output_index,
|
"fulfillment": output["condition"]["details"],
|
||||||
'transaction_id': fulfilled_token_tx[
|
"fulfills": {"output_index": output_index, "transaction_id": fulfilled_token_tx["id"]},
|
||||||
'id']},
|
"owners_before": output["public_keys"],
|
||||||
'owners_before': output['public_keys']}
|
}
|
||||||
|
|
||||||
# To use the tokens Bob has to reassign 7 tokens to himself and the
|
# To use the tokens Bob has to reassign 7 tokens to himself and the
|
||||||
# amount he wants to use to Alice.
|
# amount he wants to use to Alice.
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation="TRANSFER",
|
||||||
assets=transfer_assets,
|
asset=transfer_assets,
|
||||||
inputs=transfer_input,
|
inputs=transfer_input,
|
||||||
recipients=[([alice.public_key], 3), ([bob.public_key], 7)])
|
recipients=[([alice.public_key], 3), ([bob.public_key], 7)],
|
||||||
|
)
|
||||||
|
|
||||||
# He signs and sends the transaction.
|
# He signs and sends the transaction.
|
||||||
fulfilled_transfer_tx = bdb.transactions.fulfill(
|
fulfilled_transfer_tx = bdb.transactions.fulfill(prepared_transfer_tx, private_keys=bob.private_key)
|
||||||
prepared_transfer_tx,
|
|
||||||
private_keys=bob.private_key)
|
|
||||||
|
|
||||||
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
||||||
|
|
||||||
# First, Bob checks if the transaction was successful.
|
# First, Bob checks if the transaction was successful.
|
||||||
assert bdb.transactions.retrieve(
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"]) == sent_transfer_tx
|
||||||
fulfilled_transfer_tx['id']) == sent_transfer_tx
|
|
||||||
# There are two outputs in the transaction now.
|
# There are two outputs in the transaction now.
|
||||||
# The first output shows that Alice got back 3 tokens...
|
# The first output shows that Alice got back 3 tokens...
|
||||||
assert bdb.transactions.retrieve(
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"])["outputs"][0]["amount"] == "3"
|
||||||
fulfilled_transfer_tx['id'])['outputs'][0]['amount'] == '3'
|
|
||||||
|
|
||||||
# ... while Bob still has 7 left.
|
# ... while Bob still has 7 left.
|
||||||
assert bdb.transactions.retrieve(
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"])["outputs"][1]["amount"] == "7"
|
||||||
fulfilled_transfer_tx['id'])['outputs'][1]['amount'] == '7'
|
|
||||||
|
|
||||||
# ## Bob wants to ride the bike again
|
# ## Bob wants to ride the bike again
|
||||||
# It's been a week and Bob wants to right the bike again.
|
# It's been a week and Bob wants to right the bike again.
|
||||||
# Now he wants to ride for 8 hours, that's a lot Bob!
|
# Now he wants to ride for 8 hours, that's a lot Bob!
|
||||||
# He prepares the transaction again.
|
# He prepares the transaction again.
|
||||||
|
|
||||||
transfer_assets = [{'id': bike_token_id}]
|
transfer_asset = [{"id": bike_token_id}]
|
||||||
# This time we need an `output_index` of 1, since we have two outputs
|
# This time we need an `output_index` of 1, since we have two outputs
|
||||||
# in the `fulfilled_transfer_tx` we created before. The first output with
|
# in the `fulfilled_transfer_tx` we created before. The first output with
|
||||||
# index 0 is for Alice and the second output is for Bob.
|
# index 0 is for Alice and the second output is for Bob.
|
||||||
@ -144,24 +132,21 @@ def test_divisible_assets():
|
|||||||
# correct output with the correct amount of tokens.
|
# correct output with the correct amount of tokens.
|
||||||
output_index = 1
|
output_index = 1
|
||||||
|
|
||||||
output = fulfilled_transfer_tx['outputs'][output_index]
|
output = fulfilled_transfer_tx["outputs"][output_index]
|
||||||
|
|
||||||
transfer_input = {'fulfillment': output['condition']['details'],
|
transfer_input = {
|
||||||
'fulfills': {'output_index': output_index,
|
"fulfillment": output["condition"]["details"],
|
||||||
'transaction_id': fulfilled_transfer_tx['id']},
|
"fulfills": {"output_index": output_index, "transaction_id": fulfilled_transfer_tx["id"]},
|
||||||
'owners_before': output['public_keys']}
|
"owners_before": output["public_keys"],
|
||||||
|
}
|
||||||
|
|
||||||
# This time Bob only provides Alice in the `recipients` because he wants
|
# This time Bob only provides Alice in the `recipients` because he wants
|
||||||
# to spend all his tokens
|
# to spend all his tokens
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation="TRANSFER", assets=transfer_assets, inputs=transfer_input, recipients=[([alice.public_key], 8)]
|
||||||
assets=transfer_assets,
|
)
|
||||||
inputs=transfer_input,
|
|
||||||
recipients=[([alice.public_key], 8)])
|
|
||||||
|
|
||||||
fulfilled_transfer_tx = bdb.transactions.fulfill(
|
fulfilled_transfer_tx = bdb.transactions.fulfill(prepared_transfer_tx, private_keys=bob.private_key)
|
||||||
prepared_transfer_tx,
|
|
||||||
private_keys=bob.private_key)
|
|
||||||
|
|
||||||
# Oh Bob, what have you done?! You tried to spend more tokens than you had.
|
# Oh Bob, what have you done?! You tried to spend more tokens than you had.
|
||||||
# Remember Bob, last time you spent 3 tokens already,
|
# Remember Bob, last time you spent 3 tokens already,
|
||||||
@ -172,10 +157,12 @@ def test_divisible_assets():
|
|||||||
# Now Bob gets an error saying that the amount he wanted to spent is
|
# Now Bob gets an error saying that the amount he wanted to spent is
|
||||||
# higher than the amount of tokens he has left.
|
# higher than the amount of tokens he has left.
|
||||||
assert error.value.args[0] == 400
|
assert error.value.args[0] == 400
|
||||||
message = 'Invalid transaction (AmountError): The amount used in the ' \
|
message = (
|
||||||
'inputs `7` needs to be same as the amount used in the ' \
|
"Invalid transaction (AmountError): The amount used in the "
|
||||||
'outputs `8`'
|
"inputs `7` needs to be same as the amount used in the "
|
||||||
assert error.value.args[2]['message'] == message
|
"outputs `8`"
|
||||||
|
)
|
||||||
|
assert error.value.args[2]["message"] == message
|
||||||
|
|
||||||
# We have to stop this test now, I am sorry, but Bob is pretty upset
|
# We have to stop this test now, I am sorry, but Bob is pretty upset
|
||||||
# about his mistake. See you next time :)
|
# about his mistake. See you next time :)
|
||||||
|
|||||||
@ -14,35 +14,36 @@ import queue
|
|||||||
import planetmint_driver.exceptions
|
import planetmint_driver.exceptions
|
||||||
from planetmint_driver import Planetmint
|
from planetmint_driver import Planetmint
|
||||||
from planetmint_driver.crypto import generate_keypair
|
from planetmint_driver.crypto import generate_keypair
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
|
|
||||||
def test_double_create():
|
def test_double_create():
|
||||||
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
|
bdb = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
alice = generate_keypair()
|
alice = generate_keypair()
|
||||||
|
|
||||||
results = queue.Queue()
|
results = queue.Queue()
|
||||||
|
|
||||||
tx = bdb.transactions.fulfill(
|
tx = bdb.transactions.fulfill(
|
||||||
bdb.transactions.prepare(
|
bdb.transactions.prepare(
|
||||||
operation='CREATE',
|
operation="CREATE", signers=alice.public_key, assets=[{"data": multihash(marshal({"uuid": str(uuid4())}))}]
|
||||||
signers=alice.public_key,
|
),
|
||||||
assets=[{'data': {'uuid': str(uuid4())}}]),
|
private_keys=alice.private_key,
|
||||||
private_keys=alice.private_key)
|
)
|
||||||
|
|
||||||
def send_and_queue(tx):
|
def send_and_queue(tx):
|
||||||
try:
|
try:
|
||||||
bdb.transactions.send_commit(tx)
|
bdb.transactions.send_commit(tx)
|
||||||
results.put('OK')
|
results.put("OK")
|
||||||
except planetmint_driver.exceptions.TransportError as e:
|
except planetmint_driver.exceptions.TransportError as e:
|
||||||
results.put('FAIL')
|
results.put("FAIL")
|
||||||
|
|
||||||
t1 = Thread(target=send_and_queue, args=(tx, ))
|
t1 = Thread(target=send_and_queue, args=(tx,))
|
||||||
t2 = Thread(target=send_and_queue, args=(tx, ))
|
t2 = Thread(target=send_and_queue, args=(tx,))
|
||||||
|
|
||||||
t1.start()
|
t1.start()
|
||||||
t2.start()
|
t2.start()
|
||||||
|
|
||||||
results = [results.get(timeout=2), results.get(timeout=2)]
|
results = [results.get(timeout=2), results.get(timeout=2)]
|
||||||
|
|
||||||
assert results.count('OK') == 1
|
assert results.count("OK") == 1
|
||||||
assert results.count('FAIL') == 1
|
assert results.count("FAIL") == 1
|
||||||
|
|||||||
@ -15,9 +15,7 @@
|
|||||||
# We run a series of checks for each step, that is retrieving
|
# We run a series of checks for each step, that is retrieving
|
||||||
# the transaction from the remote system, and also checking the public keys
|
# the transaction from the remote system, and also checking the public keys
|
||||||
# of a given transaction.
|
# of a given transaction.
|
||||||
#
|
|
||||||
# This integration test is a rip-off of our
|
|
||||||
# [tutorial](https://docs.planetmint.com/projects/py-driver/en/latest/usage.html).
|
|
||||||
|
|
||||||
# ## Imports
|
# ## Imports
|
||||||
# We need some utils from the `os` package, we will interact with
|
# We need some utils from the `os` package, we will interact with
|
||||||
@ -27,13 +25,14 @@ import os
|
|||||||
# For this test case we import and use the Python Driver.
|
# For this test case we import and use the Python Driver.
|
||||||
from planetmint_driver import Planetmint
|
from planetmint_driver import Planetmint
|
||||||
from planetmint_driver.crypto import generate_keypair
|
from planetmint_driver.crypto import generate_keypair
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_owners():
|
def test_multiple_owners():
|
||||||
# ## Set up a connection to Planetmint
|
# ## Set up a connection to Planetmint
|
||||||
# Check [test_basic.py](./test_basic.html) to get some more details
|
# Check [test_basic.py](./test_basic.html) to get some more details
|
||||||
# about the endpoint.
|
# about the endpoint.
|
||||||
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
|
bdb = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
|
|
||||||
# Hey Alice and Bob, nice to see you again!
|
# Hey Alice and Bob, nice to see you again!
|
||||||
alice, bob = generate_keypair(), generate_keypair()
|
alice, bob = generate_keypair(), generate_keypair()
|
||||||
@ -43,40 +42,28 @@ def test_multiple_owners():
|
|||||||
# high rents anymore. Bob suggests to get a dish washer for the
|
# high rents anymore. Bob suggests to get a dish washer for the
|
||||||
# kitchen. Alice agrees and here they go, creating the asset for their
|
# kitchen. Alice agrees and here they go, creating the asset for their
|
||||||
# dish washer.
|
# dish washer.
|
||||||
dw_asset = {
|
dw_asset = {"data": multihash(marshal({"dish washer": {"serial_number": 1337}}))}
|
||||||
'data': {
|
|
||||||
'dish washer': {
|
|
||||||
'serial_number': 1337
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# They prepare a `CREATE` transaction. To have multiple owners, both
|
# They prepare a `CREATE` transaction. To have multiple owners, both
|
||||||
# Bob and Alice need to be the recipients.
|
# Bob and Alice need to be the recipients.
|
||||||
prepared_dw_tx = bdb.transactions.prepare(
|
prepared_dw_tx = bdb.transactions.prepare(
|
||||||
operation='CREATE',
|
operation="CREATE", signers=alice.public_key, recipients=(alice.public_key, bob.public_key), assets=[dw_asset]
|
||||||
signers=alice.public_key,
|
)
|
||||||
recipients=(alice.public_key, bob.public_key),
|
|
||||||
assets=[dw_asset])
|
|
||||||
|
|
||||||
# Now they both sign the transaction by providing their private keys.
|
# Now they both sign the transaction by providing their private keys.
|
||||||
# And send it afterwards.
|
# And send it afterwards.
|
||||||
fulfilled_dw_tx = bdb.transactions.fulfill(
|
fulfilled_dw_tx = bdb.transactions.fulfill(prepared_dw_tx, private_keys=[alice.private_key, bob.private_key])
|
||||||
prepared_dw_tx,
|
|
||||||
private_keys=[alice.private_key, bob.private_key])
|
|
||||||
|
|
||||||
bdb.transactions.send_commit(fulfilled_dw_tx)
|
bdb.transactions.send_commit(fulfilled_dw_tx)
|
||||||
|
|
||||||
# We store the `id` of the transaction to use it later on.
|
# We store the `id` of the transaction to use it later on.
|
||||||
dw_id = fulfilled_dw_tx['id']
|
dw_id = fulfilled_dw_tx["id"]
|
||||||
|
|
||||||
# Let's check if the transaction was successful.
|
# Let's check if the transaction was successful.
|
||||||
assert bdb.transactions.retrieve(dw_id), \
|
assert bdb.transactions.retrieve(dw_id), "Cannot find transaction {}".format(dw_id)
|
||||||
'Cannot find transaction {}'.format(dw_id)
|
|
||||||
|
|
||||||
# The transaction should have two public keys in the outputs.
|
# The transaction should have two public keys in the outputs.
|
||||||
assert len(
|
assert len(bdb.transactions.retrieve(dw_id)["outputs"][0]["public_keys"]) == 2
|
||||||
bdb.transactions.retrieve(dw_id)['outputs'][0]['public_keys']) == 2
|
|
||||||
|
|
||||||
# ## Alice and Bob transfer a transaction to Carol.
|
# ## Alice and Bob transfer a transaction to Carol.
|
||||||
# Alice and Bob save a lot of money living together. They often go out
|
# Alice and Bob save a lot of money living together. They often go out
|
||||||
@ -88,39 +75,33 @@ def test_multiple_owners():
|
|||||||
|
|
||||||
# Alice and Bob prepare the transaction to transfer the dish washer to
|
# Alice and Bob prepare the transaction to transfer the dish washer to
|
||||||
# Carol.
|
# Carol.
|
||||||
transfer_assets = [{'id': dw_id}]
|
transfer_assets = [{"id": dw_id}]
|
||||||
|
|
||||||
output_index = 0
|
output_index = 0
|
||||||
output = fulfilled_dw_tx['outputs'][output_index]
|
output = fulfilled_dw_tx["outputs"][output_index]
|
||||||
transfer_input = {'fulfillment': output['condition']['details'],
|
transfer_input = {
|
||||||
'fulfills': {'output_index': output_index,
|
"fulfillment": output["condition"]["details"],
|
||||||
'transaction_id': fulfilled_dw_tx[
|
"fulfills": {"output_index": output_index, "transaction_id": fulfilled_dw_tx["id"]},
|
||||||
'id']},
|
"owners_before": output["public_keys"],
|
||||||
'owners_before': output['public_keys']}
|
}
|
||||||
|
|
||||||
# Now they create the transaction...
|
# Now they create the transaction...
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation="TRANSFER", assets=transfer_assets, inputs=transfer_input, recipients=carol.public_key
|
||||||
assets=transfer_assets,
|
)
|
||||||
inputs=transfer_input,
|
|
||||||
recipients=carol.public_key)
|
|
||||||
|
|
||||||
# ... and sign it with their private keys, then send it.
|
# ... and sign it with their private keys, then send it.
|
||||||
fulfilled_transfer_tx = bdb.transactions.fulfill(
|
fulfilled_transfer_tx = bdb.transactions.fulfill(
|
||||||
prepared_transfer_tx,
|
prepared_transfer_tx, private_keys=[alice.private_key, bob.private_key]
|
||||||
private_keys=[alice.private_key, bob.private_key])
|
)
|
||||||
|
|
||||||
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
|
||||||
|
|
||||||
# They check if the transaction was successful.
|
# They check if the transaction was successful.
|
||||||
assert bdb.transactions.retrieve(
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"]) == sent_transfer_tx
|
||||||
fulfilled_transfer_tx['id']) == sent_transfer_tx
|
|
||||||
|
|
||||||
# The owners before should include both Alice and Bob.
|
# The owners before should include both Alice and Bob.
|
||||||
assert len(
|
assert len(bdb.transactions.retrieve(fulfilled_transfer_tx["id"])["inputs"][0]["owners_before"]) == 2
|
||||||
bdb.transactions.retrieve(fulfilled_transfer_tx['id'])['inputs'][0][
|
|
||||||
'owners_before']) == 2
|
|
||||||
|
|
||||||
# While the new owner is Carol.
|
# While the new owner is Carol.
|
||||||
assert bdb.transactions.retrieve(fulfilled_transfer_tx['id'])[
|
assert bdb.transactions.retrieve(fulfilled_transfer_tx["id"])["outputs"][0]["public_keys"][0] == carol.public_key
|
||||||
'outputs'][0]['public_keys'][0] == carol.public_key
|
|
||||||
|
|||||||
@ -16,6 +16,8 @@ import os
|
|||||||
# Since the naughty strings get encoded and decoded in odd ways,
|
# Since the naughty strings get encoded and decoded in odd ways,
|
||||||
# we'll use a regex to sweep those details under the rug.
|
# we'll use a regex to sweep those details under the rug.
|
||||||
import re
|
import re
|
||||||
|
from tkinter import N
|
||||||
|
from unittest import skip
|
||||||
|
|
||||||
# We'll use a nice library of naughty strings...
|
# We'll use a nice library of naughty strings...
|
||||||
from blns import blns
|
from blns import blns
|
||||||
@ -27,31 +29,61 @@ import pytest
|
|||||||
from planetmint_driver import Planetmint
|
from planetmint_driver import Planetmint
|
||||||
from planetmint_driver.crypto import generate_keypair
|
from planetmint_driver.crypto import generate_keypair
|
||||||
from planetmint_driver.exceptions import BadRequest
|
from planetmint_driver.exceptions import BadRequest
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
naughty_strings = blns.all()
|
naughty_strings = blns.all()
|
||||||
|
skipped_naughty_strings = [
|
||||||
|
"1.00",
|
||||||
|
"$1.00",
|
||||||
|
"-1.00",
|
||||||
|
"-$1.00",
|
||||||
|
"0.00",
|
||||||
|
"0..0",
|
||||||
|
".",
|
||||||
|
"0.0.0",
|
||||||
|
"-.",
|
||||||
|
",./;'[]\\-=",
|
||||||
|
"ثم نفس سقطت وبالتحديد،, جزيرتي باستخدام أن دنو. إذ هنا؟ الستار وتنصيب كان. أهّل ايطاليا، بريطانيا-فرنسا قد أخذ. سليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو.",
|
||||||
|
"test\x00",
|
||||||
|
"Ṱ̺̺̕o͞ ̷i̲̬͇̪͙n̝̗͕v̟̜̘̦͟o̶̙̰̠kè͚̮̺̪̹̱̤ ̖t̝͕̳̣̻̪͞h̼͓̲̦̳̘̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳ ̞̥̱̳̭r̛̗̘e͙p͠r̼̞̻̭̗e̺̠̣͟s̘͇̳͍̝͉e͉̥̯̞̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ͏͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣",
|
||||||
|
"̡͓̞ͅI̗̘̦͝n͇͇͙v̮̫ok̲̫̙͈i̖͙̭̹̠̞n̡̻̮̣̺g̲͈͙̭͙̬͎ ̰t͔̦h̞̲e̢̤ ͍̬̲͖f̴̘͕̣è͖ẹ̥̩l͖͔͚i͓͚̦͠n͖͍̗͓̳̮g͍ ̨o͚̪͡f̘̣̬ ̖̘͖̟͙̮c҉͔̫͖͓͇͖ͅh̵̤̣͚͔á̗̼͕ͅo̼̣̥s̱͈̺̖̦̻͢.̛̖̞̠̫̰",
|
||||||
|
"̗̺͖̹̯͓Ṯ̤͍̥͇͈h̲́e͏͓̼̗̙̼̣͔ ͇̜̱̠͓͍ͅN͕͠e̗̱z̘̝̜̺͙p̤̺̹͍̯͚e̠̻̠͜r̨̤͍̺̖͔̖̖d̠̟̭̬̝͟i̦͖̩͓͔̤a̠̗̬͉̙n͚͜ ̻̞̰͚ͅh̵͉i̳̞v̢͇ḙ͎͟-҉̭̩̼͔m̤̭̫i͕͇̝̦n̗͙ḍ̟ ̯̲͕͞ǫ̟̯̰̲͙̻̝f ̪̰̰̗̖̭̘͘c̦͍̲̞͍̩̙ḥ͚a̮͎̟̙͜ơ̩̹͎s̤.̝̝ ҉Z̡̖̜͖̰̣͉̜a͖̰͙̬͡l̲̫̳͍̩g̡̟̼̱͚̞̬ͅo̗͜.̟",
|
||||||
|
"̦H̬̤̗̤͝e͜ ̜̥̝̻͍̟́w̕h̖̯͓o̝͙̖͎̱̮ ҉̺̙̞̟͈W̷̼̭a̺̪͍į͈͕̭͙̯̜t̶̼̮s̘͙͖̕ ̠̫̠B̻͍͙͉̳ͅe̵h̵̬͇̫͙i̹͓̳̳̮͎̫̕n͟d̴̪̜̖ ̰͉̩͇͙̲͞ͅT͖̼͓̪͢h͏͓̮̻e̬̝̟ͅ ̤̹̝W͙̞̝͔͇͝ͅa͏͓͔̹̼̣l̴͔̰̤̟͔ḽ̫.͕",
|
||||||
|
'"><script>alert(document.title)</script>',
|
||||||
|
"'><script>alert(document.title)</script>",
|
||||||
|
"><script>alert(document.title)</script>",
|
||||||
|
"</script><script>alert(document.title)</script>",
|
||||||
|
"< / script >< script >alert(document.title)< / script >",
|
||||||
|
" onfocus=alert(document.title) autofocus ",
|
||||||
|
'" onfocus=alert(document.title) autofocus ',
|
||||||
|
"' onfocus=alert(document.title) autofocus ",
|
||||||
|
"<script>alert(document.title)</script>",
|
||||||
|
"/dev/null; touch /tmp/blns.fail ; echo",
|
||||||
|
"../../../../../../../../../../../etc/passwd%00",
|
||||||
|
"../../../../../../../../../../../etc/hosts",
|
||||||
|
"() { 0; }; touch /tmp/blns.shellshock1.fail;",
|
||||||
|
"() { _; } >_[$($())] { touch /tmp/blns.shellshock2.fail; }",
|
||||||
|
]
|
||||||
|
|
||||||
|
naughty_strings = [naughty for naughty in naughty_strings if naughty not in skipped_naughty_strings]
|
||||||
|
|
||||||
# This is our base test case, but we'll reuse it to send naughty strings as both keys and values.
|
# This is our base test case, but we'll reuse it to send naughty strings as both keys and values.
|
||||||
def send_naughty_tx(assets, metadata):
|
def send_naughty_tx(assets, metadata):
|
||||||
# ## Set up a connection to Planetmint
|
# ## Set up a connection to Planetmint
|
||||||
# Check [test_basic.py](./test_basic.html) to get some more details
|
# Check [test_basic.py](./test_basic.html) to get some more details
|
||||||
# about the endpoint.
|
# about the endpoint.
|
||||||
bdb = Planetmint(os.environ.get('PLANETMINT_ENDPOINT'))
|
bdb = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
|
|
||||||
# Here's Alice.
|
# Here's Alice.
|
||||||
alice = generate_keypair()
|
alice = generate_keypair()
|
||||||
|
|
||||||
# Alice is in a naughty mood today, so she creates a tx with some naughty strings
|
# Alice is in a naughty mood today, so she creates a tx with some naughty strings
|
||||||
prepared_transaction = bdb.transactions.prepare(
|
prepared_transaction = bdb.transactions.prepare(
|
||||||
operation='CREATE',
|
operation="CREATE", signers=alice.public_key, assets=assets, metadata=metadata
|
||||||
signers=alice.public_key,
|
)
|
||||||
assets=assets,
|
|
||||||
metadata=metadata)
|
|
||||||
|
|
||||||
# She fulfills the transaction
|
# She fulfills the transaction
|
||||||
fulfilled_transaction = bdb.transactions.fulfill(
|
fulfilled_transaction = bdb.transactions.fulfill(prepared_transaction, private_keys=alice.private_key)
|
||||||
prepared_transaction,
|
|
||||||
private_keys=alice.private_key)
|
|
||||||
|
|
||||||
# The fulfilled tx gets sent to the BDB network
|
# The fulfilled tx gets sent to the BDB network
|
||||||
try:
|
try:
|
||||||
@ -60,23 +92,24 @@ def send_naughty_tx(assets, metadata):
|
|||||||
sent_transaction = e
|
sent_transaction = e
|
||||||
|
|
||||||
# If her key contained a '.', began with a '$', or contained a NUL character
|
# If her key contained a '.', began with a '$', or contained a NUL character
|
||||||
regex = '.*\..*|\$.*|.*\x00.*'
|
regex = ".*\..*|\$.*|.*\x00.*"
|
||||||
key = next(iter(metadata))
|
key = next(iter(metadata))
|
||||||
if re.match(regex, key):
|
if re.match(regex, key):
|
||||||
# Then she expects a nicely formatted error code
|
# Then she expects a nicely formatted error code
|
||||||
status_code = sent_transaction.status_code
|
status_code = sent_transaction.status_code
|
||||||
error = sent_transaction.error
|
error = sent_transaction.error
|
||||||
regex = (
|
regex = (
|
||||||
r'\{\s*\n*'
|
r"\{\s*\n*"
|
||||||
r'\s*"message":\s*"Invalid transaction \(ValidationError\):\s*'
|
r'\s*"message":\s*"Invalid transaction \(ValidationError\):\s*'
|
||||||
r'Invalid key name.*The key name cannot contain characters.*\n*'
|
r"Invalid key name.*The key name cannot contain characters.*\n*"
|
||||||
r'\s*"status":\s*400\n*'
|
r'\s*"status":\s*400\n*'
|
||||||
r'\s*\}\n*')
|
r"\s*\}\n*"
|
||||||
|
)
|
||||||
assert status_code == 400
|
assert status_code == 400
|
||||||
assert re.fullmatch(regex, error), sent_transaction
|
assert re.fullmatch(regex, error), sent_transaction
|
||||||
# Otherwise, she expects to see her transaction in the database
|
# Otherwise, she expects to see her transaction in the database
|
||||||
elif 'id' in sent_transaction.keys():
|
elif "id" in sent_transaction.keys():
|
||||||
tx_id = sent_transaction['id']
|
tx_id = sent_transaction["id"]
|
||||||
assert bdb.transactions.retrieve(tx_id)
|
assert bdb.transactions.retrieve(tx_id)
|
||||||
# If neither condition was true, then something weird happened...
|
# If neither condition was true, then something weird happened...
|
||||||
else:
|
else:
|
||||||
@ -86,8 +119,8 @@ def send_naughty_tx(assets, metadata):
|
|||||||
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
|
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
|
||||||
def test_naughty_keys(naughty_string):
|
def test_naughty_keys(naughty_string):
|
||||||
|
|
||||||
assets = [{'data': {naughty_string: 'nice_value'}}]
|
assets = [{"data": multihash(marshal({naughty_string: "nice_value"}))}]
|
||||||
metadata = {naughty_string: 'nice_value'}
|
metadata = multihash(marshal({naughty_string: "nice_value"}))
|
||||||
|
|
||||||
send_naughty_tx(assets, metadata)
|
send_naughty_tx(assets, metadata)
|
||||||
|
|
||||||
@ -95,7 +128,7 @@ def test_naughty_keys(naughty_string):
|
|||||||
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
|
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
|
||||||
def test_naughty_values(naughty_string):
|
def test_naughty_values(naughty_string):
|
||||||
|
|
||||||
assets = [{'data': {'nice_key': naughty_string}}]
|
assets = [{"data": multihash(marshal({"nice_key": naughty_string}))}]
|
||||||
metadata = {'nice_key': naughty_string}
|
metadata = multihash(marshal({"nice_key": naughty_string}))
|
||||||
|
|
||||||
send_naughty_tx(assets, metadata)
|
send_naughty_tx(assets, metadata)
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import queue
|
|||||||
import json
|
import json
|
||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
# For this script, we need to set up a websocket connection, that's the reason
|
# For this script, we need to set up a websocket connection, that's the reason
|
||||||
# we import the
|
# we import the
|
||||||
@ -35,10 +36,10 @@ def test_stream():
|
|||||||
# ## Set up the test
|
# ## Set up the test
|
||||||
# We use the env variable `BICHAINDB_ENDPOINT` to know where to connect.
|
# We use the env variable `BICHAINDB_ENDPOINT` to know where to connect.
|
||||||
# Check [test_basic.py](./test_basic.html) for more information.
|
# Check [test_basic.py](./test_basic.html) for more information.
|
||||||
BDB_ENDPOINT = os.environ.get('PLANETMINT_ENDPOINT')
|
BDB_ENDPOINT = os.environ.get("PLANETMINT_ENDPOINT")
|
||||||
|
|
||||||
# *That's pretty bad, but let's do like this for now.*
|
# *That's pretty bad, but let's do like this for now.*
|
||||||
WS_ENDPOINT = 'ws://{}:9985/api/v1/streams/valid_transactions'.format(BDB_ENDPOINT.rsplit(':')[0])
|
WS_ENDPOINT = "ws://{}:9985/api/v1/streams/valid_transactions".format(BDB_ENDPOINT.rsplit(":")[0])
|
||||||
|
|
||||||
bdb = Planetmint(BDB_ENDPOINT)
|
bdb = Planetmint(BDB_ENDPOINT)
|
||||||
|
|
||||||
@ -91,10 +92,12 @@ def test_stream():
|
|||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
tx = bdb.transactions.fulfill(
|
tx = bdb.transactions.fulfill(
|
||||||
bdb.transactions.prepare(
|
bdb.transactions.prepare(
|
||||||
operation='CREATE',
|
operation="CREATE",
|
||||||
signers=alice.public_key,
|
signers=alice.public_key,
|
||||||
assets=[{'data': {'uuid': str(uuid4())}}]),
|
assets=[{"data": multihash(marshal({"uuid": str(uuid4())}))}],
|
||||||
private_keys=alice.private_key)
|
),
|
||||||
|
private_keys=alice.private_key,
|
||||||
|
)
|
||||||
# We don't want to wait for each transaction to be in a block. By using
|
# We don't want to wait for each transaction to be in a block. By using
|
||||||
# `async` mode, we make sure that the driver returns as soon as the
|
# `async` mode, we make sure that the driver returns as soon as the
|
||||||
# transaction is pushed to the Planetmint API. Remember: we expect all
|
# transaction is pushed to the Planetmint API. Remember: we expect all
|
||||||
@ -104,7 +107,7 @@ def test_stream():
|
|||||||
bdb.transactions.send_async(tx)
|
bdb.transactions.send_async(tx)
|
||||||
|
|
||||||
# The `id` of every sent transaction is then stored in a list.
|
# The `id` of every sent transaction is then stored in a list.
|
||||||
sent.append(tx['id'])
|
sent.append(tx["id"])
|
||||||
|
|
||||||
# ## Check the valid transactions coming from Planetmint
|
# ## Check the valid transactions coming from Planetmint
|
||||||
# Now we are ready to check if Planetmint did its job. A simple way to
|
# Now we are ready to check if Planetmint did its job. A simple way to
|
||||||
@ -118,9 +121,9 @@ def test_stream():
|
|||||||
# the timeout, then game over ¯\\\_(ツ)\_/¯
|
# the timeout, then game over ¯\\\_(ツ)\_/¯
|
||||||
try:
|
try:
|
||||||
event = received.get(timeout=5)
|
event = received.get(timeout=5)
|
||||||
txid = json.loads(event)['transaction_id']
|
txid = json.loads(event)["transaction_id"]
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
assert False, 'Did not receive all expected transactions'
|
assert False, "Did not receive all expected transactions"
|
||||||
|
|
||||||
# Last thing is to try to remove the `txid` from the set of sent
|
# Last thing is to try to remove the `txid` from the set of sent
|
||||||
# transactions. If this test is running in parallel with others, we
|
# transactions. If this test is running in parallel with others, we
|
||||||
|
|||||||
@ -1,83 +1,133 @@
|
|||||||
# GOAL:
|
import os
|
||||||
# In this script I tried to implement the ECDSA signature using zenroom
|
|
||||||
|
|
||||||
# However, the scripts are customizable and so with the same procedure
|
|
||||||
# we can implement more complex smart contracts
|
|
||||||
|
|
||||||
# PUBLIC IDENTITY
|
|
||||||
# The public identity of the users in this script (Bob and Alice)
|
|
||||||
# is the pair (ECDH public key, Testnet address)
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import base58
|
||||||
|
from hashlib import sha3_256
|
||||||
|
from cryptoconditions.types.ed25519 import Ed25519Sha256
|
||||||
|
from cryptoconditions.types.zenroom import ZenroomSha256
|
||||||
|
from zenroom import zencode_exec
|
||||||
|
from planetmint_driver import Planetmint
|
||||||
|
from planetmint_driver.crypto import generate_keypair
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
import hashlib
|
|
||||||
from cryptoconditions import ZenroomSha256
|
|
||||||
from json.decoder import JSONDecodeError
|
|
||||||
|
|
||||||
def test_zenroom(gen_key_zencode, secret_key_to_private_key_zencode, fulfill_script_zencode,
|
def test_zenroom_signing(
|
||||||
condition_script_zencode, zenroom_data, zenroom_house_assets):
|
gen_key_zencode,
|
||||||
alice = json.loads(ZenroomSha256.run_zenroom(gen_key_zencode).output)['keys']
|
secret_key_to_private_key_zencode,
|
||||||
bob = json.loads(ZenroomSha256.run_zenroom(gen_key_zencode).output)['keys']
|
fulfill_script_zencode,
|
||||||
|
zenroom_data,
|
||||||
|
zenroom_house_assets,
|
||||||
|
zenroom_script_input,
|
||||||
|
condition_script_zencode,
|
||||||
|
):
|
||||||
|
|
||||||
zen_public_keys = json.loads(ZenroomSha256.run_zenroom(secret_key_to_private_key_zencode.format('Alice'),
|
biolabs = generate_keypair()
|
||||||
keys={'keys': alice}).output)
|
version = "2.0"
|
||||||
zen_public_keys.update(json.loads(ZenroomSha256.run_zenroom(secret_key_to_private_key_zencode.format('Bob'),
|
|
||||||
keys={'keys': bob}).output))
|
|
||||||
|
|
||||||
# CRYPTO-CONDITIONS: instantiate an Ed25519 crypto-condition for buyer
|
alice = json.loads(zencode_exec(gen_key_zencode).output)["keyring"]
|
||||||
zenSha = ZenroomSha256(script=fulfill_script_zencode, keys=zen_public_keys, data=zenroom_data)
|
bob = json.loads(zencode_exec(gen_key_zencode).output)["keyring"]
|
||||||
|
|
||||||
|
zen_public_keys = json.loads(
|
||||||
|
zencode_exec(secret_key_to_private_key_zencode.format("Alice"), keys=json.dumps({"keyring": alice})).output
|
||||||
|
)
|
||||||
|
zen_public_keys.update(
|
||||||
|
json.loads(
|
||||||
|
zencode_exec(secret_key_to_private_key_zencode.format("Bob"), keys=json.dumps({"keyring": bob})).output
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
zenroomscpt = ZenroomSha256(script=fulfill_script_zencode, data=zenroom_data, keys=zen_public_keys)
|
||||||
|
print(f"zenroom is: {zenroomscpt.script}")
|
||||||
|
|
||||||
# CRYPTO-CONDITIONS: generate the condition uri
|
# CRYPTO-CONDITIONS: generate the condition uri
|
||||||
condition_uri = zenSha.condition.serialize_uri()
|
condition_uri_zen = zenroomscpt.condition.serialize_uri()
|
||||||
|
print(f"\nzenroom condition URI: {condition_uri_zen}")
|
||||||
|
|
||||||
# CRYPTO-CONDITIONS: construct an unsigned fulfillment dictionary
|
# CRYPTO-CONDITIONS: construct an unsigned fulfillment dictionary
|
||||||
unsigned_fulfillment_dict = {
|
unsigned_fulfillment_dict_zen = {
|
||||||
'type': zenSha.TYPE_NAME,
|
"type": zenroomscpt.TYPE_NAME,
|
||||||
'script': fulfill_script_zencode,
|
"public_key": base58.b58encode(biolabs.public_key).decode(),
|
||||||
'keys': zen_public_keys,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output = {
|
output = {
|
||||||
'amount': '1000',
|
"amount": "10",
|
||||||
'condition': {
|
"condition": {
|
||||||
'details': unsigned_fulfillment_dict,
|
"details": unsigned_fulfillment_dict_zen,
|
||||||
'uri': condition_uri,
|
"uri": condition_uri_zen,
|
||||||
},
|
},
|
||||||
'data': zenroom_data,
|
"public_keys": [
|
||||||
'script': fulfill_script_zencode,
|
biolabs.public_key,
|
||||||
'conf': '',
|
],
|
||||||
'public_keys': (zen_public_keys['Alice']['ecdh_public_key'], ),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input_ = {
|
input_ = {
|
||||||
'fulfillment': None,
|
"fulfillment": None,
|
||||||
'fulfills': None,
|
"fulfills": None,
|
||||||
'owners_before': (zen_public_keys['Alice']['ecdh_public_key'], ),
|
"owners_before": [
|
||||||
|
biolabs.public_key,
|
||||||
|
],
|
||||||
|
}
|
||||||
|
metadata = {"result": {"output": ["ok"]}}
|
||||||
|
|
||||||
|
script_ = {
|
||||||
|
"code": {"type": "zenroom", "raw": "test_string", "parameters": [{"obj": "1"}, {"obj": "2"}]}, # obsolete
|
||||||
|
"state": "dd8bbd234f9869cab4cc0b84aa660e9b5ef0664559b8375804ee8dce75b10576", #
|
||||||
|
"input": zenroom_script_input,
|
||||||
|
"output": ["ok"],
|
||||||
|
"policies": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
token_creation_tx = {
|
token_creation_tx = {
|
||||||
'operation': 'CREATE',
|
"operation": "CREATE",
|
||||||
'assets': zenroom_house_assets,
|
"assets": [{"data": multihash(marshal({"test": "my asset"}))}],
|
||||||
'metadata': None,
|
"metadata": multihash(marshal(metadata)),
|
||||||
'outputs': (output,),
|
"script": script_,
|
||||||
'inputs': (input_,),
|
"outputs": [
|
||||||
'version': '2.0',
|
output,
|
||||||
'id': None,
|
],
|
||||||
|
"inputs": [
|
||||||
|
input_,
|
||||||
|
],
|
||||||
|
"version": version,
|
||||||
|
"id": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
# JSON: serialize the transaction-without-id to a json formatted string
|
# JSON: serialize the transaction-without-id to a json formatted string
|
||||||
message = json.dumps(
|
tx = json.dumps(
|
||||||
token_creation_tx,
|
token_creation_tx,
|
||||||
sort_keys=True,
|
sort_keys=True,
|
||||||
separators=(',', ':'),
|
separators=(",", ":"),
|
||||||
ensure_ascii=False,
|
ensure_ascii=False,
|
||||||
)
|
)
|
||||||
|
script_ = json.dumps(script_)
|
||||||
|
# major workflow:
|
||||||
|
# we store the fulfill script in the transaction/message (zenroom-sha)
|
||||||
|
# the condition script is used to fulfill the transaction and create the signature
|
||||||
|
#
|
||||||
|
# the server should ick the fulfill script and recreate the zenroom-sha and verify the signature
|
||||||
|
|
||||||
try:
|
signed_input = zenroomscpt.sign(script_, condition_script_zencode, alice)
|
||||||
assert(not zenSha.validate(message=message))
|
|
||||||
except: # noqa
|
|
||||||
pass
|
|
||||||
|
|
||||||
message = zenSha.sign(message, condition_script_zencode, alice)
|
input_signed = json.loads(signed_input)
|
||||||
assert(zenSha.validate(message=message))
|
input_signed["input"]["signature"] = input_signed["output"]["signature"]
|
||||||
|
del input_signed["output"]["signature"]
|
||||||
|
del input_signed["output"]["logs"]
|
||||||
|
input_signed["output"] = ["ok"] # define expected output that is to be compared
|
||||||
|
input_msg = json.dumps(input_signed)
|
||||||
|
|
||||||
|
assert zenroomscpt.validate(message=input_msg)
|
||||||
|
|
||||||
|
tx = json.loads(tx)
|
||||||
|
fulfillment_uri_zen = zenroomscpt.serialize_uri()
|
||||||
|
|
||||||
|
tx["inputs"][0]["fulfillment"] = fulfillment_uri_zen
|
||||||
|
tx["script"] = input_signed
|
||||||
|
tx["id"] = None
|
||||||
|
json_str_tx = json.dumps(tx, sort_keys=True, skipkeys=False, separators=(",", ":"))
|
||||||
|
# SHA3: hash the serialized id-less transaction to generate the id
|
||||||
|
shared_creation_txid = sha3_256(json_str_tx.encode()).hexdigest()
|
||||||
|
tx["id"] = shared_creation_txid
|
||||||
|
# tx = json.dumps(tx)
|
||||||
|
# `https://example.com:9984`
|
||||||
|
print(f"TX \n{tx}")
|
||||||
|
plntmnt = Planetmint(os.environ.get("PLANETMINT_ENDPOINT"))
|
||||||
|
sent_transfer_tx = plntmnt.transactions.send_commit(tx)
|
||||||
|
|
||||||
|
print(f"\n\nstatus and result : + {sent_transfer_tx}")
|
||||||
|
|||||||
@ -14,10 +14,22 @@ services:
|
|||||||
- "27017:27017"
|
- "27017:27017"
|
||||||
command: mongod
|
command: mongod
|
||||||
restart: always
|
restart: always
|
||||||
|
tarantool:
|
||||||
|
image: tarantool/tarantool:2.8.3
|
||||||
|
ports:
|
||||||
|
- "5200:5200"
|
||||||
|
- "3301:3301"
|
||||||
|
- "3303:3303"
|
||||||
|
- "8081:8081"
|
||||||
|
volumes:
|
||||||
|
- ./planetmint/backend/tarantool/basic.lua:/opt/tarantool/basic.lua
|
||||||
|
command: tarantool /opt/tarantool/basic.lua
|
||||||
|
restart: always
|
||||||
planetmint:
|
planetmint:
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongodb
|
#- mongodb
|
||||||
- tendermint
|
- tendermint
|
||||||
|
- tarantool
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile-dev
|
dockerfile: Dockerfile-dev
|
||||||
@ -31,9 +43,9 @@ services:
|
|||||||
- ./pytest.ini:/usr/src/app/pytest.ini
|
- ./pytest.ini:/usr/src/app/pytest.ini
|
||||||
- ./tox.ini:/usr/src/app/tox.ini
|
- ./tox.ini:/usr/src/app/tox.ini
|
||||||
environment:
|
environment:
|
||||||
PLANETMINT_DATABASE_BACKEND: localmongodb
|
PLANETMINT_DATABASE_BACKEND: tarantool_db
|
||||||
PLANETMINT_DATABASE_HOST: mongodb
|
PLANETMINT_DATABASE_HOST: tarantool
|
||||||
PLANETMINT_DATABASE_PORT: 27017
|
PLANETMINT_DATABASE_PORT: 3303
|
||||||
PLANETMINT_SERVER_BIND: 0.0.0.0:9984
|
PLANETMINT_SERVER_BIND: 0.0.0.0:9984
|
||||||
PLANETMINT_WSSERVER_HOST: 0.0.0.0
|
PLANETMINT_WSSERVER_HOST: 0.0.0.0
|
||||||
PLANETMINT_WSSERVER_ADVERTISED_HOST: planetmint
|
PLANETMINT_WSSERVER_ADVERTISED_HOST: planetmint
|
||||||
@ -43,13 +55,15 @@ services:
|
|||||||
- "9984:9984"
|
- "9984:9984"
|
||||||
- "9985:9985"
|
- "9985:9985"
|
||||||
- "26658"
|
- "26658"
|
||||||
|
- "2222:2222"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "bash", "-c", "curl http://planetmint:9984 && curl http://tendermint:26657/abci_query"]
|
test: ["CMD", "bash", "-c", "curl http://planetmint:9984 && curl http://tendermint:26657/abci_query"]
|
||||||
interval: 3s
|
interval: 3s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 5
|
||||||
command: '.ci/entrypoint.sh'
|
command: 'scripts/entrypoint.sh'
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
tendermint:
|
tendermint:
|
||||||
image: tendermint/tendermint:v0.34.15
|
image: tendermint/tendermint:v0.34.15
|
||||||
# volumes:
|
# volumes:
|
||||||
@ -60,6 +74,7 @@ services:
|
|||||||
- "26657:26657"
|
- "26657:26657"
|
||||||
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --rpc.laddr=tcp://0.0.0.0:26657 --proxy_app=tcp://planetmint:26658"
|
command: sh -c "tendermint init && tendermint node --consensus.create_empty_blocks=false --rpc.laddr=tcp://0.0.0.0:26657 --proxy_app=tcp://planetmint:26658"
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
bdb:
|
bdb:
|
||||||
image: busybox
|
image: busybox
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -93,7 +108,7 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile-dev
|
dockerfile: Dockerfile-dev
|
||||||
args:
|
args:
|
||||||
backend: localmongodb
|
backend: tarantool
|
||||||
volumes:
|
volumes:
|
||||||
- .:/usr/src/app/
|
- .:/usr/src/app/
|
||||||
command: make -C docs/root html
|
command: make -C docs/root html
|
||||||
@ -104,16 +119,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./docs/root/build/html:/usr/share/nginx/html
|
- ./docs/root/build/html:/usr/share/nginx/html
|
||||||
|
|
||||||
# Lints project according to PEP8
|
|
||||||
lint:
|
|
||||||
image: alpine/flake8
|
|
||||||
command: --max-line-length 119 /planetmint /acceptance /integration /tests
|
|
||||||
volumes:
|
|
||||||
- ./planetmint:/planetmint
|
|
||||||
- ./acceptance:/acceptance
|
|
||||||
- ./integration:/integration
|
|
||||||
- ./tests:/tests
|
|
||||||
|
|
||||||
# Remove all build, test, coverage and Python artifacts
|
# Remove all build, test, coverage and Python artifacts
|
||||||
clean:
|
clean:
|
||||||
image: alpine
|
image: alpine
|
||||||
|
|||||||
3
docs/root/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"makefile.extensionOutputFolder": "./.vscode"
|
||||||
|
}
|
||||||
@ -9,39 +9,48 @@ import json
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from planetmint.transactions.common.input import Input
|
from transactions.common.input import Input
|
||||||
from planetmint.transactions.common.transaction_link import TransactionLink
|
from transactions.common.transaction_link import TransactionLink
|
||||||
from planetmint import lib
|
from planetmint import lib
|
||||||
from planetmint.transactions.types.assets.create import Create
|
from transactions.types.assets.create import Create
|
||||||
from planetmint.transactions.types.assets.transfer import Transfer
|
from transactions.types.assets.transfer import Transfer
|
||||||
from planetmint.web import server
|
from planetmint.web import server
|
||||||
|
from ipld import multihash, marshal
|
||||||
|
|
||||||
|
|
||||||
TPLS = {}
|
TPLS = {}
|
||||||
|
|
||||||
|
|
||||||
TPLS['index-response'] = """\
|
TPLS[
|
||||||
|
"index-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
%(index)s
|
%(index)s
|
||||||
"""
|
"""
|
||||||
|
|
||||||
TPLS['api-index-response'] = """\
|
TPLS[
|
||||||
|
"api-index-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
%(api_index)s
|
%(api_index)s
|
||||||
"""
|
"""
|
||||||
|
|
||||||
TPLS['get-tx-id-request'] = """\
|
TPLS[
|
||||||
|
"get-tx-id-request"
|
||||||
|
] = """\
|
||||||
GET /api/v1/transactions/%(txid)s HTTP/1.1
|
GET /api/v1/transactions/%(txid)s HTTP/1.1
|
||||||
Host: example.com
|
Host: example.com
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-tx-id-response'] = """\
|
TPLS[
|
||||||
|
"get-tx-id-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
@ -49,14 +58,18 @@ Content-Type: application/json
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-tx-by-asset-request'] = """\
|
TPLS[
|
||||||
|
"get-tx-by-asset-request"
|
||||||
|
] = """\
|
||||||
GET /api/v1/transactions?operation=TRANSFER&asset_id=%(txid)s HTTP/1.1
|
GET /api/v1/transactions?operation=TRANSFER&asset_id=%(txid)s HTTP/1.1
|
||||||
Host: example.com
|
Host: example.com
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-tx-by-asset-response'] = """\
|
TPLS[
|
||||||
|
"get-tx-by-asset-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
@ -64,7 +77,9 @@ Content-Type: application/json
|
|||||||
%(tx_transfer_last)s]
|
%(tx_transfer_last)s]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
TPLS['post-tx-request'] = """\
|
TPLS[
|
||||||
|
"post-tx-request"
|
||||||
|
] = """\
|
||||||
POST /api/v1/transactions?mode=async HTTP/1.1
|
POST /api/v1/transactions?mode=async HTTP/1.1
|
||||||
Host: example.com
|
Host: example.com
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
@ -73,7 +88,9 @@ Content-Type: application/json
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['post-tx-response'] = """\
|
TPLS[
|
||||||
|
"post-tx-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 202 Accepted
|
HTTP/1.1 202 Accepted
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
@ -81,14 +98,18 @@ Content-Type: application/json
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-block-request'] = """\
|
TPLS[
|
||||||
|
"get-block-request"
|
||||||
|
] = """\
|
||||||
GET /api/v1/blocks/%(blockid)s HTTP/1.1
|
GET /api/v1/blocks/%(blockid)s HTTP/1.1
|
||||||
Host: example.com
|
Host: example.com
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-block-response'] = """\
|
TPLS[
|
||||||
|
"get-block-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
@ -96,14 +117,18 @@ Content-Type: application/json
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-block-txid-request'] = """\
|
TPLS[
|
||||||
|
"get-block-txid-request"
|
||||||
|
] = """\
|
||||||
GET /api/v1/blocks?transaction_id=%(txid)s HTTP/1.1
|
GET /api/v1/blocks?transaction_id=%(txid)s HTTP/1.1
|
||||||
Host: example.com
|
Host: example.com
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
TPLS['get-block-txid-response'] = """\
|
TPLS[
|
||||||
|
"get-block-txid-response"
|
||||||
|
] = """\
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
@ -112,7 +137,7 @@ Content-Type: application/json
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
""" Main function """
|
"""Main function"""
|
||||||
|
|
||||||
ctx = {}
|
ctx = {}
|
||||||
|
|
||||||
@ -121,90 +146,95 @@ def main():
|
|||||||
|
|
||||||
client = server.create_app().test_client()
|
client = server.create_app().test_client()
|
||||||
|
|
||||||
host = 'example.com:9984'
|
host = "example.com:9984"
|
||||||
|
|
||||||
# HTTP Index
|
# HTTP Index
|
||||||
res = client.get('/', environ_overrides={'HTTP_HOST': host})
|
res = client.get("/", environ_overrides={"HTTP_HOST": host})
|
||||||
res_data = json.loads(res.data.decode())
|
res_data = json.loads(res.data.decode())
|
||||||
ctx['index'] = pretty_json(res_data)
|
ctx["index"] = pretty_json(res_data)
|
||||||
|
|
||||||
# API index
|
# API index
|
||||||
res = client.get('/api/v1/', environ_overrides={'HTTP_HOST': host})
|
res = client.get("/api/v1/", environ_overrides={"HTTP_HOST": host})
|
||||||
ctx['api_index'] = pretty_json(json.loads(res.data.decode()))
|
ctx["api_index"] = pretty_json(json.loads(res.data.decode()))
|
||||||
|
|
||||||
# tx create
|
# tx create
|
||||||
privkey = 'CfdqtD7sS7FgkMoGPXw55MVGGFwQLAoHYTcBhZDtF99Z'
|
from ipld import marshal, multihash
|
||||||
pubkey = '4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD'
|
|
||||||
assets = [{'msg': 'Hello Planetmint!'}]
|
privkey = "CfdqtD7sS7FgkMoGPXw55MVGGFwQLAoHYTcBhZDtF99Z"
|
||||||
tx = Create.generate([pubkey], [([pubkey], 1)], assets=assets, metadata={'sequence': 0})
|
pubkey = "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
|
||||||
|
assets = [{"data": multihash(marshal({"msg": "Hello Planetmint!"}))}]
|
||||||
|
tx = Create.generate([pubkey], [([pubkey], 1)], assets=assets, metadata=multihash(marshal({"sequence": 0})))
|
||||||
tx = tx.sign([privkey])
|
tx = tx.sign([privkey])
|
||||||
ctx['tx'] = pretty_json(tx.to_dict())
|
ctx["tx"] = pretty_json(tx.to_dict())
|
||||||
ctx['public_keys'] = tx.outputs[0].public_keys[0]
|
ctx["public_keys"] = tx.outputs[0].public_keys[0]
|
||||||
ctx['txid'] = tx.id
|
ctx["txid"] = tx.id
|
||||||
|
|
||||||
# tx transfer
|
# tx transfer
|
||||||
privkey_transfer = '3AeWpPdhEZzWLYfkfYHBfMFC2r1f8HEaGS9NtbbKssya'
|
privkey_transfer = "3AeWpPdhEZzWLYfkfYHBfMFC2r1f8HEaGS9NtbbKssya"
|
||||||
pubkey_transfer = '3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9'
|
pubkey_transfer = "3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9"
|
||||||
|
|
||||||
cid = 0
|
cid = 0
|
||||||
input_ = Input(fulfillment=tx.outputs[cid].fulfillment,
|
input_ = Input(
|
||||||
|
fulfillment=tx.outputs[cid].fulfillment,
|
||||||
fulfills=TransactionLink(txid=tx.id, output=cid),
|
fulfills=TransactionLink(txid=tx.id, output=cid),
|
||||||
owners_before=tx.outputs[cid].public_keys)
|
owners_before=tx.outputs[cid].public_keys,
|
||||||
tx_transfer = Transfer.generate([input_], [([pubkey_transfer], 1)], asset_ids=[tx.id], metadata={'sequence': 1})
|
)
|
||||||
|
tx_transfer = Transfer.generate(
|
||||||
|
[input_], [([pubkey_transfer], 1)], asset_ids=[tx.id], metadata=multihash(marshal({"sequence": 1}))
|
||||||
|
)
|
||||||
tx_transfer = tx_transfer.sign([privkey])
|
tx_transfer = tx_transfer.sign([privkey])
|
||||||
ctx['tx_transfer'] = pretty_json(tx_transfer.to_dict())
|
ctx["tx_transfer"] = pretty_json(tx_transfer.to_dict())
|
||||||
ctx['public_keys_transfer'] = tx_transfer.outputs[0].public_keys[0]
|
ctx["public_keys_transfer"] = tx_transfer.outputs[0].public_keys[0]
|
||||||
ctx['tx_transfer_id'] = tx_transfer.id
|
ctx["tx_transfer_id"] = tx_transfer.id
|
||||||
|
|
||||||
# privkey_transfer_last = 'sG3jWDtdTXUidBJK53ucSTrosktG616U3tQHBk81eQe'
|
# privkey_transfer_last = 'sG3jWDtdTXUidBJK53ucSTrosktG616U3tQHBk81eQe'
|
||||||
pubkey_transfer_last = '3Af3fhhjU6d9WecEM9Uw5hfom9kNEwE7YuDWdqAUssqm'
|
pubkey_transfer_last = "3Af3fhhjU6d9WecEM9Uw5hfom9kNEwE7YuDWdqAUssqm"
|
||||||
|
|
||||||
cid = 0
|
cid = 0
|
||||||
input_ = Input(fulfillment=tx_transfer.outputs[cid].fulfillment,
|
input_ = Input(
|
||||||
|
fulfillment=tx_transfer.outputs[cid].fulfillment,
|
||||||
fulfills=TransactionLink(txid=tx_transfer.id, output=cid),
|
fulfills=TransactionLink(txid=tx_transfer.id, output=cid),
|
||||||
owners_before=tx_transfer.outputs[cid].public_keys)
|
owners_before=tx_transfer.outputs[cid].public_keys,
|
||||||
tx_transfer_last = Transfer.generate([input_], [([pubkey_transfer_last], 1)],
|
)
|
||||||
asset_ids=[tx.id], metadata={'sequence': 2})
|
tx_transfer_last = Transfer.generate(
|
||||||
|
[input_], [([pubkey_transfer_last], 1)], asset_ids=[tx.id], metadata=multihash(marshal({"sequence": 2}))
|
||||||
|
)
|
||||||
tx_transfer_last = tx_transfer_last.sign([privkey_transfer])
|
tx_transfer_last = tx_transfer_last.sign([privkey_transfer])
|
||||||
ctx['tx_transfer_last'] = pretty_json(tx_transfer_last.to_dict())
|
ctx["tx_transfer_last"] = pretty_json(tx_transfer_last.to_dict())
|
||||||
ctx['tx_transfer_last_id'] = tx_transfer_last.id
|
ctx["tx_transfer_last_id"] = tx_transfer_last.id
|
||||||
ctx['public_keys_transfer_last'] = tx_transfer_last.outputs[0].public_keys[0]
|
ctx["public_keys_transfer_last"] = tx_transfer_last.outputs[0].public_keys[0]
|
||||||
|
|
||||||
# block
|
# block
|
||||||
node_private = "5G2kE1zJAgTajkVSbPAQWo4c2izvtwqaNHYsaNpbbvxX"
|
node_private = "5G2kE1zJAgTajkVSbPAQWo4c2izvtwqaNHYsaNpbbvxX"
|
||||||
node_public = "DngBurxfeNVKZWCEcDnLj1eMPAS7focUZTE5FndFGuHT"
|
node_public = "DngBurxfeNVKZWCEcDnLj1eMPAS7focUZTE5FndFGuHT"
|
||||||
signature = "53wxrEQDYk1dXzmvNSytbCfmNVnPqPkDQaTnAe8Jf43s6ssejPxezkCvUnGTnduNUmaLjhaan1iRLi3peu6s5DzA"
|
signature = "53wxrEQDYk1dXzmvNSytbCfmNVnPqPkDQaTnAe8Jf43s6ssejPxezkCvUnGTnduNUmaLjhaan1iRLi3peu6s5DzA"
|
||||||
|
|
||||||
app_hash = 'f6e0c49c6d94d6924351f25bb334cf2a99af4206339bf784e741d1a5ab599056'
|
app_hash = "f6e0c49c6d94d6924351f25bb334cf2a99af4206339bf784e741d1a5ab599056"
|
||||||
block = lib.Block(height=1, transactions=[tx.to_dict()], app_hash=app_hash)
|
block = lib.Block(height=1, transactions=[tx.to_dict()], app_hash=app_hash)
|
||||||
block_dict = block._asdict()
|
block_dict = block._asdict()
|
||||||
block_dict.pop('app_hash')
|
block_dict.pop("app_hash")
|
||||||
ctx['block'] = pretty_json(block_dict)
|
ctx["block"] = pretty_json(block_dict)
|
||||||
ctx['blockid'] = block.height
|
ctx["blockid"] = block.height
|
||||||
|
|
||||||
# block status
|
# block status
|
||||||
block_list = [
|
block_list = [block.height]
|
||||||
block.height
|
ctx["block_list"] = pretty_json(block_list)
|
||||||
]
|
|
||||||
ctx['block_list'] = pretty_json(block_list)
|
|
||||||
|
|
||||||
|
base_path = os.path.join(os.path.dirname(__file__), "source/connecting/http-samples")
|
||||||
base_path = os.path.join(os.path.dirname(__file__),
|
|
||||||
'source/installation/api/http-samples')
|
|
||||||
if not os.path.exists(base_path):
|
if not os.path.exists(base_path):
|
||||||
os.makedirs(base_path)
|
os.makedirs(base_path)
|
||||||
|
|
||||||
for name, tpl in TPLS.items():
|
for name, tpl in TPLS.items():
|
||||||
path = os.path.join(base_path, name + '.http')
|
path = os.path.join(base_path, name + ".http")
|
||||||
code = tpl % ctx
|
code = tpl % ctx
|
||||||
with open(path, 'w') as handle:
|
with open(path, "w") as handle:
|
||||||
handle.write(code)
|
handle.write(code)
|
||||||
|
|
||||||
|
|
||||||
def setup(*_):
|
def setup(*_):
|
||||||
""" Fool sphinx into think it's an extension muahaha """
|
"""Fool sphinx into think it's an extension muahaha"""
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@ -36,3 +36,11 @@ sphinxcontrib-serializinghtml==1.1.5
|
|||||||
urllib3==1.26.9
|
urllib3==1.26.9
|
||||||
wget==3.2
|
wget==3.2
|
||||||
zipp==3.8.0
|
zipp==3.8.0
|
||||||
|
nest-asyncio==1.5.5
|
||||||
|
sphinx-press-theme==0.8.0
|
||||||
|
sphinx-documatt-theme
|
||||||
|
base58>=2.1.1
|
||||||
|
pynacl==1.4.0
|
||||||
|
zenroom==2.1.0.dev1655293214
|
||||||
|
pyasn1==0.4.8
|
||||||
|
cryptography==3.4.7
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
docs/root/source/_static/PLANETMINT_COLOR_POS.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
docs/root/source/_static/planet-mint-logo.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
13
docs/root/source/_static/planet-mint-logo.svg
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 120 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<g transform="matrix(0.20764,0,0,0.20764,14.4981,12.6907)">
|
||||||
|
<path d="M0,117.028C32.316,117.028 58.514,90.831 58.514,58.514C58.514,26.198 32.316,0 0,0C-32.316,0 -58.514,26.198 -58.514,58.514C-58.514,90.831 -32.316,117.028 0,117.028" style="fill:rgb(0,227,0);fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.20764,0,0,0.20764,20.2132,30.2549)">
|
||||||
|
<path d="M0,-55.048L-27.524,-27.524L-55.048,-55.048L-55.048,0L0,0L0,-55.048Z" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.20764,0,0,0.20764,117.634,29.1275)">
|
||||||
|
<path d="M0,-42.385C0,-45.539 -2.515,-47.568 -5.337,-47.568C-8.158,-47.568 -10.673,-45.539 -10.673,-42.385C-10.673,-39.215 -8.158,-37.173 -5.337,-37.173C-2.515,-37.173 0,-39.215 0,-42.385M-1.416,-42.385C-1.416,-40.007 -3.183,-38.283 -5.337,-38.283C-7.518,-38.283 -9.257,-40.007 -9.257,-42.385C-9.257,-44.748 -7.518,-46.458 -5.337,-46.458C-3.183,-46.458 -1.416,-44.748 -1.416,-42.385M-2.905,-39.479L-4.46,-42.024C-3.613,-42.094 -2.933,-42.51 -2.933,-43.58C-2.933,-44.845 -3.751,-45.303 -5.211,-45.303L-7.407,-45.303L-7.407,-39.479L-6.255,-39.479L-6.255,-41.967L-5.531,-41.967L-4.112,-39.479L-2.905,-39.479ZM-5.225,-42.87L-6.255,-42.87L-6.255,-44.401L-5.281,-44.401C-4.752,-44.401 -4.085,-44.29 -4.085,-43.677C-4.085,-42.968 -4.558,-42.87 -5.225,-42.87M-30.556,-36.925L-15.073,-36.925L-15.073,-46.475L-60.249,-46.475L-60.249,-11.82L-60.393,-11.82L-81.954,-46.475L-93.241,-46.475L-93.241,5.183L-82.605,5.183L-82.605,-29.401L-82.461,-29.401L-60.972,5.183L-49.613,5.183L-49.613,-36.925L-41.915,-36.925L-41.915,5.183L-30.556,5.183L-30.556,-36.925ZM-108.073,5.183L-96.714,5.183L-96.714,-46.475L-108.073,-46.475L-108.073,5.183ZM-122.181,5.183L-111.545,5.183L-111.545,-46.475L-127.535,-46.475L-138.967,-10.952L-139.111,-10.952L-151.194,-46.475L-167.183,-46.475L-167.183,5.183L-156.548,5.183L-156.548,-31.065L-156.403,-31.065L-143.742,5.183L-134.987,5.183L-122.326,-31.427L-122.181,-31.427L-122.181,5.183ZM-186.684,-36.925L-171.201,-36.925L-171.201,-46.475L-244.984,-46.475L-244.984,5.183L-205.77,5.183L-205.77,-4.368L-233.625,-4.368L-233.625,-17.029L-208.592,-17.029L-208.592,-25.856L-233.625,-25.856L-233.625,-36.925L-198.043,-36.925L-198.043,5.183L-186.684,5.183L-186.684,-36.925ZM-259.816,5.183L-248.457,5.183L-248.457,-46.475L-259.093,-46.475L-259.093,-11.82L-259.237,-11.82L-280.798,-46.475L-292.084,-46.475L-292.084,5.183L-281.449,5.183L-281.449,-29.401L-281.304,-29.401L-259.816,5.183ZM-305.52,5.183L-293.727,5.183L-313.044,-46.475L-324.693,-46.475L-340.675,-4.368L-356.154,-4.368L-356.154,-46.475L-367.513,-46.475L-367.513,5.183L-332.796,5.183L-328.744,-6.321L-309.427,-6.321L-305.52,5.183ZM-312.393,-14.786L-325.778,-14.786L-319.049,-33.742L-318.905,-33.742L-312.393,-14.786ZM-370.414,-29.907C-370.414,-38.3 -375.334,-46.475 -388.285,-46.475L-411.582,-46.475L-411.582,5.183L-400.223,5.183L-400.223,-13.339L-388.285,-13.339C-375.334,-13.339 -370.414,-21.514 -370.414,-29.907M-381.411,-29.907C-381.411,-23.323 -386.187,-22.165 -391.396,-22.165L-400.223,-22.165L-400.223,-37.649L-391.396,-37.649C-386.187,-37.649 -381.411,-36.491 -381.411,-29.907" style="fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.5 KiB |
BIN
docs/root/source/_static/planetmint-logo.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
13
docs/root/source/_static/planetmint-logo.svg
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 120 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<g transform="matrix(0.20764,0,0,0.20764,14.4981,12.6907)">
|
||||||
|
<path d="M0,117.028C32.316,117.028 58.514,90.831 58.514,58.514C58.514,26.198 32.316,0 0,0C-32.316,0 -58.514,26.198 -58.514,58.514C-58.514,90.831 -32.316,117.028 0,117.028" style="fill:rgb(0,227,0);fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.20764,0,0,0.20764,20.2132,30.2549)">
|
||||||
|
<path d="M0,-55.048L-27.524,-27.524L-55.048,-55.048L-55.048,0L0,0L0,-55.048Z" style="fill:white;fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.20764,0,0,0.20764,117.634,29.1275)">
|
||||||
|
<path d="M0,-42.385C0,-45.539 -2.515,-47.568 -5.337,-47.568C-8.158,-47.568 -10.673,-45.539 -10.673,-42.385C-10.673,-39.215 -8.158,-37.173 -5.337,-37.173C-2.515,-37.173 0,-39.215 0,-42.385M-1.416,-42.385C-1.416,-40.007 -3.183,-38.283 -5.337,-38.283C-7.518,-38.283 -9.257,-40.007 -9.257,-42.385C-9.257,-44.748 -7.518,-46.458 -5.337,-46.458C-3.183,-46.458 -1.416,-44.748 -1.416,-42.385M-2.905,-39.479L-4.46,-42.024C-3.613,-42.094 -2.933,-42.51 -2.933,-43.58C-2.933,-44.845 -3.751,-45.303 -5.211,-45.303L-7.407,-45.303L-7.407,-39.479L-6.255,-39.479L-6.255,-41.967L-5.531,-41.967L-4.112,-39.479L-2.905,-39.479ZM-5.225,-42.87L-6.255,-42.87L-6.255,-44.401L-5.281,-44.401C-4.752,-44.401 -4.085,-44.29 -4.085,-43.677C-4.085,-42.968 -4.558,-42.87 -5.225,-42.87M-30.556,-36.925L-15.073,-36.925L-15.073,-46.475L-60.249,-46.475L-60.249,-11.82L-60.393,-11.82L-81.954,-46.475L-93.241,-46.475L-93.241,5.183L-82.605,5.183L-82.605,-29.401L-82.461,-29.401L-60.972,5.183L-49.613,5.183L-49.613,-36.925L-41.915,-36.925L-41.915,5.183L-30.556,5.183L-30.556,-36.925ZM-108.073,5.183L-96.714,5.183L-96.714,-46.475L-108.073,-46.475L-108.073,5.183ZM-122.181,5.183L-111.545,5.183L-111.545,-46.475L-127.535,-46.475L-138.967,-10.952L-139.111,-10.952L-151.194,-46.475L-167.183,-46.475L-167.183,5.183L-156.548,5.183L-156.548,-31.065L-156.403,-31.065L-143.742,5.183L-134.987,5.183L-122.326,-31.427L-122.181,-31.427L-122.181,5.183ZM-186.684,-36.925L-171.201,-36.925L-171.201,-46.475L-244.984,-46.475L-244.984,5.183L-205.77,5.183L-205.77,-4.368L-233.625,-4.368L-233.625,-17.029L-208.592,-17.029L-208.592,-25.856L-233.625,-25.856L-233.625,-36.925L-198.043,-36.925L-198.043,5.183L-186.684,5.183L-186.684,-36.925ZM-259.816,5.183L-248.457,5.183L-248.457,-46.475L-259.093,-46.475L-259.093,-11.82L-259.237,-11.82L-280.798,-46.475L-292.084,-46.475L-292.084,5.183L-281.449,5.183L-281.449,-29.401L-281.304,-29.401L-259.816,5.183ZM-305.52,5.183L-293.727,5.183L-313.044,-46.475L-324.693,-46.475L-340.675,-4.368L-356.154,-4.368L-356.154,-46.475L-367.513,-46.475L-367.513,5.183L-332.796,5.183L-328.744,-6.321L-309.427,-6.321L-305.52,5.183ZM-312.393,-14.786L-325.778,-14.786L-319.049,-33.742L-318.905,-33.742L-312.393,-14.786ZM-370.414,-29.907C-370.414,-38.3 -375.334,-46.475 -388.285,-46.475L-411.582,-46.475L-411.582,5.183L-400.223,5.183L-400.223,-13.339L-388.285,-13.339C-375.334,-13.339 -370.414,-21.514 -370.414,-29.907M-381.411,-29.907C-381.411,-23.323 -386.187,-22.165 -391.396,-22.165L-400.223,-22.165L-400.223,-37.649L-391.396,-37.649C-386.187,-37.649 -381.411,-36.491 -381.411,-29.907" style="fill-rule:nonzero;"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.5 KiB |
BIN
docs/root/source/_static/planetmint350x150.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
docs/root/source/_static/planetmint360x150white.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
@ -49,7 +49,7 @@ Port 443 is the default HTTPS port (TCP). Package managers might also get some p
|
|||||||
|
|
||||||
Port 9984 is the default port for the Planetmint client-server HTTP API (TCP), which is served by Gunicorn HTTP Server. It's _possible_ allow port 9984 to accept inbound traffic from anyone, but we recommend against doing that. Instead, set up a reverse proxy server (e.g. using Nginx) and only allow traffic from there. Information about how to do that can be found [in the Gunicorn documentation](http://docs.gunicorn.org/en/stable/deploy.html). (They call it a proxy.)
|
Port 9984 is the default port for the Planetmint client-server HTTP API (TCP), which is served by Gunicorn HTTP Server. It's _possible_ allow port 9984 to accept inbound traffic from anyone, but we recommend against doing that. Instead, set up a reverse proxy server (e.g. using Nginx) and only allow traffic from there. Information about how to do that can be found [in the Gunicorn documentation](http://docs.gunicorn.org/en/stable/deploy.html). (They call it a proxy.)
|
||||||
|
|
||||||
If Gunicorn and the reverse proxy are running on the same server, then you'll have to tell Gunicorn to listen on some port other than 9984 (so that the reverse proxy can listen on port 9984). You can do that by setting `server.bind` to 'localhost:PORT' in the [Planetmint Configuration Settings](../../installation/node-setup/configuration), where PORT is whatever port you chose (e.g. 9983).
|
If Gunicorn and the reverse proxy are running on the same server, then you'll have to tell Gunicorn to listen on some port other than 9984 (so that the reverse proxy can listen on port 9984). You can do that by setting `server.bind` to 'localhost:PORT' in the [Planetmint Configuration Settings](../node-setup/configuration), where PORT is whatever port you chose (e.g. 9983).
|
||||||
|
|
||||||
You may want to have Gunicorn and the reverse proxy running on different servers, so that both can listen on port 9984. That would also help isolate the effects of a denial-of-service attack.
|
You may want to have Gunicorn and the reverse proxy running on different servers, so that both can listen on port 9984. That would also help isolate the effects of a denial-of-service attack.
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ Code is Apache-2.0 and docs are CC-BY-4.0
|
|||||||
|
|
||||||
Each Planetmint node runs:
|
Each Planetmint node runs:
|
||||||
|
|
||||||
- MongoDB
|
- Tarantool
|
||||||
- Planetmint Server
|
- Planetmint Server
|
||||||
- Tendermint
|
- Tendermint
|
||||||
|
|
||||||
@ -17,11 +17,6 @@ When running a Planetmint node for long periods
|
|||||||
of time, we need to consider doing log rotation, i.e. we do not want the logs taking
|
of time, we need to consider doing log rotation, i.e. we do not want the logs taking
|
||||||
up large amounts of storage and making the node unresponsive or getting it into a bad state.
|
up large amounts of storage and making the node unresponsive or getting it into a bad state.
|
||||||
|
|
||||||
## MongoDB Logging and Log Rotation
|
|
||||||
|
|
||||||
See the MongoDB docs about
|
|
||||||
[logging](https://docs.mongodb.com/v3.6/administration/monitoring/#monitoring-standard-loggging)
|
|
||||||
and [log rotation](https://docs.mongodb.com/v3.6/tutorial/rotate-log-files/).
|
|
||||||
|
|
||||||
## Planetmint Server Logging and Log Rotation
|
## Planetmint Server Logging and Log Rotation
|
||||||
|
|
||||||
@ -32,7 +27,7 @@ Planetmint Server writes its logs to two files: normal logs and error logs. The
|
|||||||
|
|
||||||
Log rotation is baked into Planetmint Server using Python's `logging` module. The logs for Planetmint Server are rotated when any of the above mentioned files exceeds 209715200 bytes (i.e. approximately 209 MB).
|
Log rotation is baked into Planetmint Server using Python's `logging` module. The logs for Planetmint Server are rotated when any of the above mentioned files exceeds 209715200 bytes (i.e. approximately 209 MB).
|
||||||
|
|
||||||
For more information, see the docs about [the Planetmint Server configuration settings related to logging](../../installation/node-setup/configuration#log).
|
For more information, see the docs about [the Planetmint Server configuration settings related to logging](../node-setup/configuration#log).
|
||||||
|
|
||||||
## Tendermint Logging and Log Rotation
|
## Tendermint Logging and Log Rotation
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ two kinds: CREATE transactions and TRANSFER transactions.
|
|||||||
|
|
||||||
You can view the transaction specifications in Github, which describe transaction components and the conditions they have to fulfill in order to be valid.
|
You can view the transaction specifications in Github, which describe transaction components and the conditions they have to fulfill in order to be valid.
|
||||||
|
|
||||||
[Planetmint Transactions Specs](https://github.com/planetmint/BEPs/tree/master/13/)
|
[Planetmint Transactions Specs](https://github.com/bigchaindb/BEPs/tree/master/13/)
|
||||||
|
|
||||||
### CREATE Transactions
|
### CREATE Transactions
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ Planetmint supports a variety of conditions.
|
|||||||
For details, see
|
For details, see
|
||||||
the section titled **Transaction Components: Conditions**
|
the section titled **Transaction Components: Conditions**
|
||||||
in the relevant
|
in the relevant
|
||||||
[Planetmint Transactions Spec](https://github.com/planetmint/BEPs/tree/master/13/).
|
[Planetmint Transactions Spec](https://github.com/bigchaindb/BEPs/tree/master/13/).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@ -58,7 +58,7 @@ Loosely speaking, that list might be interpreted as the list of "owners."
|
|||||||
A more accurate word might be fulfillers, signers, controllers,
|
A more accurate word might be fulfillers, signers, controllers,
|
||||||
or transfer-enablers.
|
or transfer-enablers.
|
||||||
See the section titled **A Note about Owners**
|
See the section titled **A Note about Owners**
|
||||||
in the relevant [Planetmint Transactions Spec](https://github.com/planetmint/BEPs/tree/master/13/).
|
in the relevant [Planetmint Transactions Spec](https://github.com/bigchaindb/BEPs/tree/master/13/).
|
||||||
|
|
||||||
A CREATE transaction must be signed by all the owners.
|
A CREATE transaction must be signed by all the owners.
|
||||||
(If you're looking for that signature,
|
(If you're looking for that signature,
|
||||||
@ -119,13 +119,43 @@ of the outgoing paperclips (100).
|
|||||||
### Transaction Validity
|
### Transaction Validity
|
||||||
|
|
||||||
When a node is asked to check if a transaction is valid, it checks several
|
When a node is asked to check if a transaction is valid, it checks several
|
||||||
things. We documented those things in a post on *The Planetmint Blog*:
|
things. This got documented by a BigchainDB post (previous version of Planetmint) at*The BigchainDB Blog*:
|
||||||
["What is a Valid Transaction in Planetmint?"](https://blog.planetmint.io/what-is-a-valid-transaction-in-planetmint-9a1a075a9598)
|
["What is a Valid Transaction in BigchainDB?"](https://blog.bigchaindb.com/what-is-a-valid-transaction-in-planetmint-9a1a075a9598)
|
||||||
(Note: That post was about Planetmint Server v1.0.0.)
|
(Note: That post was about Planetmint Server v1.0.0.)
|
||||||
|
|
||||||
|
## A Note on IPLD marshalling and CIDs
|
||||||
|
|
||||||
|
Planetmint utilizes IPLD (interplanetary linked data) marshalling and CIDs (content identifiers) to store and verify data.
|
||||||
|
Before submitting a transaction to the network the data is marshalled using [py-ipld](https://github.com/planetmint/py-ipld) and instead of the raw data a CID is stored on chain.
|
||||||
|
|
||||||
|
The CID is a self describing data structure. It contains information about the encoding, cryptographic algorithm, length and the actual hashvalue. For example the CID `bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi` tells us the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
Encoding: base32
|
||||||
|
Codec: dag-pb (MerkleDAG protobuf)
|
||||||
|
Hashing-Algorithm: sha2-256
|
||||||
|
Digest (Hex): C3C4733EC8AFFD06CF9E9FF50FFC6BCD2EC85A6170004BB709669C31DE94391A
|
||||||
|
```
|
||||||
|
|
||||||
|
With this information we can validate that information about an asset we've received is actually valid.
|
||||||
|
|
||||||
|
|
||||||
### Example Transactions
|
### Example Transactions
|
||||||
|
|
||||||
There are example Planetmint transactions in
|
There are example Planetmint transactions in
|
||||||
[the HTTP API documentation](./installation/api/http-client-server-api)
|
[the HTTP API documentation](./connecting/http-client-server-api)
|
||||||
and
|
and
|
||||||
[the Python Driver documentation](./drivers/index).
|
[the Python Driver documentation](./connecting/drivers).
|
||||||
|
|
||||||
|
## Contracts & Conditions
|
||||||
|
|
||||||
|
Planetmint has been developed with simple logical gateways in mind. The logic got introduced by [cryptoconditions](https://https://docs.planetmint.io/projects/cryptoconditions). The cryptocondition documentation contains all details about how conditoins are defined and how they can be verified and fulfilled.
|
||||||
|
|
||||||
|
The integration of such into the transaction schema of Planetmint is shown below.
|
||||||
|
|
||||||
|
## Zenroom Smart Contracts and Policies
|
||||||
|
|
||||||
|
[Zenroom](https://zenroom.org/) was integrated into [cryptoconditions](https://https://docs.planetmint.io/projects/cryptoconditions) to allow for human-readable conditions and fulfillments.
|
||||||
|
At the moment these contracts can only be stateless, which implies that the conditions and fulfillments need to be transacted in the same transaction. However, [PRP-10](https://github.com/planetmint/PRPs/tree/main/10) aims to make stateful contracts possible, which enables asynchronous and party-independent processing of contracts.
|
||||||
|
|
||||||
|
As for network-wide or asset-based policies [PRP-11](https://github.com/planetmint/PRPs/tree/main/11) specifies how these can be implemented and how these can be used to verify a transaction state before it is commited to the network.
|
||||||
|
|||||||
@ -30,14 +30,14 @@ from os import rename, remove
|
|||||||
|
|
||||||
# get version
|
# get version
|
||||||
_version = {}
|
_version = {}
|
||||||
with open('../../../planetmint/version.py') as fp:
|
with open("../../../planetmint/version.py") as fp:
|
||||||
exec(fp.read(), _version)
|
exec(fp.read(), _version)
|
||||||
|
|
||||||
|
|
||||||
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
||||||
parentdir = os.path.dirname(currentdir)
|
parentdir = os.path.dirname(currentdir)
|
||||||
sys.path.insert(0,parentdir)
|
sys.path.insert(0, parentdir)
|
||||||
#sys.path.insert(0, "/home/myname/pythonfiles")
|
# sys.path.insert(0, "/home/myname/pythonfiles")
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
@ -48,83 +48,95 @@ sys.path.insert(0,parentdir)
|
|||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
# ones.
|
# ones.
|
||||||
project = 'Planetmint'
|
project = "Planetmint"
|
||||||
|
|
||||||
import sphinx_rtd_theme
|
import sphinx_rtd_theme
|
||||||
|
|
||||||
extensions = [
|
extensions = [
|
||||||
'myst_parser',
|
"myst_parser",
|
||||||
'sphinx.ext.autosectionlabel',
|
"sphinx.ext.autosectionlabel",
|
||||||
'sphinx.ext.autodoc',
|
"sphinx.ext.autodoc",
|
||||||
'sphinx.ext.intersphinx',
|
"sphinx.ext.intersphinx",
|
||||||
'sphinx.ext.coverage',
|
"sphinx.ext.coverage",
|
||||||
'sphinx.ext.viewcode',
|
"sphinx.ext.viewcode",
|
||||||
'sphinx.ext.todo',
|
"sphinx.ext.todo",
|
||||||
'sphinx.ext.napoleon',
|
"sphinx.ext.napoleon",
|
||||||
'sphinxcontrib.httpdomain',
|
"sphinxcontrib.httpdomain",
|
||||||
'aafigure.sphinxext',
|
"aafigure.sphinxext",
|
||||||
|
#'sphinx_toolbox.collapse',
|
||||||
# Below are actually build steps made to look like sphinx extensions.
|
# Below are actually build steps made to look like sphinx extensions.
|
||||||
# It was the easiest way to get it running with ReadTheDocs.
|
# It was the easiest way to get it running with ReadTheDocs.
|
||||||
'generate_http_server_api_documentation',
|
"generate_http_server_api_documentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
remove('contributing/cross-project-policies/code-of-conduct.md')
|
remove("contributing/cross-project-policies/code-of-conduct.md")
|
||||||
remove('contributing/cross-project-policies/release-process.md')
|
remove("contributing/cross-project-policies/release-process.md")
|
||||||
remove('contributing/cross-project-policies/python-style-guide.md')
|
remove("contributing/cross-project-policies/python-style-guide.md")
|
||||||
except:
|
except:
|
||||||
print('done')
|
print("done")
|
||||||
|
|
||||||
|
|
||||||
def get_old_new(url, old, new):
|
def get_old_new(url, old, new):
|
||||||
filename = wget.download(url)
|
filename = wget.download(url)
|
||||||
rename(old, new)
|
rename(old, new)
|
||||||
|
|
||||||
get_old_new('https://raw.githubusercontent.com/planetmint/planetmint/master/CODE_OF_CONDUCT.md',
|
|
||||||
'CODE_OF_CONDUCT.md', 'contributing/cross-project-policies/code-of-conduct.md')
|
|
||||||
|
|
||||||
get_old_new('https://raw.githubusercontent.com/planetmint/planetmint/master/RELEASE_PROCESS.md',
|
get_old_new(
|
||||||
'RELEASE_PROCESS.md', 'contributing/cross-project-policies/release-process.md')
|
"https://raw.githubusercontent.com/planetmint/planetmint/master/CODE_OF_CONDUCT.md",
|
||||||
|
"CODE_OF_CONDUCT.md",
|
||||||
|
"contributing/cross-project-policies/code-of-conduct.md",
|
||||||
|
)
|
||||||
|
|
||||||
get_old_new('https://raw.githubusercontent.com/planetmint/planetmint/master/PYTHON_STYLE_GUIDE.md',
|
get_old_new(
|
||||||
'PYTHON_STYLE_GUIDE.md', 'contributing/cross-project-policies/python-style-guide.md')
|
"https://raw.githubusercontent.com/planetmint/planetmint/master/RELEASE_PROCESS.md",
|
||||||
|
"RELEASE_PROCESS.md",
|
||||||
|
"contributing/cross-project-policies/release-process.md",
|
||||||
|
)
|
||||||
|
|
||||||
suppress_warnings = ['misc.highlighting_failure']
|
get_old_new(
|
||||||
|
"https://raw.githubusercontent.com/planetmint/planetmint/master/PYTHON_STYLE_GUIDE.md",
|
||||||
|
"PYTHON_STYLE_GUIDE.md",
|
||||||
|
"contributing/cross-project-policies/python-style-guide.md",
|
||||||
|
)
|
||||||
|
|
||||||
|
suppress_warnings = ["misc.highlighting_failure"]
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ["_templates"]
|
||||||
|
|
||||||
# autodoc settings
|
# autodoc settings
|
||||||
autodoc_member_order = 'bysource'
|
autodoc_member_order = "bysource"
|
||||||
autodoc_default_options = {
|
autodoc_default_options = {
|
||||||
'members': None,
|
"members": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
# The suffix(es) of source filenames.
|
# The suffix(es) of source filenames.
|
||||||
# You can specify multiple suffix as a list of string:
|
# You can specify multiple suffix as a list of string:
|
||||||
#
|
#
|
||||||
# source_suffix = ['.rst', '.md']
|
# source_suffix = ['.rst', '.md']
|
||||||
source_suffix = ['.rst', '.md']
|
source_suffix = [".rst", ".md"]
|
||||||
|
|
||||||
# The encoding of source files.
|
# The encoding of source files.
|
||||||
#
|
#
|
||||||
# source_encoding = 'utf-8-sig'
|
# source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
# The master toctree document.
|
# The master toctree document.
|
||||||
master_doc = 'index'
|
master_doc = "index"
|
||||||
autosectionlabel_prefix_document = True
|
autosectionlabel_prefix_document = True
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
copyright = str(now.year) + ', Planetmint Contributors'
|
copyright = str(now.year) + ", Planetmint Contributors"
|
||||||
author = 'Planetmint Contributors'
|
author = "Planetmint Contributors"
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = _version['__short_version__']
|
version = _version["__short_version__"]
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = _version['__version__']
|
release = _version["__version__"]
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
@ -132,7 +144,7 @@ release = _version['__version__']
|
|||||||
#
|
#
|
||||||
# This is also used if you do content translation via gettext catalogs.
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
# Usually you set "language" from the command line for these cases.
|
# Usually you set "language" from the command line for these cases.
|
||||||
language = 'en'
|
language = "en"
|
||||||
|
|
||||||
# There are two options for replacing |today|: either, you set today to some
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
# non-false value, then it is used:
|
# non-false value, then it is used:
|
||||||
@ -168,7 +180,7 @@ exclude_patterns = []
|
|||||||
# show_authors = False
|
# show_authors = False
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = "sphinx"
|
||||||
|
|
||||||
# A list of ignored prefixes for module index sorting.
|
# A list of ignored prefixes for module index sorting.
|
||||||
# modindex_common_prefix = []
|
# modindex_common_prefix = []
|
||||||
@ -185,7 +197,8 @@ todo_include_todos = False
|
|||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
# a list of builtin themes.
|
# a list of builtin themes.
|
||||||
#
|
#
|
||||||
html_theme = 'sphinx_rtd_theme'
|
html_theme = "press"
|
||||||
|
# html_theme = 'sphinx_documatt_theme'
|
||||||
|
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
@ -194,7 +207,7 @@ html_theme = 'sphinx_rtd_theme'
|
|||||||
# html_theme_options = {}
|
# html_theme_options = {}
|
||||||
|
|
||||||
# Add any paths that contain custom themes here, relative to this directory.
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
# html_theme_path = [press.get_html_theme_path()]
|
||||||
|
|
||||||
# The name for this set of Sphinx documents.
|
# The name for this set of Sphinx documents.
|
||||||
# "<project> v<release> documentation" by default.
|
# "<project> v<release> documentation" by default.
|
||||||
@ -208,7 +221,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|||||||
# The name of an image file (relative to this directory) to place at the top
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
# of the sidebar.
|
# of the sidebar.
|
||||||
#
|
#
|
||||||
# html_logo = None
|
html_logo = "_static/planetmint-logo.png"
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to use as a favicon of
|
# The name of an image file (relative to this directory) to use as a favicon of
|
||||||
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
@ -219,7 +232,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ['_static']
|
html_static_path = ["_static"]
|
||||||
|
|
||||||
# Add any extra paths that contain custom files (such as robots.txt or
|
# Add any extra paths that contain custom files (such as robots.txt or
|
||||||
# .htaccess) here, relative to this directory. These files are copied
|
# .htaccess) here, relative to this directory. These files are copied
|
||||||
@ -299,23 +312,20 @@ html_static_path = ['_static']
|
|||||||
# html_search_scorer = 'scorer.js'
|
# html_search_scorer = 'scorer.js'
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'Planetmintdoc'
|
htmlhelp_basename = "Planetmintdoc"
|
||||||
|
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
#
|
#
|
||||||
'papersize': 'letterpaper',
|
"papersize": "letterpaper",
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
#
|
#
|
||||||
# 'pointsize': '10pt',
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
#
|
#
|
||||||
# 'preamble': '',
|
# 'preamble': '',
|
||||||
|
|
||||||
# Latex figure (float) alignment
|
# Latex figure (float) alignment
|
||||||
#
|
#
|
||||||
# 'figure_align': 'htbp',
|
# 'figure_align': 'htbp',
|
||||||
@ -325,8 +335,13 @@ latex_elements = {
|
|||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, 'Planetmint.tex', 'Planetmint Documentation',
|
(
|
||||||
'Planetmint Contributors', 'manual'),
|
master_doc,
|
||||||
|
"Planetmint.tex",
|
||||||
|
"Planetmint Documentation",
|
||||||
|
"Planetmint Contributors",
|
||||||
|
"manual",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
@ -366,10 +381,7 @@ latex_documents = [
|
|||||||
|
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [(master_doc, "planetmint", "Planetmint Documentation", [author], 1)]
|
||||||
(master_doc, 'planetmint', 'Planetmint Documentation',
|
|
||||||
[author], 1)
|
|
||||||
]
|
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
#
|
#
|
||||||
@ -382,9 +394,15 @@ man_pages = [
|
|||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
(master_doc, 'Planetmint', 'Planetmint Documentation',
|
(
|
||||||
author, 'Planetmint', 'One line description of project.',
|
master_doc,
|
||||||
'Miscellaneous'),
|
"Planetmint",
|
||||||
|
"Planetmint Documentation",
|
||||||
|
author,
|
||||||
|
"Planetmint",
|
||||||
|
"One line description of project.",
|
||||||
|
"Miscellaneous",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
# Documents to append as an appendix to all manuals.
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
BIN
docs/root/source/connecting/_static/Node-components.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
BIN
docs/root/source/connecting/_static/mongodb_cloud_manager_1.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -8,46 +8,53 @@
|
|||||||
Database Backend Interfaces
|
Database Backend Interfaces
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. automodule:: planetmint.backend
|
.. automodule:: planetmint.backend
|
||||||
:special-members: __init__
|
:special-members: __init__
|
||||||
|
|
||||||
|
|
||||||
Generic Interfaces
|
Generic Interfaces
|
||||||
==================
|
------------------
|
||||||
|
|
||||||
|
|
||||||
:mod:`planetmint.backend.connection`
|
:mod:`planetmint.backend.connection`
|
||||||
------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. automodule:: planetmint.backend.connection
|
.. automodule:: planetmint.backend.connection
|
||||||
:special-members: __init__
|
:special-members: __init__
|
||||||
|
|
||||||
:mod:`planetmint.backend.query`
|
:mod:`planetmint.backend.query`
|
||||||
-------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
.. automodule:: planetmint.backend.query
|
.. automodule:: planetmint.backend.query
|
||||||
|
|
||||||
:mod:`planetmint.backend.schema`
|
:mod:`planetmint.backend.schema`
|
||||||
--------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
.. automodule:: planetmint.backend.schema
|
.. automodule:: planetmint.backend.schema
|
||||||
|
|
||||||
:mod:`planetmint.backend.utils`
|
:mod:`planetmint.backend.utils`
|
||||||
-------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
.. automodule:: planetmint.backend.utils
|
.. automodule:: planetmint.backend.utils
|
||||||
|
|
||||||
|
|
||||||
MongoDB Backend
|
MongoDB Backend
|
||||||
===============
|
---------------
|
||||||
|
|
||||||
|
|
||||||
.. automodule:: planetmint.backend.localmongodb
|
.. automodule:: planetmint.backend.localmongodb
|
||||||
:special-members: __init__
|
:special-members: __init__
|
||||||
|
|
||||||
:mod:`planetmint.backend.localmongodb.connection`
|
:mod:`planetmint.backend.localmongodb.connection`
|
||||||
-------------------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
||||||
.. automodule:: planetmint.backend.localmongodb.connection
|
.. automodule:: planetmint.backend.localmongodb.connection
|
||||||
|
|
||||||
:mod:`planetmint.backend.localmongodb.query`
|
:mod:`planetmint.backend.localmongodb.query`
|
||||||
--------------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. automodule:: planetmint.backend.localmongodb.query
|
.. automodule:: planetmint.backend.localmongodb.query
|
||||||
|
|
||||||
:mod:`planetmint.backend.localmongodb.schema`
|
:mod:`planetmint.backend.localmongodb.schema`
|
||||||
---------------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. automodule:: planetmint.backend.localmongodb.schema
|
.. automodule:: planetmint.backend.localmongodb.schema
|
||||||
@ -5,7 +5,8 @@
|
|||||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||||
|
|
||||||
Commands And Backend
|
Commands And Backend
|
||||||
====================
|
********************
|
||||||
|
|
||||||
|
|
||||||
This section contains auto-generated documentation of various functions, classes and methods
|
This section contains auto-generated documentation of various functions, classes and methods
|
||||||
in the Planetmint Server code, based on Python docstrings in the code itself.
|
in the Planetmint Server code, based on Python docstrings in the code itself.
|
||||||
@ -16,11 +17,9 @@ in the Planetmint Server code, based on Python docstrings in the code itself.
|
|||||||
if you want to know *for sure* what the code does,
|
if you want to know *for sure* what the code does,
|
||||||
then you have to read the code itself.
|
then you have to read the code itself.
|
||||||
|
|
||||||
.. toctree::
|
.. include:: ./commands.rst
|
||||||
:maxdepth: 1
|
.. include:: the-planetmint-class.rst
|
||||||
|
.. include:: backend.rst
|
||||||
commands
|
|
||||||
the-planetmint-class
|
|
||||||
backend
|
|
||||||
|
|
||||||
|
|
||||||
@ -4,13 +4,14 @@
|
|||||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||||
|
|
||||||
Drivers
|
Drivers & Bindings
|
||||||
=======
|
******************
|
||||||
|
|
||||||
|
|
||||||
Connectors to Planetmint are referred to as drivers within the community. A driver is used to create valid transactions, to generate key pairs, to sign transactions and to post the transaction to the Planetmint API.
|
Connectors to Planetmint are referred to as drivers within the community. A driver is used to create valid transactions, to generate key pairs, to sign transactions and to post the transaction to the Planetmint API.
|
||||||
|
|
||||||
These drivers were originally created by the original BigchainDB team:
|
These drivers or bindings were originally created by the original BigchainDB team:
|
||||||
Planetmint
|
|
||||||
* `Python Driver <https://docs.planetmint.io/projects/py-driver/en/latest/index.html>`_
|
* `Python Driver <https://docs.planetmint.io/projects/py-driver/en/latest/index.html>`_
|
||||||
* `JavaScript / Node.js Driver <https://github.com/bigchaindb/js-bigchaindb-driver>`_
|
* `JavaScript / Node.js Driver <https://github.com/bigchaindb/js-bigchaindb-driver>`_
|
||||||
* `Java Driver <https://github.com/bigchaindb/java-bigchaindb-driver>`_
|
* `Java Driver <https://github.com/bigchaindb/java-bigchaindb-driver>`_
|
||||||
@ -4,10 +4,9 @@
|
|||||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||||
|
|
||||||
.. _the-http-client-server-api:
|
HTTP Client-Server API
|
||||||
|
**************************
|
||||||
|
|
||||||
The HTTP Client-Server API
|
|
||||||
==========================
|
|
||||||
|
|
||||||
This page assumes you already know an API Root URL
|
This page assumes you already know an API Root URL
|
||||||
for a Planetmint node or reverse proxy.
|
for a Planetmint node or reverse proxy.
|
||||||
@ -18,10 +17,10 @@ If you set up a Planetmint node or reverse proxy yourself,
|
|||||||
and you're not sure what the API Root URL is,
|
and you're not sure what the API Root URL is,
|
||||||
then see the last section of this page for help.
|
then see the last section of this page for help.
|
||||||
|
|
||||||
.. _planetmint-root-url:
|
|
||||||
|
|
||||||
Planetmint Root URL
|
Planetmint Root URL
|
||||||
-------------------
|
===================
|
||||||
|
|
||||||
|
|
||||||
If you send an HTTP GET request to the Planetmint Root URL
|
If you send an HTTP GET request to the Planetmint Root URL
|
||||||
e.g. ``http://localhost:9984``
|
e.g. ``http://localhost:9984``
|
||||||
@ -34,10 +33,10 @@ with something like the following in the body:
|
|||||||
:language: http
|
:language: http
|
||||||
|
|
||||||
|
|
||||||
.. _api-root-endpoint:
|
.. _Api root endpoint:
|
||||||
|
|
||||||
API Root Endpoint
|
API Root Endpoint
|
||||||
-----------------
|
=================
|
||||||
|
|
||||||
|
|
||||||
If you send an HTTP GET request to the API Root Endpoint
|
If you send an HTTP GET request to the API Root Endpoint
|
||||||
e.g. ``http://localhost:9984/api/v1/``
|
e.g. ``http://localhost:9984/api/v1/``
|
||||||
@ -50,7 +49,8 @@ that allows you to discover the Planetmint API endpoints:
|
|||||||
|
|
||||||
|
|
||||||
Transactions Endpoint
|
Transactions Endpoint
|
||||||
---------------------
|
=====================
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -147,11 +147,11 @@ Transactions Endpoint
|
|||||||
If it's invalid, the node will return an HTTP 400 (error).
|
If it's invalid, the node will return an HTTP 400 (error).
|
||||||
Otherwise, the node will send the transaction to Tendermint (in the same node) using the
|
Otherwise, the node will send the transaction to Tendermint (in the same node) using the
|
||||||
`Tendermint broadcast API
|
`Tendermint broadcast API
|
||||||
<https://tendermint.io/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
|
<https://tendermint.com/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
|
||||||
|
|
||||||
The meaning of the ``mode`` query parameter is inherited from the mode parameter in
|
The meaning of the ``mode`` query parameter is inherited from the mode parameter in
|
||||||
`Tendermint's broadcast API
|
`Tendermint's broadcast API
|
||||||
<https://tendermint.io/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
|
<https://tendermint.com/docs/tendermint-core/using-tendermint.html#broadcast-api>`_.
|
||||||
``mode=async`` means the HTTP response will come back immediately,
|
``mode=async`` means the HTTP response will come back immediately,
|
||||||
before Tendermint asks Planetmint Server to check the validity of the transaction (a second time).
|
before Tendermint asks Planetmint Server to check the validity of the transaction (a second time).
|
||||||
``mode=sync`` means the HTTP response will come back
|
``mode=sync`` means the HTTP response will come back
|
||||||
@ -210,7 +210,8 @@ Transactions Endpoint
|
|||||||
|
|
||||||
|
|
||||||
Transaction Outputs
|
Transaction Outputs
|
||||||
-------------------
|
===================
|
||||||
|
|
||||||
|
|
||||||
The ``/api/v1/outputs`` endpoint returns transactions outputs filtered by a
|
The ``/api/v1/outputs`` endpoint returns transactions outputs filtered by a
|
||||||
given public key, and optionally filtered to only include either spent or
|
given public key, and optionally filtered to only include either spent or
|
||||||
@ -332,7 +333,8 @@ unspent outputs.
|
|||||||
|
|
||||||
|
|
||||||
Assets
|
Assets
|
||||||
------
|
======
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -456,7 +458,8 @@ Assets
|
|||||||
|
|
||||||
|
|
||||||
Transaction Metadata
|
Transaction Metadata
|
||||||
--------------------
|
====================
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -580,7 +583,8 @@ Transaction Metadata
|
|||||||
|
|
||||||
|
|
||||||
Validators
|
Validators
|
||||||
--------------------
|
==========
|
||||||
|
|
||||||
|
|
||||||
.. http:get:: /api/v1/validators
|
.. http:get:: /api/v1/validators
|
||||||
|
|
||||||
@ -624,7 +628,8 @@ Validators
|
|||||||
|
|
||||||
|
|
||||||
Blocks
|
Blocks
|
||||||
------
|
======
|
||||||
|
|
||||||
|
|
||||||
.. http:get:: /api/v1/blocks/{block_height}
|
.. http:get:: /api/v1/blocks/{block_height}
|
||||||
|
|
||||||
@ -701,7 +706,8 @@ Blocks
|
|||||||
.. _determining-the-api-root-url:
|
.. _determining-the-api-root-url:
|
||||||
|
|
||||||
Determining the API Root URL
|
Determining the API Root URL
|
||||||
----------------------------
|
============================
|
||||||
|
|
||||||
|
|
||||||
When you start Planetmint Server using ``planetmint start``,
|
When you start Planetmint Server using ``planetmint start``,
|
||||||
an HTTP API is exposed at some address. The default is:
|
an HTTP API is exposed at some address. The default is:
|
||||||
@ -713,7 +719,7 @@ so you can access it from the same machine,
|
|||||||
but it won't be directly accessible from the outside world.
|
but it won't be directly accessible from the outside world.
|
||||||
(The outside world could connect via a SOCKS proxy or whatnot.)
|
(The outside world could connect via a SOCKS proxy or whatnot.)
|
||||||
|
|
||||||
The documentation about Planetmint Server :doc:`Configuration Settings <../../installation/node-setup/configuration>`
|
The documentation about Planetmint Server :doc:`Configuration Settings <../../node-setup/configuration>`
|
||||||
has a section about how to set ``server.bind`` so as to make
|
has a section about how to set ``server.bind`` so as to make
|
||||||
the HTTP API publicly accessible.
|
the HTTP API publicly accessible.
|
||||||
|
|
||||||
@ -4,9 +4,10 @@ Content-Type: application/json
|
|||||||
{
|
{
|
||||||
"assets": "/assets/",
|
"assets": "/assets/",
|
||||||
"blocks": "/blocks/",
|
"blocks": "/blocks/",
|
||||||
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.2/http-client-server-api.html",
|
"docs": "https://docs.planetmint.io/projects/server/en/v1.0.1/http-client-server-api.html",
|
||||||
"metadata": "/metadata/",
|
"metadata": "/metadata/",
|
||||||
"outputs": "/outputs/",
|
"outputs": "/outputs/",
|
||||||
|
"streamedblocks": "ws://localhost:9985/api/v1/streams/valid_blocks",
|
||||||
"streams": "ws://localhost:9985/api/v1/streams/valid_transactions",
|
"streams": "ws://localhost:9985/api/v1/streams/valid_transactions",
|
||||||
"transactions": "/transactions/",
|
"transactions": "/transactions/",
|
||||||
"validators": "/validators"
|
"validators": "/validators"
|
||||||
@ -6,15 +6,16 @@ Content-Type: application/json
|
|||||||
"v1": {
|
"v1": {
|
||||||
"assets": "/api/v1/assets/",
|
"assets": "/api/v1/assets/",
|
||||||
"blocks": "/api/v1/blocks/",
|
"blocks": "/api/v1/blocks/",
|
||||||
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.2/http-client-server-api.html",
|
"docs": "https://docs.planetmint.io/projects/server/en/v1.0.1/http-client-server-api.html",
|
||||||
"metadata": "/api/v1/metadata/",
|
"metadata": "/api/v1/metadata/",
|
||||||
"outputs": "/api/v1/outputs/",
|
"outputs": "/api/v1/outputs/",
|
||||||
|
"streamedblocks": "ws://localhost:9985/api/v1/streams/valid_blocks",
|
||||||
"streams": "ws://localhost:9985/api/v1/streams/valid_transactions",
|
"streams": "ws://localhost:9985/api/v1/streams/valid_transactions",
|
||||||
"transactions": "/api/v1/transactions/",
|
"transactions": "/api/v1/transactions/",
|
||||||
"validators": "/api/v1/validators"
|
"validators": "/api/v1/validators"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.2/",
|
"docs": "https://docs.planetmint.io/projects/server/en/v1.0.1/",
|
||||||
"software": "Planetmint",
|
"software": "Planetmint",
|
||||||
"version": "0.9.2"
|
"version": "1.0.1"
|
||||||
}
|
}
|
||||||
23
docs/root/source/connecting/index.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
.. Copyright © 2020 Interplanetary Database Association e.V.,
|
||||||
|
Planetmint 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
|
||||||
|
|
||||||
|
Connecting to Planetmint
|
||||||
|
########################
|
||||||
|
|
||||||
|
Planetmint enables you to connect to it via variaous ways:
|
||||||
|
|
||||||
|
* Bindings or drivers for varioues languages exist
|
||||||
|
* RESTful APIs and direct database queries
|
||||||
|
|
||||||
|
Details are listed below.
|
||||||
|
|
||||||
|
.. include:: drivers.rst
|
||||||
|
.. include:: http-client-server-api.rst
|
||||||
|
.. include:: websocket-event-stream-api.rst
|
||||||
|
.. include:: query.rst
|
||||||
|
.. .. include:: api/index.rst
|
||||||
|
.. .. include:: commands-and-backend/index.rst
|
||||||
|
|
||||||
@ -4,14 +4,15 @@
|
|||||||
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||||
Code is Apache-2.0 and docs are CC-BY-4.0
|
Code is Apache-2.0 and docs are CC-BY-4.0
|
||||||
|
|
||||||
Queries in Planetmint
|
Database Queries
|
||||||
=====================
|
******************
|
||||||
|
|
||||||
A node operator can use the full power of MongoDB's query engine to search and query all stored data, including all transactions, assets and metadata.
|
A node operator can use the full power of MongoDB's query engine to search and query all stored data, including all transactions, assets and metadata.
|
||||||
The node operator can decide for themselves how much of that query power they expose to external users.
|
The node operator can decide for themselves how much of that query power they expose to external users.
|
||||||
|
|
||||||
Blog Post with Example Queries
|
Querying MongoDB
|
||||||
------------------------------
|
==============================
|
||||||
|
|
||||||
|
|
||||||
We wrote a blog post in The Planetmint Blog to show
|
We wrote a blog post in The Planetmint Blog to show
|
||||||
how to use some MongoDB tools to query a Planetmint node's MongoDB database.
|
how to use some MongoDB tools to query a Planetmint node's MongoDB database.
|
||||||
@ -22,6 +23,7 @@ about custom cars and their ownership histories.
|
|||||||
How to Connect to MongoDB
|
How to Connect to MongoDB
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
||||||
Before you can query a MongoDB database, you must connect to it, and to do that, you need to know its hostname and port.
|
Before you can query a MongoDB database, you must connect to it, and to do that, you need to know its hostname and port.
|
||||||
|
|
||||||
If you're running a Planetmint node on your local machine (e.g. for dev and test), then the hostname should be ``localhost`` and the port should be ``27017``, unless you did something to change those values. If you're running a Planetmint node on a remote machine and you can SSH to that machine, then the same is true.
|
If you're running a Planetmint node on your local machine (e.g. for dev and test), then the hostname should be ``localhost`` and the port should be ``27017``, unless you did something to change those values. If you're running a Planetmint node on a remote machine and you can SSH to that machine, then the same is true.
|
||||||
@ -31,6 +33,7 @@ If you're running a Planetmint node on a remote machine and you configured its M
|
|||||||
How to Query
|
How to Query
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
||||||
A Planetmint node operator has full access to their local MongoDB instance, so they can use any of MongoDB's APIs for running queries, including:
|
A Planetmint node operator has full access to their local MongoDB instance, so they can use any of MongoDB's APIs for running queries, including:
|
||||||
|
|
||||||
- `the Mongo Shell <https://docs.mongodb.com/manual/mongo/>`_,
|
- `the Mongo Shell <https://docs.mongodb.com/manual/mongo/>`_,
|
||||||
@ -6,8 +6,9 @@
|
|||||||
|
|
||||||
.. _the-websocket-event-stream-api:
|
.. _the-websocket-event-stream-api:
|
||||||
|
|
||||||
The WebSocket Event Stream API
|
WebSocket Event Stream API
|
||||||
==============================
|
******************************
|
||||||
|
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
The WebSocket Event Stream runs on a different port than the Web API. The
|
The WebSocket Event Stream runs on a different port than the Web API. The
|
||||||
@ -21,18 +22,20 @@ to notify you as events occur, such as new `valid transactions <#valid-transacti
|
|||||||
|
|
||||||
|
|
||||||
Demoing the API
|
Demoing the API
|
||||||
---------------
|
===============
|
||||||
|
|
||||||
|
|
||||||
You may be interested in demoing the Event Stream API with the `WebSocket echo test <http://websocket.org/echo.html>`_
|
You may be interested in demoing the Event Stream API with the `WebSocket echo test <http://websocket.org/echo.html>`_
|
||||||
to familiarize yourself before attempting an integration.
|
to familiarize yourself before attempting an integration.
|
||||||
|
|
||||||
|
|
||||||
Determining Support for the Event Stream API
|
Determining Support for the Event Stream API
|
||||||
--------------------------------------------
|
============================================
|
||||||
|
|
||||||
|
|
||||||
It's a good idea to make sure that the node you're connecting with
|
It's a good idea to make sure that the node you're connecting with
|
||||||
has advertised support for the Event Stream API. To do so, send a HTTP GET
|
has advertised support for the Event Stream API. To do so, send a HTTP GET
|
||||||
request to the node's :ref:`api-root-endpoint`
|
request to the node's `API root endpoint`_
|
||||||
(e.g. ``http://localhost:9984/api/v1/``) and check that the
|
(e.g. ``http://localhost:9984/api/v1/``) and check that the
|
||||||
response contains a ``streams`` property:
|
response contains a ``streams`` property:
|
||||||
|
|
||||||
@ -46,7 +49,8 @@ response contains a ``streams`` property:
|
|||||||
|
|
||||||
|
|
||||||
Connection Keep-Alive
|
Connection Keep-Alive
|
||||||
---------------------
|
=====================
|
||||||
|
|
||||||
|
|
||||||
The Event Stream API supports Ping/Pong frames as descibed in
|
The Event Stream API supports Ping/Pong frames as descibed in
|
||||||
`RFC 6455 <https://tools.ietf.org/html/rfc6455#section-5.5.2>`_.
|
`RFC 6455 <https://tools.ietf.org/html/rfc6455#section-5.5.2>`_.
|
||||||
@ -58,7 +62,8 @@ The Event Stream API supports Ping/Pong frames as descibed in
|
|||||||
same.
|
same.
|
||||||
|
|
||||||
Streams
|
Streams
|
||||||
-------
|
=======
|
||||||
|
|
||||||
|
|
||||||
Each stream is meant as a unidirectional communication channel, where the
|
Each stream is meant as a unidirectional communication channel, where the
|
||||||
Planetmint node is the only party sending messages. Any messages sent to the
|
Planetmint node is the only party sending messages. Any messages sent to the
|
||||||
@ -85,7 +90,8 @@ All messages sent in a stream are in the JSON format.
|
|||||||
API, consider creating a new `BEP <https://github.com/planetmint/BEPs>`_.
|
API, consider creating a new `BEP <https://github.com/planetmint/BEPs>`_.
|
||||||
|
|
||||||
Valid Transactions
|
Valid Transactions
|
||||||
~~~~~~~~~~~~~~~~~~
|
==================
|
||||||
|
|
||||||
|
|
||||||
``/valid_transactions``
|
``/valid_transactions``
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ This Code of Conduct applies both within project spaces and in public spaces
|
|||||||
when an individual is representing the project or its community.
|
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
|
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@planetmint.com](mailto:contact@planetmint.com). All
|
reported by contacting a project maintainer at [mail@planetmint.io](mailto:mail@planetmint.io). All
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
is appropriate to the circumstances. Maintainers are
|
is appropriate to the circumstances. Maintainers are
|
||||||
obligated to maintain confidentiality with regard to the reporter of an
|
obligated to maintain confidentiality with regard to the reporter of an
|
||||||
|
|||||||
@ -82,11 +82,11 @@ x = 'name: {}; score: {}'.format(name, n)
|
|||||||
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
|
we use the `format()` version. The [official Python documentation says](https://docs.python.org/2/library/stdtypes.html#str.format), "This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code."
|
||||||
|
|
||||||
|
|
||||||
## Running the Flake8 Style Checker
|
## Running the Black Style Checker
|
||||||
|
|
||||||
We use [Flake8](http://flake8.pycqa.org/en/latest/index.html) to check our Python code style. Once you have it installed, you can run it using:
|
We use [Black](https://black.readthedocs.io/en/stable/) to check our Python code style. Once you have it installed, you can run it using:
|
||||||
```text
|
```text
|
||||||
flake8 --max-line-length 119 planetmint/
|
black --check -l 119 .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -99,8 +99,7 @@ $ bash stack.sh -h
|
|||||||
ENV[TM_VERSION]
|
ENV[TM_VERSION]
|
||||||
(Optional) Tendermint version to use for the setup. (default: 0.22.8)
|
(Optional) Tendermint version to use for the setup. (default: 0.22.8)
|
||||||
|
|
||||||
ENV[MONGO_VERSION]
|
|
||||||
(Optional) MongoDB version to use with the setup. (default: 3.6)
|
|
||||||
|
|
||||||
ENV[AZURE_CLIENT_ID]
|
ENV[AZURE_CLIENT_ID]
|
||||||
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
|
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
|
||||||
@ -181,8 +180,6 @@ $ export STACK_BRANCH=master
|
|||||||
#Optional, since 0.22.8 is the default tendermint version.
|
#Optional, since 0.22.8 is the default tendermint version.
|
||||||
$ export TM_VERSION=0.22.8
|
$ export TM_VERSION=0.22.8
|
||||||
|
|
||||||
#Optional, since 3.6 is the default MongoDB version.
|
|
||||||
$ export MONGO_VERSION=3.6
|
|
||||||
|
|
||||||
$ bash stack.sh
|
$ bash stack.sh
|
||||||
```
|
```
|
||||||
@ -232,8 +229,7 @@ $ export STACK_BRANCH=master
|
|||||||
#Optional, since 0.22.8 is the default tendermint version
|
#Optional, since 0.22.8 is the default tendermint version
|
||||||
$ export TM_VERSION=0.22.8
|
$ export TM_VERSION=0.22.8
|
||||||
|
|
||||||
#Optional, since 3.6 is the default MongoDB version.
|
|
||||||
$ export MONGO_VERSION=3.6
|
|
||||||
|
|
||||||
$ bash stack.sh
|
$ bash stack.sh
|
||||||
```
|
```
|
||||||
|
|||||||
@ -11,16 +11,16 @@ The following doc describes how to run a local node for developing Planetmint Te
|
|||||||
|
|
||||||
There are two crucial dependencies required to start a local node:
|
There are two crucial dependencies required to start a local node:
|
||||||
|
|
||||||
- MongoDB
|
- Tarantool
|
||||||
- Tendermint
|
- Tendermint
|
||||||
|
|
||||||
and of course you also need to install Planetmint Sever from the local code you just developed.
|
and of course you also need to install Planetmint Sever from the local code you just developed.
|
||||||
|
|
||||||
## Install and Run MongoDB
|
## Install and Run Tarantool
|
||||||
|
|
||||||
MongoDB can be easily installed, just refer to their [installation documentation](https://docs.mongodb.com/manual/installation/) for your distro.
|
Tarantool can be easily installed, just refer to their [installation documentation](https://www.tarantool.io/en/download/os-installation/ubuntu/) for your distro.
|
||||||
We know MongoDB 3.4 and 3.6 work with Planetmint.
|
We know Tarantool 2.8 work with Planetmint.
|
||||||
After the installation of MongoDB is complete, run MongoDB using `sudo mongod`
|
After the installation of Tarantool is complete, run Tarantool using `tarantool` and to create a listener `box.cfg{listen=3301}` in cli of Tarantool.
|
||||||
|
|
||||||
## Install and Run Tendermint
|
## Install and Run Tendermint
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ To execute tests when developing a feature or fixing a bug one could use the fol
|
|||||||
$ pytest -v
|
$ pytest -v
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: MongoDB and Tendermint should be running as discussed above.
|
NOTE: Tarantool and Tendermint should be running as discussed above.
|
||||||
|
|
||||||
One could mark a specific test and execute the same by appending `-m my_mark` to the above command.
|
One could mark a specific test and execute the same by appending `-m my_mark` to the above command.
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ $ docker-compose up -d bdb
|
|||||||
|
|
||||||
The above command will launch all 3 main required services/processes:
|
The above command will launch all 3 main required services/processes:
|
||||||
|
|
||||||
* ``mongodb``
|
* ``tarantool``
|
||||||
* ``tendermint``
|
* ``tendermint``
|
||||||
* ``planetmint``
|
* ``planetmint``
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ To follow the logs of the ``planetmint`` service:
|
|||||||
$ docker-compose logs -f planetmint
|
$ docker-compose logs -f planetmint
|
||||||
```
|
```
|
||||||
|
|
||||||
To follow the logs of the ``mongodb`` service:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker-compose logs -f mdb
|
$ docker-compose logs -f mdb
|
||||||
|
|||||||
@ -12,7 +12,7 @@ Know What You Want to Write Code to Do
|
|||||||
|
|
||||||
Do you want to write code to resolve an open issue (bug)? Which one?
|
Do you want to write code to resolve an open issue (bug)? Which one?
|
||||||
|
|
||||||
Do you want to implement a Planetmint Enhancement Proposal (PEP)? Which one?
|
Do you want to implement a Planetmint Refinement Proposal (PRP)? Which one?
|
||||||
|
|
||||||
You should know why you want to write code before you go any farther.
|
You should know why you want to write code before you go any farther.
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ Refresh Yourself about the C4 Process
|
|||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
C4 is the Collective Code Construction Contract. It's quite short:
|
C4 is the Collective Code Construction Contract. It's quite short:
|
||||||
`re-reading it will only take a few minutes <https://github.com/planetmint/BEPs/tree/master/1>`_.
|
`re-reading it will only take a few minutes <https://github.com/bigchaindb/BEPs/tree/master/1>`_.
|
||||||
|
|
||||||
|
|
||||||
Set Up Your Local Machine. Here's How.
|
Set Up Your Local Machine. Here's How.
|
||||||
@ -69,7 +69,7 @@ Set Up Your Local Machine. Here's How.
|
|||||||
Before You Start Writing Code
|
Before You Start Writing Code
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
Read `BEP-24 <https://github.com/planetmint/BEPs/tree/master/24>`_
|
Read `BEP-24 <https://github.com/bigchaindb/BEPs/tree/master/24>`_
|
||||||
so you know what to do to ensure that your changes (i.e. your future pull request) can be merged.
|
so you know what to do to ensure that your changes (i.e. your future pull request) can be merged.
|
||||||
It's easy and will save you some hassle later on.
|
It's easy and will save you some hassle later on.
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ It includes several sub-projects.
|
|||||||
- `Planetmint Java Driver <https://github.com/planetmint/java-bigchaindb-driver>`_
|
- `Planetmint Java Driver <https://github.com/planetmint/java-bigchaindb-driver>`_
|
||||||
- `cryptoconditions <https://github.com/planetmint/cryptoconditions>`_ (a Python package by us)
|
- `cryptoconditions <https://github.com/planetmint/cryptoconditions>`_ (a Python package by us)
|
||||||
- `py-abci <https://github.com/davebryson/py-abci>`_ (a Python package we use)
|
- `py-abci <https://github.com/davebryson/py-abci>`_ (a Python package we use)
|
||||||
- `Planetmint Enhancement Proposals (PEPs) <https://github.com/planetmint/PEPs>`_
|
- `Planetmint Refinement Proposals (PRPs) <https://github.com/planetmint/PRPs>`_
|
||||||
|
|
||||||
Contents
|
Contents
|
||||||
--------
|
--------
|
||||||
|
|||||||