Author

Topic: C# mining app project (Read 197 times)

full member
Activity: 1424
Merit: 225
January 31, 2022, 09:25:21 AM
#13
Is there a simple algorithm to understand ?
I do not understand what this code is trying to do, what does meet the target means.

No. That's not even the POW algo, just the loop that calls it and tests the result.

This is the algo:

Code:
var ScryptResult = Replicon.Cryptography.SCrypt.SCrypt.DeriveKey(Databyte, Databyte, 1024, 1, 1, 32);

If you don't know what the target means you have a very long way to go.
newbie
Activity: 10
Merit: 1
January 31, 2022, 08:48:30 AM
#12
I want to do it in C# because it's my main language I do everything with and I do love WPF  Cool

It's your choice but you'll have to learn c anyway to port the algos to c#. And don't use scrypt, it's
no longer viable for CPU mining. Choose a CPU mineable algo.

Is there a simple algorithm to understand ?

I do not understand what this code is trying to do, what does meet the target means.

Code:
// Reference: https://github.com/replicon/Replicon.Cryptography.SCrypt
public void doScrypt(Byte[] Tempdata, Byte[] Target, uint Nonce, uint Increment)
{
    var StartTime = DateTime.Now;
    var Hashcount = 0.0;
    var Databyte  = new Byte[80];

    Array.Copy(Tempdata, 0, Databyte, 0, 76);

    // Loop until done is set or we meet the target
    while (!done)
    {
        Databyte[76] = (Byte)(Nonce >> 0);
        Databyte[77] = (Byte)(Nonce >> 8);
        Databyte[78] = (Byte)(Nonce >> 16);
        Databyte[79] = (Byte)(Nonce >> 24);

        var ScryptResult = Replicon.Cryptography.SCrypt.SCrypt.DeriveKey(Databyte, Databyte, 1024, 1, 1, 32);

        Hashcount++;

        if (meetsTarget(ScryptResult, Target))  // Did we meet the target?
        {
            if (!done)
            {
                FinalNonce = Nonce;
            }

            done = true;

            break;
        }
        else
        {
            Nonce += Increment; // If not, increment the nonce and try again
        }
    }

    var Elapsedtime = (DateTime.Now - StartTime).TotalMilliseconds;
    Console.WriteLine("Thread finished - {0:0} hashes in {1:0.00} ms. Speed: {2:0.00} kHash/s", Hashcount, Elapsedtime, Hashcount / Elapsedtime);
}

Code:
public bool meetsTarget(Byte[] Hash, Byte[] Target)
{
    for (var Index = Hash.Length - 1; Index >= 0; Index--)
    {
        var ItemA = Hash[Index]   & 0xFF;
        var ItemB = Target[Index] & 0xFF;

        if (ItemA > ItemB)
        {
            return false;
        }
        else if (ItemA < ItemB)
        {
            return true;
        }
    }

    return false;
}
full member
Activity: 1424
Merit: 225
January 30, 2022, 03:09:50 PM
#11
I want to do it in C# because it's my main language I do everything with and I do love WPF  Cool

It's your choice but you'll have to learn c anyway to port the algos to c#. And don't use scrypt, it's
no longer viable for CPU mining. Choose a CPU mineable algo.
newbie
Activity: 10
Merit: 1
January 30, 2022, 02:07:48 PM
#10
That program can only mine scrypt and uses a library for the POW code so you can't see it. The only thing you can
learn from it is how to do stratum with C#. The heart of any miner is the POW algorithm and there are hundreds
of different ones.

If this is about learning C# there are better ways, if it's about learning mining SW there are also better ways.
Don't try to do both. All good mining SW is written in c/c++, there's no benefit rewriting everything in C#.

I want to do it in C# because it's my main language I do everything with and I do love WPF  Cool

Indeed, I have hit a function that target the dll that come with the source, thus I will try to merge https://github.com/lithander/Minimal-Bitcoin-Miner that do not rely on third party dll, with DotNetStratumMiner
full member
Activity: 1424
Merit: 225
January 30, 2022, 12:48:42 PM
#9
That program can only mine scrypt and uses a library for the POW code so you can't see it. The only thing you can
learn from it is how to do stratum with C#. The heart of any miner is the POW algorithm and there are hundreds
of different ones.

If this is about learning C# there are better ways, if it's about learning mining SW there are also better ways.
Don't try to do both. All good mining SW is written in c/c++, there's no benefit rewriting everything in C#.
newbie
Activity: 10
Merit: 1
January 30, 2022, 10:46:12 AM
#8
Finally I found a mining pool that is accepting DotNetStratumMiner, it's https://doge.mininghub.eu/index.php  Cool Cool
hero member
Activity: 776
Merit: 557
January 30, 2022, 07:30:41 AM
#7
I always learn stuff that way lole
I respect that! I thought it was going to be released to the public and not used to learn my bad.

Aight, I forgot bitcoin and seek for altcoins https://coinwut.com/mining-pool-single-gpu/
And I will ask a mod to migrate to altcoin section.
Use the report to moderator button
newbie
Activity: 10
Merit: 1
January 30, 2022, 07:18:16 AM
#6
Aight, I forgot bitcoin and seek for altcoins https://coinwut.com/mining-pool-single-gpu/
And I will ask a mod to migrate to altcoin section.

Else I am actually studying https://en.bitcoinwiki.org/wiki/Stratum_mining_protocol actually, there is such stuff in the source code I am reading.


For Bitcoin? No GPU/CPU became useless many years ago. If you want to mine Bitcoin you will need to invest into a dedicated bitcoin miner. Before doing that be sure that you can afford the electricity costs

If you do not understand mining why are you developing a app for it? knowledge is needed to create a app for something

I always learn stuff that way lole
hero member
Activity: 882
Merit: 5834
not your keys, not your coins!
January 30, 2022, 07:07:00 AM
#5
they do show no Hash rate after I run the miner (I have like 3 Khash).
Bitcoin's total hashrate is currently around 180 EHS (that is 1018), so your 3*103h/s is so little in comparison that the pools you connect to consider it to be nothing.

I see and it's confirming a reaction I had telling those mining pools are for ASIC, not GPU nor CPU, so is there any mining pools that is fit for GPU/CPU hash power ?

Edit: I am trying https://minexmr.com/
That's a Monero Mining Pool (large because it's just as large on their website). It's a totally different cryptocurrency; so for one, that belongs into the Altcoin section.
Furthermore, any CPU mining software for Bitcoin won't work with it since the algorithms are completely different.
They do have an open source miner available. Here you can learn about getting started and here is the software for it. It's 95% C and C++ code already, so you'd be trying to rewrite it in a different way somehow (I don't get the point of doing so). You would also need to first learn how Monero works, if your understanding so far only covers Bitcoin.
hero member
Activity: 776
Merit: 557
January 30, 2022, 06:56:26 AM
#4
they do show no Hash rate after I run the miner (I have like 3 Khash).
Bitcoin's total hashrate is currently around 180 EHS (that is 1018), so your 3*103h/s is so little in comparison that the pools you connect to consider it to be nothing.

I see and it's confirming a reaction I had telling those mining pools are for ASIC, not GPU nor CPU, so is there any mining pools that is fit for GPU/CPU hash power ?

Edit: I am trying https://minexmr.com/
For Bitcoin? No GPU/CPU became useless many years ago. If you want to mine Bitcoin you will need to invest into a dedicated bitcoin miner. Before doing that be sure that you can afford the electricity costs

If you do not understand mining why are you developing a app for it? knowledge is needed to create a app for something
newbie
Activity: 10
Merit: 1
January 30, 2022, 05:05:07 AM
#3
they do show no Hash rate after I run the miner (I have like 3 Khash).
Bitcoin's total hashrate is currently around 180 EHS (that is 1018), so your 3*103h/s is so little in comparison that the pools you connect to consider it to be nothing.

I see and it's confirming a reaction I had telling those mining pools are for ASIC, not GPU nor CPU, so is there any mining pools that is fit for GPU/CPU hash power ?

Edit: I am trying https://minexmr.com/
legendary
Activity: 3472
Merit: 10611
January 30, 2022, 04:51:09 AM
#2
they do show no Hash rate after I run the miner (I have like 3 Khash).
Bitcoin's total hashrate is currently around 180 EHS (that is 1018), so your 3*103h/s is so little in comparison that the pools you connect to consider it to be nothing.
newbie
Activity: 10
Merit: 1
January 30, 2022, 04:33:06 AM
#1
Hello,

I would like to start programming for mining app but clearly have no idea how to start it, so I am searching for working open source miners.

Do you know if https://github.com/ma261065/DotNetStratumMiner is working, else with what pools, I have tried a number of them but they do show no Hash rate after I run the miner (I have like 3 Khash).

https://trustpool.cc/
https://aikapool.com/doge/
https://www.viabtc.com/

Is this miner not compatible with those pools or I am missing something.
Jump to: