Skip to content

BlockchainCharlotte/blockchain

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn Blockchains by Building One

This is the source code for Daniel van Flymen's post on Building a Blockchain.

The Blockchain Charlotte devs are planning on using this fork as a learning tool and extending the functionality to further match production worthy blockchains. Please open an issue with anything that you may want to implement or see implemented as part of the meetup group.

Installation

  1. Make sure you have Python 3.6 installed
  2. Setup a virtual environment using the method of your choice. (direnv, virtualenv, pipenv, etc...)
  3. Activate environment
  4. Install requirements
$ pip install -r requirements.txt
  1. Run the server:
$ python blockchain.py

Pipenv

  1. Make sure Python 3.6+ is installed.
  2. Install pipenv.
$ pip install pipenv 

if you have Python version >3 then run below command to install pipenv

$ pip3 install pipenv 
  1. Create a virtual environment and specify the Python version to use.
$ pipenv --python=python3.6

Note: if you get an error here, try replacing 'python3.6' with the full path to your python executable.

  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. (Note: all you need is the Dockerfile.)
  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

Contributing

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

About

A simple Blockchain in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%