Bitpy – compiled!

Bitpy – compiled!

You can now download and run a compiled version of Bitpy (Bitpy0.0.1.exe) from mega.nz. Just download it from this link. Or you can copy and paste the link in your browser: https://mega.nz/#!kEMF2bpS!qkXPZBh4BPtaoA9bHz9WIeInE9VaU5QF9EY4XgB35sw   Please note that the code and program are intended for educational purposes only. Don’t use with any sensitive device or as a real live Bitcoin client.

Transaction part one – The misconceptions about the block chain

Transaction part one – The misconceptions about the block chain

Three levels of abstractification. The are three level to understand the way the Bitcoin block chain works. In the first level, we got those who just heard about Bitcoin for the first time. People usually thinks that the coins are just associated with the Bitcoin address. Whenever Alice sends Bob coins, she just place a statement (or transaction) in the block chain specifying that the X coins that were associated with Alice address, should now be associated with Bob address. This is of course wrong…

Read More Read More

Keys, addresses and hashing

Keys, addresses and hashing

A key pair is one of the greatest tools that are used in Bitcoin, but it might be a little unintuitive at first. Don’t worry, you’ll get it! There’s also a short video I made a few months ago that describes the basics of keys. It doesn’t completely corresponds to our current project, but it might provide you with another point of reference. You can watch it over here – Bitcoin python tutorial for beginners – keys and address.   One way function The name “one…

Read More Read More

Connection part three – Receiving messages

Connection part three – Receiving messages

In the previous posts, all that we’ve done was to construct and send messages to another node on the network. In this post, we’ll see what happens to incoming messages. First stop – The ReceiverManager: class ReceiverManager(Thread): def __init__(self, sock): Thread.__init__(self) self.sendingQueue = Utils.globals.sendingQueue self.sock = sock self.ping = “” self.outfile = open(“data_received_from_node.txt”, ‘w’) def run(self): while True: try: # get only the header’s message header = self.sock.recv(24) if len(header) <= 0: raise Exception(“Node disconnected (received 0bit length message)”) headerStream = BytesIO(header)…

Read More Read More

User interface

User interface

The best way to make our code really useful is to add user interface to it. There is a lot of this that can only be taught and understood by looking at the code itself, bu there are also many things that the average user can learn about the Bitcoin protocol that can be explained in a more “human friendly” way. An that is way Alexis and I have decided to add a Graphical User Interface (GUI) to our project…

Read More Read More

Pivot number one – Python 2.7 to 3.5

Pivot number one – Python 2.7 to 3.5

Why did we migrated from Python 2.7 to Python 3.5? After many discussions and long conversations Alexis and I decided that we should use Python 3. I can’t really point on the exact reason that made us agreed on this change, but I guess the parse_ip bug (As described over here) was the real catalysis. We’ve spent so much time fixing something that worked just fine in python 3. We just snapped, and decided to bite our lips and make…

Read More Read More

Messages part three – Ping Pong and VerAck

Messages part three – Ping Pong and VerAck

VerAck When establishing connection, we first need to send a version message to the node we wish to connect to. But keeping our connection alive will require the use of 3 more messages: ping, pong and VerAck. The VerAck message is the most simple type of message, it’s basically an empty message, it has no payload, only a header. Alexis and I have decided that any type of message will have its own file to construct and parse its payload,…

Read More Read More

Messages part two – Payloads and version message

Messages part two – Payloads and version message

In the previous posts we’ve talked a little bit about messages. We know that a message is nothing more than a string of bytes, it has an header and a body (payload), and it must maintain its predefined format. We’ve seen the format of the header, but every message body (payload) will contain different information, according to the message type. We’ll start by constructing the “version” message. The version message is used when trying to establish a connection with the remote…

Read More Read More

Messages part one – constructing the message and headers

Messages part one – constructing the message and headers

Communication in the Bitcoin network is done via messages.  A message is no more than just a string of bytes. This is an example of a simple “ping” message: f9beb4d970696e670000000000000000080000001b3cb220309941550a2ffd5c # The full message. Header + Payload The Bitcoin protocol describes how each message should be packet. It is highly important to make sure that you construct the message in the right format. The machine on the other side will expect to receive a very specific format and it won’t be able…

Read More Read More