P2Pool code documentation: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Nibor (talk | contribs)
No edit summary
Nibor (talk | contribs)
No edit summary
Line 36: Line 36:
Contains the main data structures used in p2pool.
Contains the main data structures used in p2pool.
These are:
These are:
===hash_link_type===
{| border=1
  |+ '''hash_link_type'''
|-
  !Field
  !Type
  !Description
|-
  |state
  |String(32)
  |?
|-
  |extra_data
  |String(0)
  |Comments say this is a hack
|-
  |length
  |VarInt
  |?
|}
===x===
{| border=1
  |+ '''x'''
|-
  !Field
  !Type
  !Description
|-
  |name
  |String(32)
  |?
|}
===x===
{| border=1
  |+ '''x'''
|-
  !Field
  !Type
  !Description
|-
  |name
  |String(32)
  |?
|}
===x===
{| border=1
  |+ '''x'''
|-
  !Field
  !Type
  !Description
|-
  |name
  |String(32)
  |?
|}
===x===
{| border=1
  |+ '''x'''
|-
  !Field
  !Type
  !Description
|-
  |name
  |String(32)
  |?
|}
===x===
{| border=1
  |+ '''x'''
|-
  !Field
  !Type
  !Description
|-
  |name
  |String(32)
  |?
|}
===x===
{| border=1
  |+ '''x'''
|-
  !Field
  !Type
  !Description
|-
  |name
  |String(32)
  |?
|}


==p2pool/util/pack.py==
==p2pool/util/pack.py==

Revision as of 21:15, 13 June 2012

Ignore this page for the minute. Is just a scratch pad for documenting the p2pool code. Will tidy up once initial pass done.

Files
Files Name Description
p2pool/main.py Main Startup and initialisation code
p2pool/data.py P2Pool main data structures
p2pool/util/pack.py Handling of over the wire data structures


p2pool/main.py

Makes extensive use of twisted.defer. This allows it to "yield" to allow long running network code to complete. Read up on Python Generators and this before progressing!

Contains main startup code.

Tests connection to bitcoind. Prints hash of latest block to show bitcoind is up to date.

Tests connection to p2pool network.

Gets address to use for payout either from file or bitcoind. Validates address and checks local bitcoind owns it.

p2pool/data.py

Contains the main data structures used in p2pool. These are:

hash_link_type

hash_link_type
Field Type Description
state String(32) ?
extra_data String(0) Comments say this is a hack
length VarInt ?

x

x
Field Type Description
name String(32) ?

x

x
Field Type Description
name String(32) ?

x

x
Field Type Description
name String(32) ?

x

x
Field Type Description
name String(32) ?

x

x
Field Type Description
name String(32) ?

x

x
Field Type Description
name String(32) ?

p2pool/util/pack.py

I think this handles all the binary data types used in the bitcoin protocol to send data over the network wire. These are nasty as very low level and many big endian/little endian complications. The p2pool network protocol uses these also. Do not think you need to really understand this unless making changes at this low level.

p2pool/__init__.py

At bottom has DEBUG flag. Change to true to get more output. Other than that just returns version number for git if it can.