A simple Blockchain implemented in Python
Go to file
Pavle Portic 624a205a85
Refactor and new features
- Remove csharp and js implementations
- Add multiprocessed mining
- Add balance querying
2020-02-04 13:41:15 +01:00
blockchain Refactor and new features 2020-02-04 13:41:15 +01:00
tests Preliminary Tests 2017-11-12 16:05:13 -05:00
.gitignore Added js blockchain class 2019-05-07 11:44:44 -04:00
Dockerfile Refactor and new features 2020-02-04 13:41:15 +01:00
LICENSE Initial commit 2017-09-24 15:36:36 -04:00
README.md Update README.md 2018-10-13 13:17:05 -04:00
docker-compose.yml Refactor and new features 2020-02-04 13:41:15 +01:00
init Refactor and new features 2020-02-04 13:41:15 +01:00
poetry.lock Refactor and new features 2020-02-04 13:41:15 +01:00
pyproject.toml Refactor and new features 2020-02-04 13:41:15 +01:00
requirements.txt Refactor and new features 2020-02-04 13:41:15 +01:00
run.py Refactor and new features 2020-02-04 13:41:15 +01:00

README.md

Learn Blockchains by Building One

Build Status

This is the source code for my post on Building a Blockchain.

Installation

  1. Make sure Python 3.6+ is installed.
  2. Install pipenv.
$ pip install pipenv 
  1. Install requirements
$ pipenv install 
  1. Run the server:
    • $ pipenv run python blockchain.py
    • $ pipenv run python blockchain.py -p 5001
    • $ pipenv run python blockchain.py --port 5002

Docker

Another option for running this blockchain program is to use Docker. Follow the instructions below to create a local Docker container:

  1. Clone this repository
  2. Build the docker container
$ docker build -t blockchain .
  1. Run the container
$ docker run --rm -p 80:5000 blockchain
  1. To add more instances, vary the public port number before the colon:
$ docker run --rm -p 81:5000 blockchain
$ docker run --rm -p 82:5000 blockchain
$ docker run --rm -p 83:5000 blockchain

Installation (C# Implementation)

  1. Install a free copy of Visual Studio IDE (Community Edition): https://www.visualstudio.com/vs/

  2. Once installed, open the solution file (BlockChain.sln) using the File > Open > Project/Solution menu options within Visual Studio.

  3. From within the "Solution Explorer", right click the BlockChain.Console project and select the "Set As Startup Project" option.

  4. Click the "Start" button, or hit F5 to run. The program executes in a console window, and is controlled via HTTP with the same commands as the Python version.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.