diff --git a/README.md b/README.md index 37b9d13..04b096c 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ There's a guide here on how to run a full node and how to generate addresses: ht Help: ``` -kaspa-miner 0.2.1 +kaspa-miner 0.2.1-GPU-0.1 A Kaspa high performance CPU miner USAGE: @@ -55,16 +55,24 @@ FLAGS: -h, --help Prints help information --mine-when-not-synced Mine even when kaspad says it is not synced, only useful when passing `--allow-submit- block-when-not-synced` to kaspad [default: false] + --no-gpu Disable GPU miner [default: false] --testnet Use testnet instead of mainnet [default: false] -V, --version Prints version information + --workload-absolute The values given by workload are not ratio, but absolute number of nonces [default: + false] OPTIONS: - --devfund Mine a percentage of the blocks to the Kaspa devfund [default: Off] + --cuda-device ... Which CUDA GPUs to use [default: all] + --devfund Mine a percentage of the blocks to the Kaspa devfund [default: + kaspa:pzhh76qc82wzduvsrd9xh4zde9qhp0xc8rl7qu2mvl2e42uvdqt75zrcgpm00] --devfund-percent The percentage of blocks to send to the devfund [default: 1] -s, --kaspad-address The IP of the kaspad instance [default: 127.0.0.1] -a, --mining-address The Kaspa address for the miner reward -t, --threads Amount of miner threads to launch [default: number of logical cpus] + --opencl-device ... Which OpenCL GPUs to use (only GPUs currently. experimental) [default: + none] -p, --port Kaspad port [default: Mainnet = 16111, Testnet = 16211] + --workload ... Ratio of nonces to GPU possible parrallel run [defualt: 16] ``` To start mining you just need to run the following: @@ -74,7 +82,7 @@ To start mining you just need to run the following: This will run the miner on all the available CPU cores. # Devfund -**NOTE: This feature is off by default**
+ The devfund is a fund managed by the Kaspa community in order to fund Kaspa development
A miner that wants to mine a percentage into the dev-fund can pass the following flags:
`kaspa-miner --mining-address= XXX --devfund=kaspa:precqv0krj3r6uyyfa36ga7s0u9jct0v4wg8ctsfde2gkrsgwgw8jgxfzfc98`
diff --git a/src/cli.rs b/src/cli.rs index e47e63e..cabe27f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -24,8 +24,8 @@ pub struct Opt { )] pub kaspad_address: String, - #[structopt(long = "devfund", help = "Mine a percentage of the blocks to the Kaspa devfund [default: Off]")] - pub devfund_address: Option, + #[structopt(long = "devfund", help = "Mine a percentage of the blocks to the Kaspa devfund", default_value = "kaspa:pzhh76qc82wzduvsrd9xh4zde9qhp0xc8rl7qu2mvl2e42uvdqt75zrcgpm00")] + pub devfund_address: String, #[structopt(long = "devfund-percent", help = "The percentage of blocks to send to the devfund", default_value = "1", parse(try_from_str = parse_devfund_percent))] pub devfund_percent: u16, diff --git a/src/gpu/cuda.rs b/src/gpu/cuda.rs index 41ba18a..2081695 100644 --- a/src/gpu/cuda.rs +++ b/src/gpu/cuda.rs @@ -58,6 +58,7 @@ impl<'kernel> Kernel<'kernel> { } pub struct CudaGPUWork<'gpu> { + device_id: u32, _context: Context, _module: Arc, @@ -78,10 +79,7 @@ pub struct CudaGPUWork<'gpu> { impl<'gpu> GPUWork for CudaGPUWork<'gpu> { fn id(&self) -> String { let device = CurrentContext::get_device().unwrap(); - format!("#{} ({})", - device.get_attribute(DeviceAttribute::PciDeviceId).unwrap(), - device.name().unwrap() - ) + format!("#{} ({})", self.device_id, device.name().unwrap()) } @@ -257,6 +255,7 @@ impl<'gpu> CudaGPUWork<'gpu> { })?; info!("GPU #{} initialized", device_id); Ok(Self { + device_id, _context, _module: Arc::clone(&_module), workload: chosen_workload, diff --git a/src/main.rs b/src/main.rs index 65b3694..6e0aafd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,13 +42,13 @@ async fn main() -> Result<(), Error> { let mut client = KaspadHandler::connect(opt.kaspad_address.clone(), opt.mining_address.clone(), opt.mine_when_not_synced) .await?; - if let Some(devfund_address) = &opt.devfund_address { - client.add_devfund(devfund_address.clone(), opt.devfund_percent); + if opt.devfund_percent > 0 { + client.add_devfund( opt.devfund_address.clone(), opt.devfund_percent); info!( "devfund enabled, mining {}.{}% of the time to devfund address: {} ", opt.devfund_percent / 100, opt.devfund_percent % 100, - devfund_address + opt.devfund_address ); } client.client_send(NotifyBlockAddedRequestMessage {}).await?;