Git Product home page Git Product logo

dcrstakesim's Introduction

dcrstakesim

dcrstakesim provides a tool for simulating the full Decred proof-of-stake system behavior. The primary goal and purpose of this tool is to allow different ticket price (aka stake difficulty) algorithms to be accurately modelled under reasonably realistic scenarios.

It includes all relevant behavior such as calculating ticket prices, tracking correct subsidy generation (including proper reduction based on the number of votes in a block), keeping a running tally of the spendable subsidy (including maturity requirements), maintaining the pool of live tickets, selecting winning tickets via the same deterministic algorithm the real network uses, expiring tickets that aren't selected, revoking tickets that are either missed or expired, and ticket purchasing behavior.

The simulation only contains the current mainnet ticket price algorithm as of March 2017. It is intended that proposed algorithms are added to the code and the simulation be updated to call the new algorithm to produce the results.

Two separate modes are supported:

  1. Full Simulation (default) - This mode fully automates the simulation by making ticket purchase decisions based on upon a demand distribution function.

  2. Mainnet Data-driven Simulation - This mode accepts a CSV file which is expected to contain data extracted from mainnet in order to drive the simulation according to actual historical mainnet data. The result is a reproduction of exactly what has already happened on mainnet up to the current time and helps prove the correctness of the simulation. Use -inputcsv=mainnetdata.csv to use this mode. The mainnetdata.csv file can be extracted by using the extractdata utility.

Installation and updating

Windows/Linux/BSD/POSIX - Build from source

Building or updating from source requires the following build dependencies:

Building/Installing the latest release directly from remote repository

The go tool is used to obtain, build, and install (to GOPATH) the project.

To build and install directly from the remote repository:

  • Set the GO111MODULE=on environment variable
  • Run go get -v github.com/davecgh/dcrstakesim
  • Optionally run go get -v github.com/davecgh/dcrstakesim/extractdata if you plan to run a mainnet data-driven simulation instead of a full simulation
  • Note that the dcrstakesim (and optional extractdata) executable will be installed to $GOPATH/bin. GOPATH defaults to $HOME/go (or %USERPROFILE%\go on Windows) if unset.

Example of obtaining and building the latest release on Windows 10:

PS> $env:GO111MODULE="on"
PS> go get -v github.com/davecgh/dcrstakesim
PS> & "$(go env GOPATH)\bin\dcrstakesim" -h

Example of obtaining and building the latest release on Linux:

$ GO111MODULE=on go get -v github.com/davecgh/dcrstakesim
$ $(go env GOPATH)/bin/dcrstakesim -h

Obtaining source and building/installing locally

Similar to building and installing the latest release directly from the remote repository, the go tool is used to build and install (to GOPATH) the project from a local copy of the repository.

To build and install from a local checkout of the repository:

  • Set the GO111MODULE=on environment variable if building from within GOPATH
  • Ensure you are in the checked-out repository's root directory
  • Run go install
  • Optionally run go install ./extractdata if you plan to run a mainnet data-driven simulation instead of a full simulation
  • Note that the dcrstakesim and optional extractdata executable will be installed to $GOPATH/bin. GOPATH defaults to $HOME/go (or %USERPROFILE%\go on Windows) if unset.

Example of cloning the repo and building from it on Windows 10:

PS> git clone https://github.com/davecgh/dcrstakesim $env:USERPROFILE\src\dcrstakesim
PS> cd $env:USERPROFILE\src\dcrstakesim
PS> go install .
PS> & "$(go env GOPATH)\bin\dcrstakesim" -h

Example of cloning the repo and building from it on Linux:

$ git clone https://github.com/davecgh/dcrstakesim ~/src/dcrstakesim
$ cd ~/src/dcrstakesim
$ go install .
$ $(go env GOPATH)\bin\dcrstakesim -h

Issue Tracker

The integrated github issue tracker is used for this project.

License

dcrstakesim is licensed under the copyfree ISC License.

dcrstakesim's People

Contributors

chappjc avatar davecgh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dcrstakesim's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.