C# 클래스 BitSharper.Block

상속: Message
파일 보기 프로젝트 열기: TangibleCryptography/BitSharper 1 사용 예제들

Private Properties

프로퍼티 타입 설명
AddCoinbaseTransaction void
AddTransaction void
Block System
BuildMerkleTree IList
CalculateHash Sha256Hash
CalculateMerkleRoot Sha256Hash
CheckMerkleRoot void
CheckProofOfWork bool
CheckTimestamp void
CheckTransactions void
CreateNextBlock Block
Solve void
WriteHeader void

공개 메소드들

메소드 설명
BitcoinSerializeToStream ( Stream stream ) : void
Block ( NetworkParameters @params, byte payloadBytes ) : System

Constructs a block object from the BitCoin wire format.

CloneAsHeader ( ) : Block

Returns a copy of the block, but without any transactions.

CreateNextBlock ( Address to ) : Block
Equals ( object o ) : bool
GetDifficultyTargetAsInteger ( ) : BigInteger

Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the target is represented using a compact form. If this form decodes to a value that is out of bounds, an exception is thrown.

GetHashCode ( ) : int
GetWork ( ) : BigInteger

Returns the work represented by this block.

Work is defined as the number of tries needed to solve a block in the average case. Consider a difficulty target that covers 5% of all possible hash values. Then the work of the block will be 20. As the target gets lower, the amount of work goes up.

ToString ( ) : string

Returns a multi-line string containing a description of the contents of the block. Use for debugging purposes only.

Verify ( ) : void

Verifies both the header and that the transactions hash to the merkle root.

VerifyHeader ( ) : void

Checks the block data to ensure it follows the rules laid out in the network parameters. Specifically, throws an exception if the proof of work is invalid, if the timestamp is too far from what it should be. This is not everything that is required for a block to be valid, only what is checkable independent of the chain and without a transaction index.

VerifyTransactions ( ) : void

Checks the block contents

보호된 메소드들

메소드 설명
Parse ( ) : void

비공개 메소드들

메소드 설명
AddCoinbaseTransaction ( byte pubKeyTo ) : void

Adds a coinbase transaction to the block. This exists for unit tests.

AddTransaction ( Transaction t ) : void

Adds a transaction to this block.

Block ( NetworkParameters @params ) : System

Special case constructor, used for the genesis node, cloneAsHeader and unit tests.

BuildMerkleTree ( ) : IList
CalculateHash ( ) : Sha256Hash

Calculates the block hash by serializing the block and hashing the resulting bytes.

CalculateMerkleRoot ( ) : Sha256Hash
CheckMerkleRoot ( ) : void
CheckProofOfWork ( bool throwException ) : bool

Returns true if the hash of the block is OK (lower than difficulty target).

CheckTimestamp ( ) : void
CheckTransactions ( ) : void
CreateNextBlock ( Address to, uint time ) : Block

Returns a solved block that builds on top of this one. This exists for unit tests.

Solve ( ) : void

Finds a value of nonce that makes the blocks hash lower than the difficulty target. This is called mining, but solve() is far too slow to do real mining with. It exists only for unit testing purposes and is not a part of the public API.

This can loop forever if a solution cannot be found solely by incrementing nonce. It doesn't change extraNonce.

WriteHeader ( Stream stream ) : void

메소드 상세

BitcoinSerializeToStream() 공개 메소드

public BitcoinSerializeToStream ( Stream stream ) : void
stream Stream
리턴 void

Block() 공개 메소드

Constructs a block object from the BitCoin wire format.
public Block ( NetworkParameters @params, byte payloadBytes ) : System
@params NetworkParameters
payloadBytes byte
리턴 System

CloneAsHeader() 공개 메소드

Returns a copy of the block, but without any transactions.
public CloneAsHeader ( ) : Block
리턴 Block

CreateNextBlock() 공개 메소드

public CreateNextBlock ( Address to ) : Block
to Address
리턴 Block

Equals() 공개 메소드

public Equals ( object o ) : bool
o object
리턴 bool

GetDifficultyTargetAsInteger() 공개 메소드

Returns the difficulty target as a 256 bit value that can be compared to a SHA-256 hash. Inside a block the target is represented using a compact form. If this form decodes to a value that is out of bounds, an exception is thrown.
public GetDifficultyTargetAsInteger ( ) : BigInteger
리턴 Org.BouncyCastle.Math.BigInteger

GetHashCode() 공개 메소드

public GetHashCode ( ) : int
리턴 int

GetWork() 공개 메소드

Returns the work represented by this block.
Work is defined as the number of tries needed to solve a block in the average case. Consider a difficulty target that covers 5% of all possible hash values. Then the work of the block will be 20. As the target gets lower, the amount of work goes up.
public GetWork ( ) : BigInteger
리턴 Org.BouncyCastle.Math.BigInteger

Parse() 보호된 메소드

protected Parse ( ) : void
리턴 void

ToString() 공개 메소드

Returns a multi-line string containing a description of the contents of the block. Use for debugging purposes only.
public ToString ( ) : string
리턴 string

Verify() 공개 메소드

Verifies both the header and that the transactions hash to the merkle root.
public Verify ( ) : void
리턴 void

VerifyHeader() 공개 메소드

Checks the block data to ensure it follows the rules laid out in the network parameters. Specifically, throws an exception if the proof of work is invalid, if the timestamp is too far from what it should be. This is not everything that is required for a block to be valid, only what is checkable independent of the chain and without a transaction index.
public VerifyHeader ( ) : void
리턴 void

VerifyTransactions() 공개 메소드

Checks the block contents
public VerifyTransactions ( ) : void
리턴 void