blockchain-book's Issues
error on windows "No module named:structLog"
This is the error i get when I put: python node.py:
Traceback (most recent call last):
File "C:\Users\marce\blockchain-book\chapters\chapter_7\node.py", line 3, in
from funcoin.blockchain import Blockchain
File "C:\Users\marce\blockchain-book\chapters\chapter_7\funcoin\blockchain.py", line 8, in
import structlog
ModuleNotFoundError: No module named 'structlog'
Return no module name "Funcoin"
When I execute messages.py, the funcoin.schema return error. Is this a typo or what dependencies or package I should install?
Information about connection node
Dear Daniel val Flymen,
i read you book and is fantastic, i buyed in paper and in kindle version. I had make all step in your book, i'm blocking to comunicate node by node. The first node is start and is in listening, my ask is: how do i get more nodes to communicate? i start the genesis block, but how do i hook the miners to the pool? how can i continue the started project? I would like to store the blocks locally in order to create the decentralized blockchain, how do I do it? could you help me with this? i'll wait than your kind reply, I offer you my best regards.
Hashes - Random?
I realize I'm being a bit picky here, but hashes are not random; they are absolutely deterministic. On page 17 (and other places), the author states that a hash provides a "unique, random value." "Unique" is mostly true (except in the very unlikely event of a collision), but "random" is not. It may look random, but it isn't; as the author states in the very same paragraph, "the output is always predictable for the same input." That is the very opposite of random.
In future editions, I would suggest dropping "random" and simply staying with "unique." It gets your point across without adding any "confusion factors."
Initialising p2p_protocol with self.
I got the error stating that handle_message
missing positional argument writer
but writer
is supplied to the function. It seems that handle_message
can't get self
, that is p2p_protocol.
I've changed this section to self.p2p_protocol = p2p_protocol(self)
and it's working as intended. Is this normal or am I missing something?
nonce definition, chapter 4 page 48
Not sure if you are also using this for general book issues and not just code. Very minor issue. I’m pretty sure “nonce” means “number used once” and not “nonsense string”.
Return None
In this part
the code return none all times.
for fix it i remove self.external_ip =
await self.get_external_ip()
Telnet (or the lack thereof)
The echo server example in the Network section uses a telnet client for testing. However, because of security issues, telnet is locked down by most commercial security policies. SSH (with its associated handshaking, complexity, and overhead) is the closest thing available. Would it be possible to have an automated "driver" program that could do this testing that would take up only a few lines of code?
"Messaging Protocol" sent incorrectly
In this piece of code above, the struct for var "message' doesn't have "name"
because in server.py
, it pass different with "meta" and "message"
i'm fix it with:
message = message['message']
handler = message_handlers.get(message["name"])
added this above in line 38 in peers.py
node.py api layer
Hi, is agreat resource the code in this repo, I would like to ask you if is a good aproach to create an api.py file to handle the comunication from a frontend app with the node, I see the method handle_connection->handle_message, so I think i will use handle_message()method to send a message (ping or transaction messages for test this project) in an docker network for see the P2P working and have the nice functionallity from your project https://github.com/dvf/blockchain/blob/68066d648244ce2b7e2d1cbd16f9255363f94712/blockchain.py#L232, im junior using python, but thanks for this repo and some advice for enable functionalities as API
Error in server.py
When starting the node and loading the interface it shows this error.
Task exception was never retrieved
future: <Task finished name='Task-7' coro=<Server.handle_connection() done, defined at C:\Users\de56002\Py\Proyectos\Block\server.py:30> exception=JSONDecodeError('Expecting value: line 1 column 1 (char 0)')>
Traceback (most recent call last):
File "C:\Users\de56002\Py\Proyectos\Block\server.py", line 40, in handle_connection
message = BaseSchema().loads(decoded_data) # <5>
File "C:\Users\de56002\Py\lib\site-packages\marshmallow\schema.py", line 756, in loads
data = self.opts.render_module.loads(json_data, **kwargs)
File "C:\Users\de56002\Py\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\de56002\Py\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\de56002\Py\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
As far as I could tell, it is receiving a String instead of being in JSON format.
Any way to fix it?
Chapter 7: no mining happening?
Going through the chapter 7's code in order to understand how the whole app works, I've been surprised to find out that no mining is actually happening anywhere in the code. There's a method Blockchain.mine_new_block()
but it doesn't seem to be called from anywhere.
The node can:
- Receive a block from another node;
- Receive a transaction and add it to pending transactions list.
But nowhere in the code do we create a new block, apart from the genesis. That's confusing.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.