This repository implements the whole DECODEproject's Petition Pilot over the Sawtooth blockchain distributed by the Linux Foundation's Hyperledger consortium.
To facilitate the creation of transaction families based on Zenroom VM and the Zencode human-friendly language for smart-contracts, this TP uses the Sawtooth SDK in Python and the zenroom-py bindings.
To run the http server locally, you need an ASGI server like hypercorn or uvicorn.
Also a python virtual environment with all the library dependencies is needed, follow the following instruction to set it up:
python3 -m venv venv
this creates a virtual environment inside the venv
folder
source ./venv/bin/activate
this activate the virtual environment you'll see a prefix (venv)
on your PS1 prompt.
From now on the libraries you install goes into that folder and are not system
wide and doesn't mess up things.
pip install --upgrade pip
pip install -e .
This upgrades the pip
(package installer for python) to the latest version,
and installs all the python dependencies for the petition-tp-python
package.
pip install fastapi[all]
pip install hypercorn
This install the ASGI server into your virtual environment and the other needed dependencies to run the server
hypercorn src.tp.server.main:app
This runs the server on the 8000
port.
To see the OpenAPI (former SwaggerUI) head to http://localhost:8000/docs
to run the middleware some variable environment are needed, or you can use a
dotenv (a file called .env
in the ro
8000
ot of the project) with the following
content:
export JWT_ALGORITHM=HS256
export JWT_TOKEN_SUBJECT=access
export JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30
export JWT_USERNAME=demo
export JWT_PASSWORD=demo
export JWT_RANDOM_SECRET=change_me_with_a_very_long_hex_string
the username and paswword are the ones used within the OpenAPI ui
docker-compose up --build
To run a transaction
docker exec -it petition-tp petition --help
shows you all the commands available of the little petition
CLI interface
docker exec -it petition-tp petition create --help
docker exec -it petition-tp petition sign --help
docker exec -it petition-tp petition show --help
docker exec -it petition-tp petition tally --help
docker exec -it petition-tp petition count --help
Configuration are passed along ENV variables or .dotenv files, the available variables are:
SAWTOOTH_VALIDATOR_ENDPOINT
SAWTOOTH_REST_ENDPOINT
Copyright π― 2019 by Dyne.org foundation, Amsterdam
Designed, written and maintained by Puria Nafisi Azizi.
This project is receiving funding from the European Unionβs Horizon 2020 research and innovation programme under grant agreement nr. 732546 (DECODE).
Please first take a look at the Dyne.org - Contributor License Agreement then
- π FORK IT
- Create your feature branch
git checkout -b feature/branch
- Commit your changes
git commit -am 'Add some fooBar'
- Push to the branch
git push origin feature/branch
- Create a new Pull Request
- π Thank you
Petition TP, Transaction processor for Decode Petition over sawtooth
Copyright (c) 2019 Dyne.org foundation, Amsterdam
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.