dcrd/blockchain/chaingen
Dave Collins a57df141f9
chaingen: Update vote commitments on hdr updates.
This modifies the NextBlock function to account for changes made to the
block height or previous block hash in munge functions and update the
commitments in all votes accordingly.
2018-02-14 14:27:13 -06:00
..
doc.go chaingen: Add package for generating test chains. 2017-02-12 10:28:58 -06:00
example_test.go chaingen: Add package for generating test chains. 2017-02-12 10:28:58 -06:00
generator.go chaingen: Update vote commitments on hdr updates. 2018-02-14 14:27:13 -06:00
README.md chaingen: Add package for generating test chains. 2017-02-12 10:28:58 -06:00

chaingen

[Build Status] (https://travis-ci.org/decred/dcrd) ![ISC License] (http://img.shields.io/badge/license-ISC-blue.svg) [GoDoc] (http://godoc.org/github.com/decred/dcrd/blockchain/chaingen)

Package chaingen provides facilities for generating a full chain of blocks.

Overview

Many consensus-related tests require a full chain of valid blocks with several pieces of contextual information such as versions and votes. Generating such a chain is not a trivial task due to things such as the fact that tickets must be purchased (at the correct ticket price), the appropriate winning votes must be cast (which implies keeping track of all live tickets and implementing the lottery selection algorithm), and all of the state-specific header fields such as the pool size and the proof-of-work and proof-of-stake difficulties must be set properly.

In order to simplify this complex process, this package provides a generator that keeps track of all of the necessary state and generates and solves blocks accordingly while allowing the caller to manipulate the blocks via munge functions.

Examples

Installation

$ go get -u github.com/decred/dcrd/blockchain/chaingen

License

Package chaingen is licensed under the copyfree ISC License.