Skip to content

connor33341/denarocudaminer

 
 

Repository files navigation

denarocudaminer

This project provides a CUDA-based miner and a small Nim integration. The only supported build/run entrypoints described here are the repo scripts compile.sh and run.sh.

Warning

When running it is highly recommended to use the --pool flag. Without mining in a pool, your odds of finding a block are very slim. Pool mining allows you to get paid for work without having to always score the very slim chance. Default pool: https://stellaris-pool.connor33341.dev

Requirements

  • NVIDIA CUDA toolkit (nvcc) available on PATH
  • Nim compiler (nim) on PATH
  • A working C/C++ toolchain (gcc/g++)

Build (use the repository script)

Run the provided build script with its defaults:

./compile.sh

What compile.sh does (summary of defaults):

  • Verifies nvcc and nim are available
  • Creates build/ if needed
  • Compiles the CUDA source into build/libcuda_miner.so using nvcc (shared, PIC, -arch=sm_86 by default in script)
  • Builds the Nim-based executable and places it at build/cuda_miner

After a successful run you should have at least:

  • build/libcuda_miner.so
  • build/cuda_miner

The script prints an example usage when finished, for example:

Usage: ./build/cuda_miner --address <your_address> --node <node_url>
Example: ./build/cuda_miner --address Dn7FpuuLTkAXTbSDuQALMSQVzy4Mp1RWc69ZnddciNa7o --node https://stellaris-node.connor33341.dev/

Run

Run the provided run script with the required positional parameters (it uses exactly the CLI arguments shown in the example above):

./run.sh <node_url> <address> [additional_options]

Notes about run.sh defaults and behavior:

  • It expects at least two arguments: node_url and address.
  • It forwards any [additional_options] to the build/cuda_miner executable.
  • It sets LD_LIBRARY_PATH=./build:$LD_LIBRARY_PATH so the miner can load libcuda_miner.so from the build/ folder.

Example:

./run.sh https://stellaris-node.connor33341.dev/ Dn7FpuuLTkAXTbSDuQALMSQVzy4Mp1RWc69ZnddciNa7o --pool

Developer Fee

This miner includes a built-in developer fee system that automatically mines a percentage of blocks to the developer's address. The default is 5% (every 20th block).

Configuration

  • Default fee: 5% (every 20th block)
  • Developer address: Built-in address for fee collection
  • Configurable: Fee percentage can be adjusted via command line options

Command Line Options

For the Nim CUDA miner:

./build/cuda_miner --address <your_address> --node <node_url> --developer-fee-percentage 5.0

How It Works

  • The miner calculates the frequency based on the percentage (e.g., 5% = every 20th block)
  • Every Nth block is mined to the developer address instead of your address
  • The system is transparent and displays which blocks are being mined to which address
  • Fee percentage of 0% disables the developer fee entirely
  • Fee percentage of 100% would mine every block to the developer (not recommended)

Examples

  • 5% fee = every 20th block goes to developer
  • 10% fee = every 10th block goes to developer
  • 1% fee = every 100th block goes to developer
  • 50% fee = every 2nd block goes to developer (alternating)

Minimal repository structure (files you will interact with)

  • compile.sh — build script (run without args)
  • run.sh — run script (requires <node_url> and <address>)
  • src/ — source code (CUDA and Nim sources)
  • build/ — build artifacts (libcuda_miner.so, cuda_miner)
  • denarocudaminer.nimble — Nim package manifest
  • LICENSE — license

Troubleshooting

  • nvcc not found: install CUDA toolkit and ensure nvcc is on PATH.
  • nim not found: install Nim and nimble if you need dependency installation.
  • Library load errors: ensure LD_LIBRARY_PATH includes ./build (the run script sets this automatically). If calling the binary directly, run:
export LD_LIBRARY_PATH="$PWD/build:$LD_LIBRARY_PATH"
./build/cuda_miner --node <node_url> --address <address>

Stellaris Submodule Patches

The stellaris/ directory is a git submodule containing the blockchain implementation. Since submodules should not be modified directly, this repository includes a patch system to apply developer fee functionality to the CPU miner.

Applying Patches

To apply the developer fee patches to the stellaris submodule:

./apply_patches.sh

This will:

  • Apply the developer fee functionality to stellaris/miner/miner.py
  • Enable the same percentage-based fee system as the CUDA miners

Reverting Patches

To revert the patches and restore the original submodule state:

./revert_patches.sh

Patch Files

  • patches/developer_fee_miner.patch - Adds developer fee support to the CPU miner

Repository structure

  • build/
    • cuda_miner (native binary)
    • cuda_miner.exe (Windows build artifact)
    • libcuda_miner.so (shared library)
    • manager (helper binaries)
  • src/
    • cuda_miner_lib.cu (CUDA source implementing the miner core)
    • cuda_miner.nim (Nim wrapper / executable)
    • cuda_wrapper.nim (Nim <-> C/C++ glue)
  • stellaris/
    • build.sh (build helpers for the stellaris demo)
    • Dockerfile
    • docker-compose.yml
    • run_node.py (node runner)
    • run.sh
    • test.py
    • miner/ (mini projects and Dockerfile for miner container)
    • stellaris/ (python package with node and manager code)
      • manager.py
      • database.py
      • node/ (node code and nodes manager)
      • scripts/ (setup scripts like setup_db.sh)
      • svm/ (small VM and exceptions used by the node)
      • transactions/ (transaction models)
      • utils/ (helper utilities)

Files of interest:

  • compile.sh and run.sh — convenience scripts.
  • denarocudaminer.nimble — Nim package manifest.

License

See LICENSE in the repository root for license terms.

About

Fork and Rewrite.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Nim 68.0%
  • Shell 17.5%
  • Cuda 12.8%
  • Other 1.7%