GithubHelp home page GithubHelp logo

hojason117 / bitcoinsimulator Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 206 KB

Simplified Bitcoin Cryptocurrency

License: MIT License

Elixir 79.59% CSS 10.32% JavaScript 4.25% HTML 5.84%
elixir actor-model bitcoin blockchain cryptocurrency phoenix-framework cryptography peer-to-peer

bitcoinsimulator's Introduction

BitcoinSimulator

Implemented a cryptocurrency following a simplified version of Bitcoin protocol.

Features including:

  • Blockchain
    • Distributed transaction ledger
  • Block
    • Previous block hash
    • Merkle tree root
    • Nonce
    • Timestamp
  • Transaction
    • Signature (ECDSA)
    • Multiple input and output
    • Transaction fee
  • Mining
    • Hash-based Proof-of-Work system
    • Difficulty
    • Mempool (unconfirmed transactions)
    • Coinbase transaction
  • Wallet
    • Address (hashed public key)
      • Public key
      • Private key
  • Concensus
    • Block verification
    • Transaction verification
  • Peer-to-Peer Network
    • Peers join and leave arbitrarily
    • Periodically exchange neighbors
    • Controlled message flooding
  • Simulation
    • Web UI
      • Dashboard
      • Parameter configurations

Web UI Simulator

Defaults to 100 peers (80 traders and 10 miners), and each trader creates a transaction every 2~4 seconds.

To start the web UI simulator:

  • Install dependencies with mix deps.get
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

CLI Sample Output

...
[info] Peer joined [id: 4548]
[info] Peer joined [id: 9809]
...
[info] Block mined [transaction count: 1]
[info] Block mined [transaction count: 59]
...

Testing

To run available tests:

  • mix test

To run tests with detailed reporting:

  • mix test --trace

To see test coverage:

  • mix test --cover

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.