Git Product home page Git Product logo

btcsim's Introduction

btcsim

[Build Status] (https://travis-ci.org/btcsuite/btcsim)

btcsim implements a simulation test driver using the simnet network provided by btcd. It launches the required nodes, manages them, runs the simulation and cleans up when done, all by itself, so there's no manual setup/teardown involved. btcsim uses btcrpcclient to interface with the RPC servers.

The input is read from a CSV file with the following headers:

| block height | minimum utxos required | transactions required |

Example:

20000,40000,20000
20001,60000,30000

Based on the input, the minimum required number of utxos are generated by creating transactions using the existing utxos and dividing them until the required number is reached.

The required number of transactions are generated by simulating transactions between multiple actors and using the utxos generated previously.

Mining is controlled using the RPC clients to ensure that the blocks are generated only when required i.e. when the minimum required number of utxos and transactions are created.

Components

Node

This is the first btcd node that is launched. It acts as the server for all Actors and as a peer for the miner.

Actor

An Actor simulates a wallet "Agent" by launching a btcwallet instance which connects to the node server. It is responsible for generating transactions among itself as well as other actors. Multiple actors can be launched simultaneously to simulate a large load due to a heavy multi-user system.

Miner

The Miner launches a btcd instance and simulates a mining node. It is connected to the node server using the addnode RPC call. It is responsible for collecting transactions and mining them when required.

Installation

btcsim depends on btcd and btcwallet, so install those first

$ go get github.com/btcsuite/btcd
$ go get github.com/btcsuite/btcwallet

Now install btcsim

$ go get github.com/btcsuite/btcsim

Usage

Invoking the command btcsim without any flags initializes a single actor simulation, using a default linear curve of 0-10,000 transactions per block:

$ btcsim

For more options, see:

$ btcsim --help

License

Package btcsim is licensed under the liberal ISC License.

btcsim's People

Contributors

0xmichalis avatar davecgh avatar jimmysong avatar jrick avatar tuxcanfly avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.