Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

The ApoCLypse Bitcoin Miner

Project description

apoclypsebm - The ApoCLypse Bitcoin Miner


This hobby project maintained by Justin T. Arthur undertakes the quixotic task of maintaining a modern Bitcoin miner for programmable compute devices like GPUs. It was forked from the PyOpenCL Bitcoin Miner (poclbm), a project authored by m0mchil and contributors.

It features an OpenCL Kernel that has incorporated ideas or code from:

If your work is represented herein and I didn't give you credit, please let me know. At the moment, I reserve no rights to the mining driver or the OpenCL kernel. They were derived from public domain works.


At the time of writing, on-chip implementations of the Bitcoin mining algorithm will outperform this software in both time and joules expended. Under most conditions, mining blocks on a Bitcoin chain where on-chip implementations are competing would be at a tremendous waste of expended resources.

New in Version 1.1.0

This release focused on supporting the getblocktemplate call proposed in BIP 22 and BIP 23 and implemented by Bitcoin Core and btcd. This finally allows mining without a pool if you supply an address to mine coins to at the command line.

HTTP work sources now default to using getblocktemplate instead of getwork. This feature is new and might have bugs that could lead to loss of potential mining rewards.

It looks like the work sourcing threads run into i/o issues occasionally due to using the not-thread-safe Python http lib. I don't aim to address this as most of the threaded communication ought to be completely replaced by an event runner like asyncio or trio at some point.

Thanks to @momchil for the original getwork code, @luke-jr @sipa and @vsergeev for helping me understand getblocktemplate.


In an environment with Python 3.5+:

pip3 install apoclypsebm


apoclypse [OPTION]... SERVER[#tag]...

SERVER is one or more [http[s]|stratum://]user:pass@host:port (required)
[#tag] is an optional per server user-friendly name displayed in stats.


  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --verbose             verbose output, suitable for redirection to log file
  -q, --quiet           suppress all output except hash rate display
  --proxy=PROXY         specify as
                        [[socks4|socks5|http://]user:pass@]host:port (default
                        proto is socks5)
  --no-ocl              don't use OpenCL
  --no-bfl              don't use Butterfly Labs
  --stratum-proxies     search for and use stratum proxies in subnet
  -d DEVICE, --device=DEVICE
                        comma separated device IDs, by default will use all
                        (for OpenCL - only GPU devices)
  -a ADDRESS, --address=ADDRESS
                        Bitcoin address to spend the block reward to if
                        allowed. Required for solo mining, ignored with
                        stratum or getwork sources.
                        Custom text to include in the coinbase of the
                        generation tx if allowed, encoded as UTF-8.

  Miner Options:
    -r RATE, --rate=RATE
                        hash rate display interval in seconds, default=1 (60
                        with --verbose)
    -e ESTIMATE, --estimate=ESTIMATE
                        estimated rate time window in seconds, default 900 (15
    -t TOLERANCE, --tolerance=TOLERANCE
                        use fallback pool only after N consecutive connection
                        errors, default 2
    -b FAILBACK, --failback=FAILBACK
                        attempt to fail back to the primary pool after N
                        seconds, default 60
                        AMD GPUs, BFL only. For GPUs requires
               Comma separated
                        temperatures at which to skip kernel execution, in C,
                        how long to not execute calculations if CUTOFF_TEMP is
                        reached, in seconds, default=0.01
                        disable using failback hosts provided by server

  OpenCL Options:
    Every option except '-p' and '-v' can be specified as a
    comma separated list. If there aren't enough entries specified, the
    last available is used. Use --vv to specify per-device vectors usage.

    -p PLATFORM, --platform=PLATFORM
                        use platform by id
    -w WORKSIZE, --worksize=WORKSIZE
                        work group size, default is maximum returned by OpenCL
    -f FRAMES, --frames=FRAMES
                        will try to bring single kernel execution to 1/frames
                        seconds, default=30, increase this for less desktop
                        sleep per frame in seconds, default 0
    --vv=VECTORS        Specifies size of SIMD vectors per selected device.
                        Only size 0 (no vectors) and 2 supported for now.
                        Comma separated for each device. e.g. 0,2,2
    -v, --vectors       Use 2-item vectors for all devices.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for apoclypsebm, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size apoclypsebm-1.1.2-py3-none-any.whl (40.8 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page