C# Class BitSharper.BitcoinSerializer

Methods to serialize and de-serialize messages to the BitCoin network format as defined in the BitCoin protocol specification at https://en.bitcoin.it/wiki/Protocol_specification
To be able to serialize and deserialize new Message subclasses the following criteria needs to be met.
  • The proper Class instance needs to be mapped to it's message name in the names variable below
  • There needs to be a constructor matching: NetworkParameters params, byte[] payload
  • Message.bitcoinSerializeToStream() needs to be properly subclassed
ファイルを表示 Open project: TangibleCryptography/BitSharper Class Usage Examples

Public Methods

Method Description
BitcoinSerializer ( NetworkParameters @params, bool usesChecksumming ) : System

Constructs a BitcoinSerializer with the given behavior.

Deserialize ( Stream @in ) : Message

Reads a message from the given InputStream and returns it.

Serialize ( Message message, Stream @out ) : void

Writes message to to the output stream.

UseChecksumming ( bool usesChecksumming ) : void

Private Methods

Method Description
BitcoinSerializer ( ) : System
MakeMessage ( string command, byte payloadBytes ) : Message
SeekPastMagicBytes ( Stream @in ) : void

Method Details

BitcoinSerializer() public method

Constructs a BitcoinSerializer with the given behavior.
public BitcoinSerializer ( NetworkParameters @params, bool usesChecksumming ) : System
@params NetworkParameters
usesChecksumming bool Set to true if checksums should be included and expected in headers
return System

Deserialize() public method

Reads a message from the given InputStream and returns it.
public Deserialize ( Stream @in ) : Message
@in Stream
return Message

Serialize() public method

Writes message to to the output stream.
public Serialize ( Message message, Stream @out ) : void
message Message
@out Stream
return void

UseChecksumming() public method

public UseChecksumming ( bool usesChecksumming ) : void
usesChecksumming bool
return void