Pettycoin

YA crazy bitcoin project

This project is maintained by Rusty Russell

Network Protocol (almost) Complete

02 Jul 2014

Pettycoin relies on partial knowledge, but until today the code assumed we needed to know transaction in every shard in every block.

Today I implemented the sending and receiving of protocol_pkt_get_txmap and protocol_pkt_txmap packets. When a node discovers a block, it asks for the entire contents of every shard it is interested in using protocol_pkt_get_shard packets. But as transactions can cross shards, it will also be interested in some transactions which are not in its own shard: this is where protocol_pkt_get_txmap comes in. The protocol_pkt_txmap returned is a bitmap of whatever transactions you’re interested in in that shard of transactions: you then ask for them individually using protocol_pkt_get_tx_in_block which provides the transaction and proof that it’s at that position in the block.

I also implemented the receipt and checking of every kind of complaint packet: these prove a problem with a block, and need to be checked carefully to make sure they really do prove it. There are five kinds:

There are only two parts of the network protocol now missing. First is dealing with skiplist of blocks before the horizon (protocol_pkt_horizon) and the second is broadcast of double spends and complaining about them if they’re inside a block. [Wait, scratch that. I still have fee collection and to-gateway payments to implement as well]

But first, I took some time to write some more unit tests: I’m way behind, still.



Comments