January 2019
Beginner to intermediate
372 pages
11h 17m
English
Although each node has two handlers, one each for the HTTP and WebSocket interfaces. A single web server application instance is sufficient to serve both of them. Sanic uses uvloop as a scheduler. It asynchronously handles the requests:
if __name__ == '__main__':
server = Server()
server.app.add_task(server.connect_to_peers(initialPeers))
server.app.run(host='0.0.0.0', port=port, debug=True)
The server application is instantiated, and a task is created to connect the node to initialPeers, which is hardcoded by each node. The application will use the default port to create a web server.
Each node will run the server application to join the network. As soon as the node connects to one of the peers, its blockchain ...
Read now
Unlock full access