goedev
/
blok
Archived
1
0
Fork 0
A simple blockchain implementation written in Python
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
Gökmen Görgen aa80b23779 Merge remote-tracking branch 'origin/main' into main 1 year ago
blok all tests are OK now. 1 year ago
tests all tests are OK now. 1 year ago
.gitignore initial commit. 1 year ago
.pre-commit-config.yaml add new pre-commit. 1 year ago
LICENSE add license. 1 year ago
README.md Update README.md 1 year ago
poetry.lock all tests are OK now. 1 year ago
pyproject.toml make isort config black-compatible. 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.