github.com/decred/dcrd/blockchain@v1.2.1/chaingen/README.md (about)

     1  chaingen
     2  ========
     3  
     4  [![Build Status](https://travis-ci.org/decred/dcrd.png?branch=master)](https://travis-ci.org/decred/dcrd)
     5  [![ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
     6  [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/decred/dcrd/blockchain/chaingen)
     7  
     8  Package chaingen provides facilities for generating a full chain of blocks.
     9  
    10  ## Overview
    11  
    12  Many consensus-related tests require a full chain of valid blocks with several
    13  pieces of contextual information such as versions and votes.  Generating such a
    14  chain is not a trivial task due to things such as the fact that tickets must be
    15  purchased (at the correct ticket price), the appropriate winning votes must be
    16  cast (which implies keeping track of all live tickets and implementing the
    17  lottery selection algorithm), and all of the state-specific header fields such
    18  as the pool size and the proof-of-work and proof-of-stake difficulties must be
    19  set properly.
    20  
    21  In order to simplify this complex process, this package provides a generator
    22  that keeps track of all of the necessary state and generates and solves blocks
    23  accordingly while allowing the caller to manipulate the blocks via munge
    24  functions.
    25  
    26  ## Examples
    27  
    28  * [Basic Usage Example]
    29    (https://godoc.org/github.com/decred/dcrd/blockchain/chaingen#example-package--BasicUsage)
    30    Demonstrates creating a new generator instance and using it to generate the
    31    required premine block and enough blocks to have mature coinbase outputs to
    32    work with along with asserting the generator state along the way.
    33  
    34  ## Installation
    35  
    36  ```bash
    37  $ go get -u github.com/decred/dcrd/blockchain/chaingen
    38  ```
    39  
    40  ## License
    41  
    42  Package chaingen is licensed under the [copyfree](http://copyfree.org) ISC
    43  License.