GithubHelp home page GithubHelp logo

5l1v3r1 / bitcoin_miningsim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gavinandresen/bitcoin_miningsim

0.0 1.0 0.0 20 KB

Simple, fast, C++ bitcoin mining / block relay simulation code

Makefile 2.28% C++ 97.72%

bitcoin_miningsim's Introduction

Mining / block propagation simulator

Simulates new block announcements propagating across the Bitcoin network.

Use these command-line options to control the simulation parameters:

  --help                     show options
  --blocks arg (=2016)       number of blocks to simulate
  --latency arg (=1)         block relay/validate latency (in seconds) to
                             simulate
  --runs arg (=1)            number of times to run simulation
  --rng_seed arg (=0)        random number generator seed
  --config arg (=mining.cfg) Mining config filename

The network topology and miner configuration is specified in a config file; see the .cfg files here for examples.

Config file options:

miner=hashrate type
biconnect=m n connection_latency

I don't do autotools, so you'll have to edit the Makefile unless you're compiling on OSX. The only dependency is boost (but you do need a c++11-capable C++ compiler).

Example runs:

$ ./mining_simulator
Simulating 2016 blocks, default latency 1secs, with 10 miners over 1 runs
Configuration: Ten equal miners, connected in a ring
Orphan rate: 0.1984%
Miner hashrate shares (%): 10 10 10 10 10 10 10 10 10 10
Miner block shares (%): 10.49 9.891 9.692 10.49 8.052 9.891 10.54 9.99 9.245 11.73

$ mining_simulator --latency 20
Simulating 2016 blocks, default latency 20secs, with 10 miners over 1 runs
Configuration: Ten equal miners, connected in a ring
Orphan rate: 3.075%
Miner hashrate shares (%): 10 10 10 10 10 10 10 10 10 10
Miner block shares (%): 10.39 9.98 9.724 10.44 8.035 9.826 10.7 9.928 9.314 11.67

$ mining_simulator --latency 20 --config mining_30.cfg --runs 100
Simulating 2016 blocks, default latency 20secs, with 8 miners over 100 runs
Configuration: 30% miner, with 7 10% miners, selected connectivity
Orphan rate: 2.715%
Miner hashrate shares (%): 30 10 10 10 10 10 10 10
Miner block shares (%): 30.25 9.922 10.05 9.959 9.918 9.929 9.932 10.05

bitcoin_miningsim's People

Contributors

dendisuhubdy avatar gavinandresen avatar

Watchers

 avatar

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.