Skip to content
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
2 changes: 1 addition & 1 deletion backend/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
blockchain = Blockchain()
wallet = Wallet(blockchain)
transaction_pool = TransactionPool()
pubsub = PubSub(blockchain, transaction_pool)
pubsub = PubSub(blockchain, transaction_pool, wallet)

@app.route('/')
def route_default():
Expand Down
3 changes: 2 additions & 1 deletion backend/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class PubSub():
Handles the publish/subscribe layer of the application.
Provides communication between the nodes of the blockchain network.
"""
def __init__(self, blockchain, transaction_pool):
def __init__(self, blockchain, transaction_pool, wallet):
pnconfig.user_id = wallet.id
self.pubnub = PubNub(pnconfig)
self.pubnub.subscribe().channels(CHANNELS.values()).execute()
self.pubnub.add_listener(Listener(blockchain, transaction_pool))
Expand Down
3 changes: 2 additions & 1 deletion backend/wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Wallet:
"""
def __init__(self, blockchain=None):
self.blockchain = blockchain
self.address = str(uuid.uuid4())[0:8]
self.id = str(uuid.uuid4())
self.address = self.id[0:8]
self.private_key = ec.generate_private_key(
ec.SECP256K1(),
default_backend()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pytest==5.1.2
Flask==1.1.1
pubnub==4.1.6
pubnub==7.3.0
requests==2.22.0
cryptography==2.7
Flask-Cors==3.0.8