Author SHA1 Message Date
marc 0fdb646e39 new requirements.txt 2022-02-23 22:29:33 +01:00
marc 269658d9d8 update requirements.txt 2022-02-23 22:24:12 +01:00
marc 6f9191fd38 no trailing lines 2022-02-23 22:18:31 +01:00
marc 5e8a2d80c4 fix bad makefile 2022-02-23 22:17:22 +01:00
marc e7599ce757 few make methods 2022-02-23 22:12:31 +01:00
3 changed files with 27 additions and 7 deletions
+9
View File
@@ -0,0 +1,9 @@
start:
./app.py -p 8000
update:
pipenv update
pipenv lock -r > requirements.txt
build: update
docker-compose build node
push: build
docker-compose push node
-6
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env python
"""Block chain according to me."""
import hashlib
from time import time
@@ -11,7 +10,6 @@ DIFFICULTY = 4
class Block:
"""Block according to me."""
def __init__(self, index, timestamp, transactions, previous_hash, proof):
self.index = index
self.timestamp = timestamp
@@ -21,7 +19,6 @@ class Block:
self.hash = self.hash()
def hash(self):
"""Hash a block using sha256."""
data = self.__dict__
data["transactions"] = [t.__dict__ for t in self.transactions]
block_string = json.dumps(data, sort_keys=True).encode()
@@ -32,19 +29,16 @@ class Block:
class Transaction:
"""Transaction of Samy coin."""
def __init__(self, sender, recipient, amount):
self.sender = sender
self.recipient = recipient
self.amount = amount
def __str__(self):
"""String representation of a transaction."""
return f"FROM: {self.sender} TO: {self.recipient} AMOUNT: {self.amount}"
class Blockchain:
"""Blockchain"""
def __init__(self):
self.blocks = []
self.blocks.append(self.create_first_block())
+18 -1
View File
@@ -1,2 +1,19 @@
Flask==2.0.2
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#
-i https://pypi.org/simple
certifi==2021.10.8
charset-normalizer==2.0.12; python_version >= '3'
click==8.0.4; python_version >= '3.6'
flask==2.0.2
idna==3.3; python_version >= '3'
itsdangerous==2.1.0; python_version >= '3.7'
jinja2==3.0.3; python_version >= '3.6'
markupsafe==2.1.0; python_version >= '3.7'
requests==2.27.1
urllib3==1.26.8; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
werkzeug==2.0.3; python_version >= '3.6'