Coder Social home page Coder Social logo

diogofferreira / fpga-miner Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 22.0 351.92 MB

:moneybag: A simplified version of an FPGA bitcoin miner :moneybag:

License: MIT License

Pascal 0.01% Verilog 36.58% VHDL 60.25% SystemVerilog 1.10% Coq 0.01% JavaScript 0.03% Shell 0.04% Tcl 0.11% Batchfile 0.01% HTML 0.06% Scala 0.02% C 1.52% C++ 0.12% Makefile 0.02% Assembly 0.05% CartoCSS 0.01% Python 0.01% TeX 0.01% Stata 0.08% Forth 0.01%
fpga bitcoin-miner xilinx-fpga vivado

fpga-miner's Introduction

FPGA Bitcoin Miner


Simplified version of an FPGA bitcoin miner. Although not developed to pull data blocks from a blockchain pool, the server.py script can easily be modified to do so. At the moment, it generates random blocks to feed the FPGA via a TCP socket connection.

Essentially, the FPGA is responsible for finding the nonce corresponding to an integer, which is concatenated with the blockchain block and then hashed using SHA-256, that results in an hash starting with a given number of zeros, also known as difficulty.

  • ≈350K hashes per sec: With word input of 1024 bits (2 blocks of 512 bytes)
  • ≈2.8s per block in the FPGA: With network interaction and validations (difficulty = 5)
  • ≈14.4s per block in a CPU: CPU Intel i5-7500 3.5GHz, 8GB RAM (difficulty = 5)
  • ≈5x faster: 5x more bitcoins

Architecture

The miner is essentially based on the following IP cores.

MinerCoprocessor

Slave Streaming Interface

This interface is in charge of receiving and storing the Block Header and the processed mining difficulty mask. It receives 21 32-bit words (20 - block header | 1 - zeros mask) and enables the Mining Core.

SHA-256 Component

This module is in charge of generating a 256 bit hash, using the SHA-2 algorithm.

Mining Core

This component is in charge of the search for the nonce that produces an hash with the predefined difficulty. Each time the nonce is incremented, updates the block header and starts the SHA-256 component to generate the hash.

Master Streaming Interface

This module is in charge sending back to the Microblaze the resultant hash and the respective nonce.

Display Controller

Memory Mapped Displays controller

This module is in charge of controlling the refresh rate, brightness and the displays and respective values of the 7 segment displays.

LoadingBar Controller

Memory Mapped LEDs controller

This component acts like animating the board LEDs making them look like a loading bar. It stores the values and counter which is incremented each 2 seconds (or up until 128 times less) which controls the speed of the animation.

LwIP Controller

TCP socket controller

Through software, a TCP socket is open to communicate with the mining pool exchanging block headers. Parses generic blockchain headers and communicates with the various auxiliary IPs to calculate the nonce.

Instructions

The first step is to run to compile and run the files on the board project folder on a compatible FPGA (Xilinx), via the SDK app.

By default, the board will be configured to listen a TCP connection on 192.168.1.10:7. Then run python3 server.py to start feeding the board with blocks so it can compute SHA-256 hashes over those blocks and return the proof of work nonce.

Diogo Ferreira @ UA
Pedro Martins @ UA
2018

fpga-miner's People

Contributors

diogofferreira avatar pbmartins avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

fpga-miner's Issues

Compatible Xilinx devices

Hello thanks for sharing this.

How many logic cells minimum Xilinx device is required to host this project?

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.