Our first major decision was how to structure our project. After some considerations we’ve decided to use the following structure.
Bitpy file structure Manager / Network / Packets / control_messages / data_messages / Utils /
Manager folder will contain the UI of the project and the codes that will deal with both incoming and outgoing packets.
Network folder will contain all the files that are required to establish and maintain connection with the network.
Packets This is where we’re actually starting to see the effects of the Bitcoin protocol on our design. Bitcoin protocol uses send and receive packets of data. There are 2 types of data packets:
This is just a short introduction, we’ll look into each and every message in the future
control messages are used to send meta type information such as: What’s your version number?(
Version) What’s your address?(
getAddr) Ping and Pong, etc’. This information is used by the Bitcoin protocol, but doesn’t contains any real information on blocks, transactions, signatures etc. Basically, nothing that will effect the Bitcoin blockchain. No transaction will be recorded, no messages will be signed, no block will be added etc’
data_messages are used to interact with the Bitcoin blockchain. Either we only ask for some information from the blockchain such as: send me specific blocks or block information(
Inv), show me the Mempool(
Mempool) etc’ or we’re trying interact with the Bitcoin blockchain by sending transactions(
Tx) or blocks(
It is important to note that the Bitcoin protocol requires that every message will be constructed in the same way (mostly it means it will have a specific header and will contain only specific data types. Again, we’ll look into it with more details soon). That is why we’ve also included
PacketCreator in this
Utils folder will contain an assortment of tools that might be required in our project.