Giter Club home page Giter Club logo

alephium-mining-companion's Introduction

Alephium Mining Companion

This project is a companion for Alephium full nodes, providing some convenience features when enabling mining:

  1. Creates a mining wallet if none exists. It can also restore the wallet if mnemonics are provided.
  2. Configures the mining process to use the created wallet, if one created or different from the one configured.
  3. Starts the mining automatically when the node is in sync
  4. Transfers the mining reward to another provided wallet/address on a fixed frequency (hourly, daily, ...). Note that the wallet can be created anywhere as long as it's a valid Alephium address
  5. Expose metrics for both the mining and the transfer wallets

Companion means it needs to run alongside an Alephium full node, and particularly have REST connectivity to it (default port 12973)

mining-sidecar

Configuration

Docker compose

Docker-compose is a good way of running the side, assuming the Alephium node is also running in docker.

version: "3"
services:
  mining-companion:
    image: touilleio/alephium-mining-companion:v6
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    environment:
      - ALEPHIUM_ENDPOINT=http://broker:12973
      - LOG_LEVEL=debug
      - WALLET_NAME=$miningWalletName
      - WALLET_PASSWORD=$miningWalletPassword
      - WALLET_MNEMONIC=$miningWalletMnemonic
      - TRANSFER_ADDRESS=$miningTransferAddress
      - TRANSFER_FREQUENCY=5m
      - TRANSFER_MIN_AMOUNT=50000000000000000000
      - IMMEDIATE_TRANSFER=true
      - START_MINING=false

with variables miningWalletName, miningWalletPassword, miningWalletMnemonic and miningTransferAddress in a .env file in the same folder as the docker-compose.yml.

Variable Default Description
ALEPHIUM_ENDPOINT http://alephium:12973 REST URI of your Alephium node. Mind localhost in a docker container point to the docker container, not the host itself.
ALEPHIUM_API_KEY optional API key to use to connect to ALEPHIUM_ENDPOINT.
WALLET_NAME mining-companion-wallet-1 Name of the miner wallet
WALLET_PASSWORD Default-Password-1234 Password to unlock the miner wallet
WALLET_MNEMONIC optional Mnemonic to restore (create) the wallet if it does not exist. Random mnemonic will be generated if not set
WALLET_MNEMONIC_PASSPHRASE optional A passphrase associated with the mnemonic, if any
TRANSFER_MIN_AMOUNT 20000000000000000000 (20 ALF) Min amount to transfer at once. It uses the sweepAll function to optimize the transaction.
TRANSFER_ADDRESS optional Address to transfer the mining rewards to. If none provided, no transfer is performed. Double check you're sending the funds to the right address !!
TRANSFER_FREQUENCY 15m Frequency at which funds are transferred
PRINT_MNEMONIC true If true and a wallet is created without pre-set mnemonic (WALLET_MNEMONIC option above), the randomly generate mnemonic is printed out. This is a sensitive information, use it with caution!
IMMEDIATE_TRANSFER false If set to true, a transfer is sent at the start of the container, without waiting for TRANSFER_FREQUENCY initial time
START_MINING false If set to true, the mining machinery built-in the broker will start mining. This is disabled by default and the dedicated, more efficient CPU miner is recommended for mining as the time of writing

Docker

Replace 123456789012345678901234567890123456789012345 below with your own wallet address!

docker run -it --rm --link alephium:alephium -e TRANSFER_ADDRESS=123456789012345678901234567890123456789012345 touilleio/alephium-mining-companion:v6

As a reminder, running a Alephium full node looks like the following:

docker run -it --rm --name alephium -p 12973:12973 alephium/alephium:v1.1.7

alephium-mining-companion's People

Contributors

blankerl avatar dependabot[bot] avatar killerwhile avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

capito27 wizadr

alephium-mining-companion's Issues

Cannot Use Passphrase to Unlock Miner Wallet

Hi, I am a miner with a pre-generated mining address with a passphrase.

Today, I was having a try on this mining companion, with WALLET_NAME, WALLET_PASSWORD and WALLET_MNEMONIC_PASSPHRASE set, but it keeps saying "Invalid mnemonic passphrase" even if I am sure my passphrase is correctly typed in.

I went through the code, and found the line used to unlock the wallet is not using the passphrase if I understand it correctly.

I am a newbie to Golang and not able to fix the bug. Could you please have a check on this problem?

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.