Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move python code to its own directory; split api from core blockchain… #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 0 additions & 109 deletions Pipfile.lock

This file was deleted.

16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This is the source code for my post on [Building a Blockchain](https://medium.co

## Installation

### Python

1. Make sure [Python 3.6+](https://www.python.org/downloads/) is installed.
2. Install [pipenv](https://github.com/kennethreitz/pipenv).

Expand All @@ -18,11 +20,11 @@ $ pipenv install
```

4. Run the server:
* `$ pipenv run python blockchain.py`
* `$ pipenv run python blockchain.py -p 5001`
* `$ pipenv run python blockchain.py --port 5002`
* `$ pipenv run python api.py`
* `$ pipenv run python api.py -p 5001`
* `$ pipenv run python api.py --port 5002`

## Docker
#### Docker

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

Expand All @@ -47,18 +49,14 @@ $ docker run --rm -p 82:5000 blockchain
$ docker run --rm -p 83:5000 blockchain
```

## Installation (C# Implementation)
### C#

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.
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml → python/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
language: python

python:
- 3.6
- 3.9
- nightly

install:
- pip install pipenv
- pipenv install --dev

script:
- pipenv run python -m unittest
- pipenv run python -m unittest
5 changes: 3 additions & 2 deletions Dockerfile → python/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6-alpine
FROM python:3.9-alpine

WORKDIR /app

Expand All @@ -9,7 +9,8 @@ RUN cd /app && \

# Add actual source code.
ADD blockchain.py /app
ADD api.py /app

EXPOSE 5000

CMD ["python", "blockchain.py", "--port", "5000"]
CMD ["python", "api.py", "--port", "5000"]
7 changes: 3 additions & 4 deletions Pipfile → python/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ name = "pypi"
[dev-packages]

[requires]
python_version = "3.6"
python_version = "3.9"

[packages]

flask = "==0.12.2"
requests = "==2.18.4"

flask = "latest"
requests = "latest"
138 changes: 138 additions & 0 deletions python/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading