-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart_node.py
More file actions
31 lines (23 loc) · 830 Bytes
/
Copy pathstart_node.py
File metadata and controls
31 lines (23 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask, jsonify, request, render_template
import block
import node
import wallet
import transaction
import json
import requests
app = Flask(__name__)
# This node private IP Address
MY_ADDRESS = '192.168.0.3' # TODO: This changes dynamically
# Bootstrap node address (we suppose it is known to everyone)
SERVER_ADDRESS = '127.0.0.1'
def setup_regular_node():
# Create node and associate with VM via address
myNode = node.Node(0, MY_ADDRESS)
print(myNode)
# Our node sends it's publik key (= wallet address = MY_ADDRESS ? )
# and receives a unique id (0..NETWORK_SIZE)
print('http://' + SERVER_ADDRESS + ':5000/add_to_ring')
r = requests.post('http://' + SERVER_ADDRESS + ':5000/add_to_ring', data = {'public_key':MY_ADDRESS})
print(r)
print(r.text)
setup_regular_node()