Bitcoin Forum
December 12, 2018, 08:51:46 AM *
News: Latest Bitcoin Core release: 0.17.0 [Torrent].
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Simple CPU stratum miner Implementation  (Read 3820 times)
Dherf
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 25, 2015, 10:28:36 PM
 #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!
1544604706
Hero Member
*
Offline Offline

Posts: 1544604706

View Profile Personal Message (Offline)

Ignore
1544604706
Reply with quote  #2

1544604706
Report to moderator
1544604706
Hero Member
*
Offline Offline

Posts: 1544604706

View Profile Personal Message (Offline)

Ignore
1544604706
Reply with quote  #2

1544604706
Report to moderator
100% New Software
PC, Mac, Android, & HTML5 Clients
Krill Rakeback
Low Rake
Bitcoin Poker 3.0
Bad Beat Jackpot
SwC Poker Relaunch
PLAY NOW
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1544604706
Hero Member
*
Offline Offline

Posts: 1544604706

View Profile Personal Message (Offline)

Ignore
1544604706
Reply with quote  #2

1544604706
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
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: 2660
Merit: 1059


Linux since 1997 RedHat 4


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

botnet ...

Pool: https://kano.is Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
Dherf
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
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: 2660
Merit: 1059


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 Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
Dherf
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: 2660
Merit: 1059


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 Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
Dherf
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
November 28, 2015, 09:24:03 PM
 #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: 2548
Merit: 1003


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
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: 2660
Merit: 1059


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 Here on Bitcointalk: Forum BTC: 1KanoPb8cKYqNrswjaA8cRDk4FAS9eDMLU
FreeNode IRC: irc.freenode.net channel #kano.is Majority developer of the ckpool code
Help keep Bitcoin secure by mining on pools with full block verification on all blocks - and NO empty blocks!
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
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: 840
Merit: 500


🚀🚀 ATHERO.IO 🚀🚀


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.

  A revolutionary decentralized digital economy 
`Join us:██`Twitter  ◽  Facebook  ◽  Telegram  ◽  Youtube  ◽  Github`
.ATHERO
.Internet 3.0 solution
Dherf
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: 1554
Merit: 1019



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!
Never do any business with Kirill Stepanenko (Volgograd, Russia)
Пpoфeccиoнaльнo зaнимaюcь paзвёpтывaниeм фepм (ASIC, GPU, BURST), oбopyдoвaниeм пoмeщeний для мaйнингa.
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!