GithubHelp home page GithubHelp logo

icui / btcsimulator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tagoro9/btcsimulator

0.0 1.0 0.0 3.94 MB

Bitcoin network simulator

Python 7.59% CoffeeScript 8.16% JavaScript 18.58% CSS 65.67%

btcsimulator's Introduction

#Bitcoin network protocol simulator The goal of this project is to build a Bitcoin simulator, that is, a piece of software that allows to reproduce the behavior of the Bitcoin system. The simulator may be used to study how different user behaviors impact on system performance, and if certain theoretical attacks to the network are feasible to perform on a real scenario.

Inspired by rbrune's btcsim.

Features

  • Block mining simulation.
  • Bandwidth, latency and other network handicaps.
  • Data and event recording for further analysis.

##Prerequisites

  • Python 2.7.*. Most parts of the simulator are written in python. Higher versions of python are not supported since Gevent, which is used to support web sockets does not work well in higher Python versions
  • Celery. Asynchronous task job used to run simulations without blocking the server or the web app. It can be installed via pip pip install celery. More information about Celery can be found here.
  • Redis. Download and install Redis. The simulator uses redis as data store and as message broker to run background tasks in Celery workers.
  • Bower. Bower is a package manager for the web. It is used to manage all the web app dependencies (jQuery, Backbone, lodash,...). In order to install it you need to have Node and Npm up and running. npm install -g bower
  • Brunch. Brunch is the build tool used to create the web app. As with bower, just run npm install -g brunch

##Getting started

In order to run the simulator we need to have a redis server running.

cd redis-2.8.x/src
./redis-server

All the following commands must be run in the project root folder.

Install all python dependencies defined in requirements.txt.

pip install -r requirements.txt

Install brunch dependencies

npm install

Install all bower dependencies.

bower install

Compile the web app using brunch.

brunch b

Run the Celery worker.

celery -A run_server.celery worker --loglevel=info

Run the web server.

python run_server.py

By default server will listen on port 5000, so just open a browser and type http://localhost:5000. If all went fine, the welcome screen should appear.

##Structure This project consists on three main modules:

  • A Backbone.js webapp which controls simulation and displays data visualizations using D3.
  • A web server that exposes a REST API with all the simulation information stored in Redis. This server is also in charge of launching simulations through the Celery worker and notifies any change of state to the web app using web sockets.
  • A python library that drives the simulation and stores every single piece of data or communication between nodes in redis for further analysis. The simulation is run under SimPy, a discrete-event simulation framework.

##Getting to know Bitcoin If you're new to Bitcoin and don't know much about that cryptocurrency that seems to be the talk of the town, here there are a few useful links.

##Acknowledgements This simulator has been developed as part of my Master's Degree in Security of the Information and Communication Technologies final project at UOC.

btcsimulator's People

Contributors

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