Bitcoin Forum
March 28, 2024, 01:15:32 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Simple CPU stratum miner Implementation  (Read 3982 times)
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 25, 2015, 10:28:36 PM
Last edit: November 27, 2015, 03:26:45 AM by -ck
 #1

Hi to all, for a school project I'll love to implement a simple C# CPU startum miner that connect with a real pool.

Actually I know C# 4.0

Also, here are some details:
Port:3333
JASON-RPC

Anyone can help me? I'm stuck at the connection, using a simple TCP doesn't work at all.

Thanks to all!
1711631732
Hero Member
*
Offline Offline

Posts: 1711631732

View Profile Personal Message (Offline)

Ignore
1711631732
Reply with quote  #2

1711631732
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1711631732
Hero Member
*
Offline Offline

Posts: 1711631732

View Profile Personal Message (Offline)

Ignore
1711631732
Reply with quote  #2

1711631732
Report to moderator
1711631732
Hero Member
*
Offline Offline

Posts: 1711631732

View Profile Personal Message (Offline)

Ignore
1711631732
Reply with quote  #2

1711631732
Report to moderator
1711631732
Hero Member
*
Offline Offline

Posts: 1711631732

View Profile Personal Message (Offline)

Ignore
1711631732
Reply with quote  #2

1711631732
Report to moderator
deltalima
Newbie
*
Offline Offline

Activity: 41
Merit: 0


View Profile
November 25, 2015, 11:04:25 PM
 #2

Hi to all, for a school project I'll love to implement a simple C# CPU startum miner that connect with a real pool.

Actually I know C# 4.0

Also, here are some details:
Port:3333
JASON-RPC

Anyone can help me? I'm stuck at the connection, using a simple TCP doesn't work at all.

Thanks to all!

Would you like to show us some examples of how far you have progressed with this project or would it be easier for you if we just did the project for you and posted the code for you to submit as your own work?
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 25, 2015, 11:47:10 PM
 #3

Here I post what I have done from now on.
I prefer is someone helps me, like, we make it together, so, to make it simple.
The main objective is that I can learn how a miner work creating one.

the code:


Code:
using System;
using System.IO;
using System.Text;
using System.Net.Sockets;
using System.Security.Cryptography;
namespace BitcoinMiner
{
    class MainClass
    {
        static internal string user, pass, pool, poolPort, id, extraNonce1, extraNonce2;
        static internal TcpClient tcp= new TcpClient();

        public static void Main()
        {
            if (!File.Exists("conf.txt"))
            {
                Console.WriteLine("FILE DI CONFIGURAZIONE MANCANTE!");
                Console.ReadLine();
                return;
            }
            else
                Carica();
            Invia("connessione");
            Console.ReadLine();
        }
        static internal void Carica()
        {
            StreamReader sr = new StreamReader("conf.txt");
            pool = sr.ReadLine();
            poolPort = sr.ReadLine();
            user = sr.ReadLine();
            pass = sr.ReadLine();
            sr.Close();
            ScriviLog("Configurazione caricata correttamente.");
        }
        static internal void Invia(string tipo)
        {
            NetworkStream stream;
            switch (tipo)
            {
                case "connessione":
                    {//TCP non funziona!!!! forse serve il sistema delle richieste HTTP!!!!!!!!!!!!
                        ScriviLog("connessione in corso...");
                        tcp.Connect(pool, Convert.ToInt32(poolPort));
                        stream = tcp.GetStream();
                        byte[] a = Encoding.UTF8.GetBytes("{\"id\": 1, \"method\": \"mining.subscribe\", \"params\": []}\\n");
                        stream.Write(a, 0, a.Length);
                        byte[] d = new byte[tcp.ReceiveBufferSize];
                        stream.Read(d, 0, (int)tcp.ReceiveBufferSize);
                        ScriviLog(Encoding.UTF8.GetString(d));
                        stream.Close();
                        break;
                    }
            }
        }
        static internal void ScriviLog(string log)
        {
            Console.WriteLine("[" + DateTime.Now + "] " + log);
        }
    }
}
kano
Legendary
*
Offline Offline

Activity: 4452
Merit: 1798


Linux since 1997 RedHat 4


View Profile
November 27, 2015, 06:53:18 AM
 #4

botnet ...

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 27, 2015, 12:43:44 PM
 #5

Why I want to create a botnet for a school project?
This make no sense, also, I'll be the first to  make this project for school, and I was looking for something different and interesting.

I'm not one of these that want to create botnet or what else.

it's a simple cpu miner, I'm asking for help, so, if anyone want to help me, I'm glad for it.

So, thanks to who'll help me doing this little project.
enthus
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
November 27, 2015, 02:12:42 PM
 #6

kano i think you are right
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 27, 2015, 02:40:45 PM
 #7

It's happy to see that I'm seen like a criminal when I ask for simple help.

Yeah... a very helping place isn't it?
nepaluz
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
November 28, 2015, 12:39:41 AM
 #8

How is this question a botnet? Some people are just foolishness itself!

Your code is not complete as you will need to connect to a remote pool with your socket, or you'll need to interface with getblocktemplate if you are running a local node.
kano
Legendary
*
Offline Offline

Activity: 4452
Merit: 1798


Linux since 1997 RedHat 4


View Profile
November 28, 2015, 11:43:53 AM
 #9

How is this question a botnet? Some people are just foolishness itself!

Your code is not complete as you will need to connect to a remote pool with your socket, or you'll need to interface with getblocktemplate if you are running a local node.
Why would anyone write a CPU miner on windows?
It's pointless except to make a botnet.
(though a botnet would require probably 50,000 computers just to equal a 1TH miner)

I even had someone come to my pool channel yesterday saying he had a botnet ot 143,000 computers and where can he get a CPU miner.
Of course I kicked him and banned him (he was using a vpn so there was no point trying to work out where he was from)

Seriously, an obvious question with an obvious reason.

Since it has no use whatsoever, write an ASIC miner that uses a $2 USB miner and see if you can get that to work.

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 28, 2015, 12:11:50 PM
 #10

I'm only at the second year of programming, it's the first time I use the socket and net dll.

And, before yesterday I don't know what a botnet was.

it's only a project for school, I need a good vote as I'm a bit low on this school subject.

I know that a CPU miner is unuseful for bitcoin, but it's the best project I cna think of to try and take the best mark form my teacher.

I have only 1 week left before I have to send the work.

Also, for a botnet, it should be more comfortable to write right into the code the link, port etc to connect to the pool, and not using an external file!

I any case, I don't use any vpn, or whatever to hide form where I'm, if you want I tell you too, it's not a problem for me.

Just please, I'll not make any trouble, I just need a good mark for it, please, I'm only asking for some help, nothing more.

If there is anything I cna do to prove that it's a botnet, or any kind of similar thing, just tell me, I'll prove that it's a simple school project, nothing more nothing less, promise.
kano
Legendary
*
Offline Offline

Activity: 4452
Merit: 1798


Linux since 1997 RedHat 4


View Profile
November 28, 2015, 01:27:00 PM
 #11

...
Since it has no use whatsoever, write an ASIC miner that uses a $2 USB miner and see if you can get that to work.

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 28, 2015, 09:24:03 PM
Last edit: November 28, 2015, 10:57:50 PM by Dherf
 #12

Yeah, so, I bring an ASCI miner to school and say that I did it?
The best way to have the worst mark...
os2sam
Legendary
*
Offline Offline

Activity: 3578
Merit: 1090


Think for yourself


View Profile
November 28, 2015, 11:28:51 PM
 #13

Yeah, so, I bring an ASCI miner to school and say that I did it?
The best way to have the worst mark...

Maybe you should be doing your own homework instead of asking others to do it for you.

I can't believe that a fledgling programmer is incapable of reading the plethora of source code available to do just what you are asking.

You should be asking for sources of information, not how to do something, it kind of defeats the purpose of education, in my opinion.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 30, 2015, 03:16:17 PM
 #14

In fact, I'm NOT asking others to do it for me.

I'm asking others how I can connect in first, because I didn't understand it right, as the server, simply close the connection.

I read on how it works, all say TCP, but TCP doens't connect, so I'm confused.

The education works fine too if somebody tells me where I'm doing wrong, I'll be able to learn it quickier and do it right, or I'm wrong?

So, I remember, I'm asking for help with a problem into the code, not for a program just completed by others!
kano
Legendary
*
Offline Offline

Activity: 4452
Merit: 1798


Linux since 1997 RedHat 4


View Profile
November 30, 2015, 03:23:35 PM
 #15

Yeah, so, I bring an ASCI miner to school and say that I did it?
The best way to have the worst mark...
You clearly do not understand at all how a USB asic miner works ... so much so since your comment is completely wrong.

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
nepaluz
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
November 30, 2015, 06:34:06 PM
 #16

Honestly, if the question asked is so far off the mark why bother to answer or even post a response? It is as though asking a question that may fit anyone's incongruent pre-concenceptions warrants snide remarks. Guys, spare us your frustrations, if you can not or do not want to answer, do not answer at all.
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
December 01, 2015, 04:23:57 PM
 #17

Well, if I'm wrong on something, why then you don't simple tell me where I'm wrong without saying it like I'm a completely ignorant?
I'm pretty new to all of this, and never read about ASCI before, it was obvious, I write it at the beginning that I was new, or not?

In every case, stop with all this complaning about everything I say or did, if somebody want to help me, just did it here or with a PM, I have only a few days left, and I need to hurry.

I wasted too much time for complains.

Also, thank for saying it nepaluz.
morantis
Hero Member
*****
Offline Offline

Activity: 868
Merit: 502



View Profile
December 01, 2015, 04:27:18 PM
 #18

I suggest that you download the source for stratum-proxy and start picking through the source to see how to interact with the network.
Dherf (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
December 01, 2015, 09:04:12 PM
 #19

It's a good suggestion, thanks, but I only know the C# language so far, that is the real problem, I didn't find a C# proxy for now.
Did you know one?
Rabinovitch
Legendary
*
Offline Offline

Activity: 2030
Merit: 1076


BTCLife.global participant


View Profile
December 03, 2015, 12:04:33 PM
 #20

botnet ...
Personally I would like to run such a miner under Windows at my work during working day (after end of working day my laptop crunches BOINC projects).

From Siberia with love! Hosting by Rabinovitch!
Fundraising for BOINC Farm
Пpoфeccиoнaльнo зaнимaюcь paзвёpтывaниeм фepм (ASIC, GPU, BURST, STORJ, Filecoin), oбopyдoвaниeм пoмeщeний для мaйнингa.
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!