Peripheral.GetConnectedVCMiners
Skip to content
mnscript
VCMiner[] Peripheral.GetConnectedVCMiners() 

Description ​

Finds all connected VCMiner peripherals.

Returns ​

VCMiner[] - An array of connected VCMiner peripherals.

Example ​

msc
using Peripheral;
using Console;
using Array;
using System;

// Asks the user to input the wallet
Console.WriteLine("Enter VentzCoin wallet:");
string wallet = Console.ReadLine();

// Finds all VCMiners connected and tries to start them.

VCMiner[] miners = Peripheral.GetConnectedVCMiners();
number numMiners = Array.Length(miners);
number minerIndex = 1;

while(minerIndex <= numMiners){
    VCMiner miner = miners[minerIndex];

    // See VCMiner.SetWallet documentation for more insight.
    StringResult result = miner.SetWallet(wallet);

    if(result.GetResult() == true){
        // The miner set wallet successfully.
        Console.WriteLine("VCMiner wallet set.");
    }else{
        // If the miner failed to set wallet, result string will contain the error reason.
        Console.WriteLine("Error setting wallet: "..result.GetString());
    }

    miner.StartMining();

    // Move on to the next VCMiner
    minerIndex = minerIndex + 1;
}