You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
1 year ago | |
---|---|---|
blok | 1 year ago | |
tests | 1 year ago | |
.gitignore | 1 year ago | |
.pre-commit-config.yaml | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
poetry.lock | 1 year ago | |
pyproject.toml | 1 year ago |
README.md
BLOK
A simple Blockchain implementation written in Python.
┌───────────────────────────────────────┐
│ BLOCKCHAIN │
├───────────────────────────────────────┤
┌────┤► chain: List[BLOCK] │
│ │ │
│ │ new_transactions: List[TRANSACTION] ◄├───────────────────────┐
│ │ │ │
│ │ nodes: List[ADDRESS] ◄├────┐ │
│ └───────────────────────────────────────┘ │ │
│ │ │
│ ┌───────────────────────────────────┐ ┌────┴──────────────┐ │
└────┤ BLOCK │ │ ADDRESS: String │ │
├───────────────────────────────────┤ └───────────────────┘ │
│ index: Integer │ │
│ │ ┌─────────────────────┐ │
│ proof: Integer │ ┌─┤ TRANSACTION ├─┘
│ │ │ ├─────────────────────┤
│ previous_hash: String │ │ │ sender: String │
│ │ │ │ │
│ transactions: List[TRANSACTION] ◄├─┘ │ recipient: String │
└───────────────────────────────────┘ │ │
│ amount: Integer │
└─────────────────────┘
Installation
$ pip install poetry
$ poetry install
To run unit tests:
$ poetry run coverage run -m pytest
$ poetry run coverage report -m
To run the blockchain server:
$ poetry run python -m blok.main --debug=true
Code Quality
$ poetry run pre-commit install
$ poetry run pre-commit run --all-files
Sources
The best source for me was the blockchain course series in Coursera.
I took advantage of this article.