Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: DeathAndTaxes on November 21, 2011, 02:35:46 PM



Title: COMPLETED: Request for an RPC capable fork of cgminer (155 BTC pledged and paid)
Post by: DeathAndTaxes on November 21, 2011, 02:35:46 PM
For those of us with hashing farms there is interest in taking the existing cgminer (best miner platform bar none) and adding RPC support.  This would enable the development of a variety of monitoring & management front ends (console, web or smartphone for example).

To establish a baseline for the project I have come up with some general conditions for a bounty.  These conditions aren't set in stone and I am willing to modify them if others (who pledge) see need for changes to the conditions.  This is just an attempt to jump-start a project.  If any developer sees an issue with the constraints please indicate in the thread.

I am willing to pledge 30 BTC towards either integrating the following features into a future version of cgminer or developing a fork of cgminer project which will be "rpc only".  Given the amount of new code and the amount of existing cgminer code which would be no longer needed a fork may be the best route however I would leave that up to any potential developers.

The executable:
* A daemon which is started by config file.
* No command line output necessary or desired (although may be useful for troubleshooting)
* Responds to RPCs.  Although I am not a huge fan or JSON RPC given it near universal usage in other bitcoin apps it likely is a good candidate.

The daemon should respond to the following RPC (at a minimum) to satisfy the bounty:
* Start/stop/restart individual GPUs (on restart recheck config file for any changes)
* Shutdown instance (stop all GPU, and end cgminer)
* Report current monitors (a min of current temp/load/clock/hashing speed)
* Report global output (a min of total shares, accepted shares, rejected shares, stale shares, etc)
* Report individual card output (same but on per card basis)
* Report any failures (a min of card down & pool not responding)

Obviously more advanced features could be added in the future (changing clock speeds, voltage, intensity, etc) however those could be handled by future bounties/donations once project is up and running.  This is just a rough draft but the hope is it will spark attention of potential developers and further discussion among those interested in RPC capable cgminer.

Amounts pledged (any additional limits/requirements marked):
* DeathAndTaxes - 30 BTC (+5 BTC more if integrated into the mainline instead of a fork)
* Gigasvps - 30 BTC
* Tnkflx - 30 BTC
* abracadabra - 10 BTC
* Red Emerald - 10 BTC (+5 BTC more if integrated into the mainline instead of a fork)
* ThiagoCMC - 5 BTC
* gnar1ta$ - 10 BTC (+5 BTC more if integrated into the mainline instead of a fork)
* Chefnet -  (+15 BTC only if integrated into the mainline instead of a fork)

Total Pledged: 125 BTC (30 BTC for integration into mainline)

Edit 1/3/2012: All pledges have been paid in full as verified by the two developers.


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: jamesg on November 21, 2011, 02:39:22 PM
I pledge 30 btc to the completion of the project.  :D


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: finway on November 21, 2011, 02:43:14 PM
why don't ask ckolivas to do this?


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: DeathAndTaxes on November 21, 2011, 02:46:12 PM
why don't ask ckolivas to do this?

I have and he didn't seem interested.  Obviously he isn't excluded from the bounty and given his knowledge related to the internal workings of cgminer could easily claim the bounty if he is interested in perusing it.  If he isn't then the bounty opens development to anyone else so there is no need for us to continually "pester" him w/ a request he isn't interested in.


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: tnkflx on November 21, 2011, 03:00:56 PM
I solemnly pledge 30 btc to the completion of the project ;-)


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: lueo on November 21, 2011, 06:19:00 PM
It's exactly what I am trying to implement in the last 2 months. If RPC is possible for a miner, then a experienced system adminstrator could help integrate it into any kind monitor program (e.g. Nagios, Munin, Zenoss, Zabbix,.... etc.).

Since I don't like C that much, I am using Python as my primary language. I think we can use poclbm as a foundation, and do the following implementation:

1. Auto kernel tuning (the algorithm could be referenced to cgminer)
2. Temp / Fan auto control (the algorithm could also be ref to cgminer)
3. Status monitoring (pull mode and push mode)

PS. Regarding to 3, the pull mode is like "Getting status every 5 minutes", and the push mode is like "Send status as soon as I got any news".

I am thinking of using a web framework like Django or web.py to implement the JSON interface in a RESTful way.


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: DeathAndTaxes on November 21, 2011, 06:57:19 PM
Since I don't like C that much, I am using Python as my primary language. I think we can use poclbm as a foundation, and do the following implementation:

I wouldn't have any interest in poclbm based miner.  cgminer is simply put the best miner hands down.  Multiple GPU per instance, superior block change handling, ADL support built in (temp/clocks), etc.  To recreate all the advantages of cgminer in another miner and then add RPC support on top of that would be very difficult and beyond the scope of this bounty.


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: tnkflx on November 21, 2011, 07:48:10 PM
Since I don't like C that much, I am using Python as my primary language. I think we can use poclbm as a foundation, and do the following implementation:

I wouldn't have any interest in poclbm based miner.  cgminer is simply put the best miner hands down.  Multiple GPU per instance, superior block change handling, ADL support built in (temp/clocks), etc.  To recreate all the advantages of cgminer in another miner and then add RPC support on top of that would be very difficult and beyond the scope of this bounty.

What DeathAndTaxes said...  I pledged for a forked version of cgminer, not a new one...


Title: Re: Request for an RPC capable fork of cgminer (90 BTC pledged so far)
Post by: abracadabra on November 21, 2011, 08:23:33 PM
I pledge 10BTC towards bounty (and as previously stated.. a cgminer fork.. not some poclbm version)


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: -ck on November 21, 2011, 08:51:12 PM
Goddamnit that's the sum total of how much I've earned in donations in total for cgminer  >:(

I'll have to think about it since I don't have the free time I did when I worked on cgminer to begin with.


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: Red Emerald on November 21, 2011, 11:39:27 PM
Theres so many projects that I want to help out!  Bitcoiners are still coming up with great ideas.

I'll pledge 10 BTC.  I'll pledge 5 more if I ckolivas pulls the code into his main branch (even if he codes it).  I think this would help us by keeping bugs to a minimum.  Multiple versions of cgminer are sure to only complicate things and slow features down.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: -ck on November 22, 2011, 12:17:05 AM
I'd be happy to pull any code that is done in a satisfactory generalised manner into the main branch.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: jamesg on November 22, 2011, 12:39:34 AM
I'd be happy to pull any code that is done in a satisfactory generalised manner into the main branch.

Since you are in the thread, would you be willing to do the work? If not, what would it take to entice you enough?  ;D

IMHO if this work is done, cgminer will be able to spread like a weed and become the default miner throughout the land.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: kano on November 22, 2011, 01:48:43 AM
The JSON RPC must have been designed by people who can't write software.
It's slow due to the ridiculous HTTP overhead it has and it's design looks like someone who wants to talk to a program, not provide information over an API.
Considering how simple it it to create a socket interface I wonder about the naivety of those who chose it for bitcoin.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: kano on November 22, 2011, 01:50:34 AM
I'd be happy to pull any code that is done in a satisfactory generalised manner into the main branch.

Since you are in the thread, would you be willing to do the work? If not, what would it take to entice you enough?  ;D

IMHO if this work is done, cgminer will be able to spread like a weed and become the default miner throughout the land.
You seriously think that the people who don't use it yet will suddenly change their mind because of this ... or that a lot of people don't already use it?


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: Red Emerald on November 22, 2011, 02:57:48 AM
The JSON RPC must have been designed by people who can't write software.
It's slow due to the ridiculous HTTP overhead it has and it's design looks like someone who wants to talk to a program, not provide information over an API.
Considering how simple it it to create a socket interface I wonder about the naivety of those who chose it for bitcoin.
Why does "slow" matter for an app like this? Do you need to send thousands of commands to your miners at once?

JSON RPC is also incredibly easy to implement in just about every language and platform, local or remote.  Socket api's are not as standardized across lots of projects.

What would you propose we use instead of JSON RPC? Now would be the time considering no code has been written yet.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: -ck on November 22, 2011, 04:08:34 AM
I'd be happy to pull any code that is done in a satisfactory generalised manner into the main branch.

Since you are in the thread, would you be willing to do the work? If not, what would it take to entice you enough?  ;D

IMHO if this work is done, cgminer will be able to spread like a weed and become the default miner throughout the land.
The bounty certainly is attractive, but it can't make me find the time to do it, and I have no experience with that sort of code. Then again, I also had no experience with bitcoin mining, opencl code, overclocking, curses.... so anything's possible. My willingness to dedicate time is the hardest thing to win over right now. When I did cgminer I had a personal sabbatical with time off work and used the project as part of my need for programming expression. I have not the time now, so I'm not sure if there is much that would make me want to. Bear in mind that even 100 BTC is less than 300 bucks and think how much real contract work pays. I like taking BTC as a concept, and encouraging BTC trade through doing so, but I'm not earning any real money at these prices.


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: -ck on November 22, 2011, 05:20:29 AM
Goddamnit that's the sum total of how much I've earned in donations in total for cgminer

That is ridiculous, well you have a couple of more now.
Thanks btw  ;D


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: kano on November 22, 2011, 05:48:59 AM
The JSON RPC must have been designed by people who can't write software.
It's slow due to the ridiculous HTTP overhead it has and it's design looks like someone who wants to talk to a program, not provide information over an API.
Considering how simple it it to create a socket interface I wonder about the naivety of those who chose it for bitcoin.
Why does "slow" matter for an app like this? Do you need to send thousands of commands to your miners at once?

JSON RPC is also incredibly easy to implement in just about every language and platform, local or remote.  Socket api's are not as standardized across lots of projects.
The JSON RPC is also the reason why bitcoin, pools and even ltc have such problems dealing with what amounts to not a lot of data.

Quote
What would you propose we use instead of JSON RPC? Now would be the time considering no code has been written yet.
LOL time is irrelevant, if I wanted to write it I'd just write it using sockets like I've written many interfaces before.
For web sites it's simple to use sockets between C and PHP so I'm sure it must be simple for ANY other language.
The JSON RPC is written on TOP of sockets I guess usually using CURL since having to write a full HTTP implementation is a pain beyond belief.
CURL/HTTP is a way over complicated interface to use to pass simple data and nothing is gained by using it.

If someone else wants to write it then I guess JSON RPC is what will be used and it will suck badly like the rest of the JSON RPC interfaces spread throughout Bitcoin.

I get and see a lot of responses from people saying how "Satoshi said so thus that's how it should be"
This is another example of it.
He may have been good at maths while he was alive but he certainly sucked at choosing, designing and coding programming interfaces.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: jamesg on November 22, 2011, 10:15:33 AM
I'd be happy to pull any code that is done in a satisfactory generalised manner into the main branch.

Since you are in the thread, would you be willing to do the work? If not, what would it take to entice you enough?  ;D

IMHO if this work is done, cgminer will be able to spread like a weed and become the default miner throughout the land.
You seriously think that the people who don't use it yet will suddenly change their mind because of this ... or that a lot of people don't already use it?

Hi Kano, yes i do think more people would use cgminer including myself if it had some type of programming interface to interact with the miner for stats. If you would like to use something other than json/rpc calls, make your case and program it.

I'm asking for this so cgminer can have monitoring tools added to it.



Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: kano on November 22, 2011, 10:24:23 AM
... or just use the -T option and pipe it into something ...


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: Chefnet on November 22, 2011, 11:04:41 AM
Theres so many projects that I want to help out!  Bitcoiners are still coming up with great ideas.

I'll pledge 10 BTC.  I'll pledge 5 more if I ckolivas pulls the code into his main branch (even if he codes it).  I think this would help us by keeping bugs to a minimum.  Multiple versions of cgminer are sure to only complicate things and slow features down.
agree +1.

add 15BTC by me if it will be mainline.


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: ThiagoCMC on November 22, 2011, 02:35:46 PM
Hi!

 I would love to support this... I can give 5 BTCs now.

 And I have a suggestion:

 1- Identify a GPU by its "device ID" (possible?);
 2- Configuration of each GPU based on its ID;
 3- A different "pool / login / worker" per device (fixed by its ID).

 This way, no matter if a GPU is GPU0 or GPU1, the ID will be the same, so its own configurations...

 This can be usefull if we change a GPU slot or add/remove GPUs from a machine.

 It can works more or less like Linux file system UUID, with it, no matter if the device is sda or sdb, the FS UUID will be always the same and the file system will be mounted without any problem if you change the disk connection.

Best,
Thiago


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: DeathAndTaxes on November 22, 2011, 02:54:25 PM
Hi!

 I would love to support this... I can give 5 BTCs now.

 And I have a suggestion:

 1- Identify a GPU by its "device ID" (possible?);
 2- Configuration of each GPU based on its ID;
 3- A different "pool / login / worker" per device (fixed by its ID).

 This way, no matter if a GPU is GPU0 or GPU1, the ID will be the same, so its own configurations...

 This can be usefull if we change a GPU slot or add/remove GPUs from a machine.

 It can works more or less like Linux file system UUID, with it, no matter if the device is sda or sdb, the FS UUID will be always the same and the file system will be mounted without any problem if you change the disk connection.

Best,
Thiago

Is the hardware ID exposed by AMD SDK?  I don't believe it is but I only glanced over AMD SDK and example source code.


Title: Re: Request for an RPC capable fork of cgminer (115 BTC pledged so far)
Post by: DeathAndTaxes on November 22, 2011, 03:08:03 PM
The JSON RPC is also the reason why bitcoin, pools and even ltc have such problems dealing with what amounts to not a lot of data.
I believe the bottleneck on pools is bitcoind internal code not the JSON RPC. I do agree JSON is very heavy but for the amounts of data we are dealing with here it is a non-issue.  Personally I wouldn't use JSON but then again I am a windows developer so for interprocess communication my first thoughts are going to be sockets, memory mapped files, or named pipes.

Really the entire bitcoind needs to be built from ground up for high performance.  Using a real multi-user database, multi-core transaction engine, and some sort of higher throughput I/O interface like sockets.  Honestly does anyone think if Amazon accepted Bitcoin they would use the existing bitcoind to process transactions?  The community could use a high performance bitcoind.

Quote
If someone else wants to write it then I guess JSON RPC is what will be used and it will suck badly like the rest of the JSON RPC interfaces spread throughout Bitcoin.

Why?  How many I/O do you think need to be made against a single miner instance.  I mean even polling for updated stats once per second is not going to be a bottleneck.  Things like error reporting, changing clocks, and restarting instances are going to happen so infrequently to be even less of a non-issue.

Quote
I get and see a lot of responses from people saying how "Satoshi said so thus that's how it should be"
This is another example of it.

Nobody said that (except you).  The bounty isn't limited to JSON.  However just doing something different for the sake of different is dubious at best.

As far as Satoshi decision.  He likely never saw the rise of mining pools.  At the time he wrote it miners were getting maybe 1 MH/s on current hardware.  Even at 1 GH/s you only need 1 getwork every 4 seconds.  Block changes are only every 600 seconds.  How many transactions per second is a merchant going to need 1 tps = 86,400 orders per day.

He likely didn't have any philosophical attachment to JSON.  He likely chose it for the same reason millions of developers choose it every year.  It is ease to implement and it was capable of the performance required of it.

Honestly if you made a socket based bitcoind you likely could collect quite a bounty from pool operators.  As that I/O pressure is not going to go away.



Title: Re: Request for an RPC capable fork of cgminer (115 BTC pledged so far)
Post by: kano on November 22, 2011, 07:48:40 PM
Quote
I get and see a lot of responses from people saying how "Satoshi said so thus that's how it should be"
This is another example of it.

Nobody said that (except you).  The bounty isn't limited to JSON.  However just doing something different for the sake of different is dubious at best.

As far as Satoshi decision.  He likely never saw the rise of mining pools.  At the time he wrote it miners were getting maybe 1 MH/s on current hardware.  Even at 1 GH/s you only need 1 getwork every 4 seconds.  Block changes are only every 600 seconds.  How many transactions per second is a merchant going to need 1 tps = 86,400 orders per day.

He likely didn't have any philosophical attachment to JSON.  He likely chose it for the same reason millions of developers choose it every year.  It is ease to implement and it was capable of the performance required of it.

Honestly if you made a socket based bitcoind you likely could collect quite a bounty from pool operators.  As that I/O pressure is not going to go away.
Obviously I am not referring to this thread regarding comments about Satoshi.
Anyone but a fool can see that no one mentioned Satoshi in it before my comment ...


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: gnar1ta$ on November 22, 2011, 10:37:35 PM
Theres so many projects that I want to help out!  Bitcoiners are still coming up with great ideas.

I'll pledge 10 BTC.  I'll pledge 5 more if I ckolivas pulls the code into his main branch (even if he codes it).  I think this would help us by keeping bugs to a minimum.  Multiple versions of cgminer are sure to only complicate things and slow features down.
agree +1.

add 15BTC by me if it will be mainline.

I'll match this...10 for the project and another 5 if it will be mainline.  Has anyone set up an escrow wallet of some sort?

Goddamnit that's the sum total of how much I've earned in donations in total for cgminer  >:(

I increased my donation %.  That's just crazy, cgminer is worth more than that.


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: -ck on November 22, 2011, 11:50:17 PM
Goddamnit that's the sum total of how much I've earned in donations in total for cgminer  >:(
I increased my donation %.  That's just crazy, cgminer is worth more than that.
Thanking you very much. Just for the record, I just checked and the sum total of hashes from all --donation are currently running at 100 Mhash. It usually hovers between 100-200. Note that I intentionally made the percentage err on the conservative side, and it will virtually always be less than what you set it to since I didn't want complaints.


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: kano on November 23, 2011, 03:48:39 AM
https://github.com/kanoi/cgminer

API v0.1

Includes a sample api-example.php

6 files added/changed from current ckolivas master:

main.c, miner.h, AUTHORS, api.c, api-example.php, Makefile.am

(also has the updated linux-usb-cgminer)

OK so this obviously isn't final (though it does work fine for me)

Anyone who can build their own cgminer and is interested could you have a look?

It currently has 3 API commands:
apiversion - returns a version string "0.1"
dev - returns a status string of all the devices (CPU and or GPU)
pool - returns a status string of all the pools

The included PHP file (api-example.php) simply converts the returned string into a data structure
Very simple and very easy in PHP the way I've done it.

No I'm not expecting people to give me bitcoins yet ... :)

The 3 main questions I have are:
1) what other API commands do people want
2) what parameters should I add to cgminer: --api-port = 4028, --api-address = 127.0.0.1, --api-access = 192.168.5.* and anything else?
the numbers shown are of course examples :)
(I haven't added any parameters yet)
3) what socket I/O do people want: by this I mean: default port and access restriction.
It currently runs on port 4028 and only listens on 127.0.0.1 - for security reasons of course.

Edit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?

Edit2: minor change - it wasn't closing the connection if an invalid command was sent

Edit3: added 'quit' and 'summary'


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: lueo on November 23, 2011, 06:05:31 AM
Good work kano!

I am working on my Python warpper for cgminer, too. Initial version will be upload later.

It is a RESTful application which will accept JSON format as control / query.

I'll make it support all the miners, like poclbm, phoenix... etc.

https://github.com/kanoi/cgminer

API v0.1

Includes a sample api-example.php

6 files added/changed from current ckolivas master:

main.c, miner.h, AUTHORS, api.c, api-example.php, Makefile.am

OK so this obviously isn't final (though it does work fine for me)

Anyone who can build their own cgminer and is interested could you have a look?

It currently has 3 API commands:
apiversion - returns a version string "0.1"
dev - returns a status string of all the devices (CPU and or GPU)
pool - returns a status string of all the pools

The included PHP file (api-example.php) simply converts the returned string into a data structure
Very simple and very easy in PHP the way I've done it.

No I'm not expecting people to give me bitcoins yet ... :)

The 3 main questions I have are:
1) what other API commands do people want
2) what parameters should I add to cgminer: --api-port = 4028, --api-address = 127.0.0.1, --api-access = 192.168.5.* and anything else?
the numbers shown are of course examples :)
(I haven't added any parameters yet)
3) what socket I/O do people want: by this I mean: default port and access restriction.
It currently runs on port 4028 and only listens on 127.0.0.1 - for security reasons of course.

Edit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?

Edit2: minor change - it wasn't closing the connection if an invalid command was sent


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: kano on November 23, 2011, 06:15:12 AM
Looking at the first post, I guess all I need to add is:
* Start/stop/restart individual GPUs (on restart recheck config file for any changes)

But I have no idea what you mean by "(on restart recheck config file for any changes)"


As for this:
* Report any failures (a min of card down & pool not responding)

Well my output reports the CPU/GPU/POOL status but "pool not responding" seems a bit strange?
What could you actually do with that? cgminer deals with that itself.

Since the API isn't a constant connection, rather a request + reply - I'm not sure what the point of that would be.
I guess I could add a buffer in cgminer to keep ERROR messages and return the list since the last time?


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: -ck on November 23, 2011, 08:58:49 AM
https://github.com/kanoi/cgminerEdit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?
Just getting the info should be safe, if done after everything is set up and all the threads started.


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: kano on November 23, 2011, 09:19:57 AM
https://github.com/kanoi/cgminerEdit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?
Just getting the info should be safe, if done after everything is set up and all the threads started.
It's the last thread created.
But I'll check see if there's something I can check/sleep until it's ready - I guess that would be better.
(or add a variable for that exact reason)
Arigatou.

Edit: after a closer look - everything seems to be initialised before the threads are created so it should be fine.
Also now added the parameter options required:
--api-port nnn (port number to use - default 4028)
--api-listen (defaults to only listen on 127.0.0.1 for security - this boolean option means listen on 0.0.0.0)

I guess GPU/CPU enable/disable is next ...


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: btc_artist on November 23, 2011, 02:48:52 PM
But I have no idea what you mean by "(on restart recheck config file for any changes)"
When you send cgminer the restart request and it restarts, load the config file and use values from there.  This is a given, since if it reads the config file when it starts, it will when it restarts too.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 23, 2011, 03:14:38 PM
But I have no idea what you mean by "(on restart recheck config file for any changes)"
When you send cgminer the restart request and it restarts, load the config file and use values from there.  This is a given, since if it reads the config file when it starts, it will when it restarts too.
Hmm - but that doesn't seem to makes sense.

The stop/start/restart request is just for a single GPU.

If your editing the config file you may as well just stop and start cgminer from scratch.
i.e. press q (or send a 'quit' command) and start it again
i.e. run it in a script that just continually loops starting it (like the script I have posted before) and tell it to quit so it starts from scratch.
If you mean a global 'restart' command, not a single GPU stop/start/restart (like quit but that starts again afterwards)
But it really is better to actually completely stop cgminer and restart it since the point of that is to clear the ATI/AMD interface and like windows, that is best done as a complete program stop/start coz ATI/AMD are not good at dealing with that ... and that would also give you all an excuse for not having to pay me too - that should make everyone happy :)

I'll just implement a GPU stop/start option.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: DeathAndTaxes on November 23, 2011, 03:33:57 PM
But I have no idea what you mean by "(on restart recheck config file for any changes)"
When you send cgminer the restart request and it restarts, load the config file and use values from there.  This is a given, since if it reads the config file when it starts, it will when it restarts too.
Hmm - but that doesn't seem to makes sense.

The stop/start/restart request is just for a single GPU.

If your editing the config file you may as well just stop and start cgminer from scratch.
i.e. press q (or send a 'quit' command) and start it again
i.e. run it in a script that just continually loops starting it (like the script I have posted before) and tell it to quit so it starts from scratch.
If you mean a global 'restart' command, not a single GPU stop/start/restart (like quit but that starts again afterwards)
But it really is better to actually completely stop cgminer and restart it since the point of that is to clear the ATI/AMD interface and like windows, that is best done as a complete program stop/start coz ATI/AMD are not good at dealing with that ... and that would also give you all an excuse for not having to pay me too - that should make everyone happy :)

I'll just implement a GPU stop/start option.

Thank makes sense.  I was just thinking that by checking config file on each "restart" one could make changes even if RPC to implement changes in clock/intensity/fan were not implemented.  You are right one could simply end the daemon, change config file, and start the deamon again. 

So unless anyone else has a problem I don't think checking config on starting each GPU is needed or warranted.  It really was just a workaround.  The end goal would be for the project (maybe in later version) to allow controlling GPU via RPC (i.e. change fan 70%, change clock 800MHz, etc).


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 24, 2011, 10:18:03 AM
Yep adding GPU setting commands shouldn't be too hard now that I've made a pretty simple to edit interface with messages/errors and everything else reasonably simple ... at least for myself :)

Git (as before): https://github.com/kanoi/cgminer

OK v0.2 in the git - plus the bunch of changes I spent today adding on top of v0.2 where I tracked down a bug I caused in main.c back when I first started working on this ... yesterday ... (hint 7 <-> 8 :P)

The commands so far are:
apiversion - just returns a version string: 0.2
devs - returns the list of gpus and cpus - each with the full status, details, plus
pools - returns the list of pools with their status, details
summary - returns the total summary information similar to when you exit cgminer (without pool breakdown)
gpuenable|N - enable GPU N (flags and notifies the GPU to start)
gpudisable|N - disable GPU N (flags the GPU to stop)
gpurestart|N - restart GPU N
gpu|N - show the 'devs' output but just for GPU N
cpu|N - show the 'devs' output but just for CPU N
quit - quit cgminer

Each return includes a status array of:
STATUS: F (fatal) E (error) W (warning) I (info) S (success)
CODE: the internal error code: each has a unique number - see api.c MSG_ZZZZZZ
MSG: a related status message

F (fatal) only occurs when api.c fails to determine the correct error code - these mean report the output line to me to fix api.c
E (error) you made a mistake - e.g. you sent an unknown command or an invalid CPU/GPU number or those sort of mistakes
W (warning) you need to do something else first - currently only when you try to enable a GPU that's not well
I (info) nothing changed - e.g. trying to enable an enabled GPU
S (success) as expected

I've built a 2.0.8a version for xubuntu 11.04 and you can download the binary here to try it (if you can't compile):
http://tradebtc.net/cgminer2.0.8a
1,760,610 bytes, sha256sum: a96ef5ad0914b3becb059f992da93801badcea0dc946120b0199ff31ab4d7b67

Of course you'll need something like api-example.php in the git to try issuing commands to it and see the result.
Otherwise it runs exactly the same as an ADL 2.0.8 so you can use it normally also ... and I didn't even change the donation code :P

So ... what's missing?

Edit: I'll update the DOC files once I've done the initial set of requirements and sorted out with ckolivas about if he'll accept the commits to his git


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: tnkflx on November 24, 2011, 10:19:46 AM
...
So ... what's missing?

The Windows version? ;-)


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 24, 2011, 09:08:21 PM
Hmm I don't actually have a windows compiler or even a computer running windows that could compile it
(just my kids computer runs windows)
I do have a VirtualBox OSE that I run the Aus Tax/Bas programs in on this computer (but of course no ATI card)
Anyone got a link to how I'd compile a OCL/ADL program (using gcc?) on 32-bit WindowsXP for everyone? :P
(or some other legal free compiler on windows)

Edit: hmmm - mingw or cygwin? Have to read the cgminer thread to work out which one ckolivas was using ...

Edit2: seems to be mingw ...


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: -ck on November 24, 2011, 09:23:54 PM
If and when it's finalised, I will be merging it into my tree, and then eventually I will make a windows version from it when I release a new official version of cgminer. However I would appreciate kano fixing any windows builds before then since things inevitably break when trying to port it.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 24, 2011, 10:47:15 PM
If and when it's finalised, I will be merging it into my tree, and then eventually I will make a windows version from it when I release a new official version of cgminer. However I would appreciate kano fixing any windows builds before then since things inevitably break when trying to port it.
Well I'll certainly sort out any api.c problems in Windows and make sure that works :)
As for ADL/ATI - since I'm not changing any of that I hopefully won't cause any new problems there (crosses fingers)
(but of course once? I can make an ADL working windows binary ... I guess I can ask people to try it and report any differences)
First step to just make a CPU version that runs on windows ... I'll be back in a week or two? :D (just kidding)

Edit: I guess I should go back to frequenting the #cgminer IRC channel soon ... (kanoi)


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 28, 2011, 11:12:57 PM
Well after going through all the pain and agony of building a windows executable ...

It's here: https://github.com/kanoi/cgminer/downloads

I have of course already created the 2.0.8w version without GPU mining and that works fine.
I have not actually successfully run the GPU version on anything. So I do not know if that binary works. Could someone please try it.
That one is just the windows CPU version that works fine for me but with GPU support enabled.
I can't run it coz it crashes on OpenCL.dll
Though I did find OpenCL.dll online, I have no idea if that is expected if you don't have a system with an ATI card and drivers installed
(I don't have a windows system with an ATI card - my only ATI card is of course my xubuntu miner)

It also crashes on exit just like 2.0.8 windows version does ... I do have an actual idea about what is causing that (the thread shut down code) but since I didn't write that, I'm not going to look into fixing that before I finish this bounty.

The additional commands (since last time) are:
gpucount and cpucount
and this one reports the apiversion as 0.3

Now if this GPU win32 exe actually works for anyone ...

What changes are required?
What's missing?

If it runs for you and you spot any problems - of course let me know.

Edit: added a Xubuntu 2.0.8w binary also to the downloads. So that's both of them :)

Edit2: added the 2 free windows dll's required (again to the download tab) and updated the git source


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: Remember remember the 5th of November on November 29, 2011, 07:55:46 AM
Well to be honest, I did not see uhm...anything that looks like it could output JSON. Is this just sockets?


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 29, 2011, 08:33:33 AM
Yep just a simple socket.
Look at the api-example.php
(that also shows how simple it is to interact with it)
It really is VERY easy to interact with it and doesn't require many megabytes of code and libraries to do that.
You simply send a request to the port and it sends a reply.
The format of the reply (except apiversion) is very simple also: (as stated before https://bitcointalk.org/index.php?topic=52466.msg629425#msg629425 )

STATUS=x,CODE=nnn,MSG=string|type[=value],name=value,name=value,name=value|

i.e. sections are separated by '|'
name/value pairs are separated by ','
and name/value has an '=' between

Where x is one of
W - warning
I - informational
S - success
E - error
F - fatal (code bug)

Each code has a unique number

If a reply returns multiple sets of data (e.g. multiple pools) then it will just be multiple "type=value,...|" sections.
e.g. POOL=0,URL=http://url.com:8223,MHS=30000.00,...|POOL=1,URL=http://url2.com:8888,MHS=10000.00,...|

You will see that if you use the php.
Run it and use the php script (just type "php api-example.php" on the same computer will do it)
If you can't put php on the miner, copy api-example.php to another PC and:
1) edit the address in it "127.0.0.1" to be the address of the miner
2) run the miner with the "--api-listen" option
If you need it in some other code - just say - I can very quickly write that in C, Java or maybe even anything else you can think of.
(the only language I know of that I haven't ever used is C# and that's coz I never will use it by choice)

Thus to convert it to a structure usable in your code (which is what you must do with json also)
is only a small amount of code (as given in the php)

the 3 separators "| , =" are currently guaranteed to be OK unless a pool puts a ',' or '|' in their URL somewhere
(no idea why a pool would use that)

If anyone is concerned about that I can change it (or all 3) to control characters (0x01, 0x02, 0x03)
But using normal characters makes the return string more easily humanly readable.

The documentation will be updated once I've covered all the requirements.

So again :) What's missing?
Any bugs?

(ok I've realised one thing needs to be changed that I forgot - the socket error string code is wrong on windows - it should use a different function (not errno) - I'll change that once I know something else that needs to be done)


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 29, 2011, 11:50:48 AM
Though ... if someone actually has some really unexpected need for a JSON format response ...
(I can think of no reason, since this format is way easier to read and parse but has a detail level equivalent to JSON for this requirement)
I guess they could request it with BTC :)
(i.e. I'd prefer to not do it - so I'd prefer if no one made a BTC request)

Of course please be specific about what you want, if you do:
i.e. JSON in and out or leave the simple input format: "command[|option]" and just use JSON out
and give a sample JSON of what you think it should be (I'll decide the format myself if you can't specify it correctly)

Of course I'll allow both if someone 'requests' with BTC coz I WAY prefer the format I'm using since it is so much easier to parse and the data being transferred is fully handled by the format I'm using and does not require a more complex JSON format.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: lueo on November 29, 2011, 12:08:49 PM
I am currently working on my project for output restful JSON. The following URLs are used to retrieve the status of a mining rig.

url: /adl/devices  -> list all adl devices
url: /adl/device/<index>  -> list the status of a device
url: /opencl/devices -> list all opencl devices (to mine!)
url: /opencl/device/<index> -> list the status of an opencl device
url: /miners -> list all miners on the computer
url: /miner/<index> -> output the status of a miner (cgminer for now. will be extended to other miners, too!)

Currently it can only display the status. I am implementing the control part (to control GPU clock, mem, start / stop miners). So the progress of this project is about 40%.

I'll release the project when the progress is about 80% so that more feedback and tests could be done.

The following is a sample output on a 6970*3 machine:
Code:
URL: GET /adl/devices
{
  "count": 3,
  "devices": [
    {
      "busNumber": 1,
      "index": 0,
      "adapterIndex": 0,
      "displayName": "\\\\.\\DISPLAY46",
      "vendorID": 1002,
      "UDID": "PCI_VEN_1002&DEV_6718&SUBSYS_03B81043&REV_00_4&31B538E3&0&0010A",
      "adapterName": "AMD Radeon HD 6900 Series"
    },
    {
      "busNumber": 4,
      "index": 1,
      "adapterIndex": 4,
      "displayName": "\\\\.\\DISPLAY42",
      "vendorID": 1002,
      "UDID": "PCI_VEN_1002&DEV_6718&SUBSYS_03B81043&REV_00_4&4C9C647&0&0058A",
      "adapterName": "AMD Radeon HD 6900 Series"
    },
    {
      "busNumber": 5,
      "index": 2,
      "adapterIndex": 8,
      "displayName": "\\\\.\\DISPLAY50",
      "vendorID": 1002,
      "UDID": "PCI_VEN_1002&DEV_6718&SUBSYS_03B81043&REV_00_4&62C0392&0&0060A",
      "adapterName": "AMD Radeon HD 6900 Series"
    }
  ]
}

Also, the status of each card could be displayed remotely:
Code:
URL: GET /adl/device/0
{
  "index": 0,
  "displayName": "\\\\.\\DISPLAY46",
  "vddc": 1.175,
  "adapterName": "AMD Radeon HD 6900 Series",
  "activity": 99,
  "powertuneLevel": 20,
  "fanSpeedPercent": 100,
  "memClock": 795.0,
  "fanSpeedRPM": 7345,
  "fanSpeedUserDefine": "user-defined",
  "engineClock": 920.0,
  "performanceLevel": 2,
  "temperature": 91.5
}


Well to be honest, I did not see uhm...anything that looks like it could output JSON. Is this just sockets?


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: lueo on November 29, 2011, 12:21:48 PM
I am also designing a new GUI to control my mining machine remotely. I hate to open lots of applications to mine and monitor my mining rig.

If you have more ideas, welcome to send to me!

https://lh5.googleusercontent.com/-MaC9_gMSb98/TtTOETKTnBI/AAAAAAAAB-M/oFeUV2SW75E/s800/gui.jpg


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 29, 2011, 09:37:46 PM
Though ... if someone actually has some really unexpected need for a JSON format response ...
(I can think of no reason, since this format is way easier to read and parse but has a detail level equivalent to JSON for this requirement)
I guess they could request it with BTC :)
(i.e. I'd prefer to not do it - so I'd prefer if no one made a BTC request)

Of course please be specific about what you want, if you do:
i.e. JSON in and out or leave the simple input format: "command[|option]" and just use JSON out
and give a sample JSON of what you think it should be (I'll decide the format myself if you can't specify it correctly)

Of course I'll allow both if someone 'requests' with BTC coz I WAY prefer the format I'm using since it is so much easier to parse and the data being transferred is fully handled by the format I'm using and does not require a more complex JSON format.
Good :) No reply to that :)

However, with such a high bounty, I'm sorta wondering about the lack of response I see to what's already done,
since it is pretty much finished except for the socket error messages I mentioned and of course anything that anyone else wants to point out is missing or not working.

So I'll ask directly ...
* DeathAndTaxes
* Gigasvps
* Tnkflx
* abracadabra
* Red Emerald
* ThiagoCMC
* gnar1ta$
* Chefnet

Any of you got any comment or issues or requests?
(and if any of you guys specifically require the JSON format then it's no extra - but again I'm not sure why anyone would need it)

Current command set with an example (unformatted) reply is:
apiversion
 '0.3'

devs
 'STATUS=S,CODE=9,MSG=2 GPU(s) - 0 CPU(s)|GPU=0,GT=75.00,FR=3355,FP=85,EN=Y,STA=ALIVE,MHS=357.87,A=247,R=47,HW=0,U=0.35,I=9|GPU=1,GT=69.50,FR=2573,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=269,R=19,HW=0,U=0.38,I=9|'

pools
 'STATUS=S,CODE=7,MSG=1 Pool(s)|POOL=0,URL=http://0.0.0.0:0,STA=ALIVE,PRI=0,LP=N,Q=59499,A=517,R=66,DW=10071,ST=0,GF=65,RF=0|'

summary
 'STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,ST=0,GF=65,LW=0,RO=0,BC=2801|'ST=0,GF=65,LW=0,RO=0,BC=2801|'

gpudisable|0
 'STATUS=I,CODE=12,MSG=GPU 0 set disable flag|'
  In cgminer you'll see something like:
   [2011-11-30 08:28:48] Thread 2 being disabled
   [2011-11-30 08:28:48] Thread 0 being disabled

gpuenable|0
 'STATUS=I,CODE=5,MSG=GPU 0 sent enable message|'
  In cgminer you'll see something like:
   [2011-11-30 08:29:16] Thread 0 being re-enabled
   [2011-11-30 08:29:16] Thread 2 being re-enabled

gpurestart|0
 'STATUS=I,CODE=13,MSG=GPU 0 restart attempted|'
  In cgminer you'll see something like:
   [2011-11-30 08:30:31] Thread 0 still exists, killing it off
   [2011-11-30 08:30:31] Thread 2 still exists, killing it off
   [2011-11-30 08:30:31] Thread 0 restarted
   [2011-11-30 08:30:31] Thread 2 restarted

gpu|1
 'STATUS=S,CODE=17,MSG=GPU1|GPU=1,GT=69.00,FR=2575,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=271,R=19,HW=0,U=0.38,I=9|'

cpu|0 (I'm only running GPU mining so I get this error message
 'STATUS=E,CODE=16,MSG=No CPUs|'

gpucount
 'STATUS=S,CODE=20,MSG=GPU count|GPUS,COUNT=2|'

cpucount
 'STATUS=S,CODE=21,MSG=CPU count|CPUS,COUNT=0|'


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: Red Emerald on November 29, 2011, 09:46:12 PM
Glad to see this is coming along.  I guess plain sockets are okay instead of JSON since it isn't too difficult to parse.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: lueo on November 30, 2011, 03:05:04 AM
Hey... Glad to see your effort. But have you notice that I am also running for the bounty?

In my opinion, JSON format are more useful for future usage. If we had defined a proper protocol for control miners, then every miners could be controlled by ANY kinds of user interface (e.g. GUI, Web, text, command line... even by your iPhone!)

However, if anyone found kano's solution useful and fullfill the needs, feel free to pay out the bounty!

Though ... if someone actually has some really unexpected need for a JSON format response ...
(I can think of no reason, since this format is way easier to read and parse but has a detail level equivalent to JSON for this requirement)
I guess they could request it with BTC :)
(i.e. I'd prefer to not do it - so I'd prefer if no one made a BTC request)

Of course please be specific about what you want, if you do:
i.e. JSON in and out or leave the simple input format: "command[|option]" and just use JSON out
and give a sample JSON of what you think it should be (I'll decide the format myself if you can't specify it correctly)

Of course I'll allow both if someone 'requests' with BTC coz I WAY prefer the format I'm using since it is so much easier to parse and the data being transferred is fully handled by the format I'm using and does not require a more complex JSON format.
Good :) No reply to that :)

However, with such a high bounty, I'm sorta wondering about the lack of response I see to what's already done,
since it is pretty much finished except for the socket error messages I mentioned and of course anything that anyone else wants to point out is missing or not working.

So I'll ask directly ...
* DeathAndTaxes
* Gigasvps
* Tnkflx
* abracadabra
* Red Emerald
* ThiagoCMC
* gnar1ta$
* Chefnet

Any of you got any comment or issues or requests?
(and if any of you guys specifically require the JSON format then it's no extra - but again I'm not sure why anyone would need it)

Current command set with an example (unformatted) reply is:
apiversion
 '0.3'

devs
 'STATUS=S,CODE=9,MSG=2 GPU(s) - 0 CPU(s)|GPU=0,GT=75.00,FR=3355,FP=85,EN=Y,STA=ALIVE,MHS=357.87,A=247,R=47,HW=0,U=0.35,I=9|GPU=1,GT=69.50,FR=2573,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=269,R=19,HW=0,U=0.38,I=9|'

pools
 'STATUS=S,CODE=7,MSG=1 Pool(s)|POOL=0,URL=http://0.0.0.0:0,STA=ALIVE,PRI=0,LP=N,Q=59499,A=517,R=66,DW=10071,ST=0,GF=65,RF=0|'

summary
 'STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,ST=0,GF=65,LW=0,RO=0,BC=2801|'ST=0,GF=65,LW=0,RO=0,BC=2801|'

gpudisable|0
 'STATUS=I,CODE=12,MSG=GPU 0 set disable flag|'
  In cgminer you'll see something like:
   [2011-11-30 08:28:48] Thread 2 being disabled
   [2011-11-30 08:28:48] Thread 0 being disabled

gpuenable|0
 'STATUS=I,CODE=5,MSG=GPU 0 sent enable message|'
  In cgminer you'll see something like:
   [2011-11-30 08:29:16] Thread 0 being re-enabled
   [2011-11-30 08:29:16] Thread 2 being re-enabled

gpurestart|0
 'STATUS=I,CODE=13,MSG=GPU 0 restart attempted|'
  In cgminer you'll see something like:
   [2011-11-30 08:30:31] Thread 0 still exists, killing it off
   [2011-11-30 08:30:31] Thread 2 still exists, killing it off
   [2011-11-30 08:30:31] Thread 0 restarted
   [2011-11-30 08:30:31] Thread 2 restarted

gpu|1
 'STATUS=S,CODE=17,MSG=GPU1|GPU=1,GT=69.00,FR=2575,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=271,R=19,HW=0,U=0.38,I=9|'

cpu|0 (I'm only running GPU mining so I get this error message
 'STATUS=E,CODE=16,MSG=No CPUs|'

gpucount
 'STATUS=S,CODE=20,MSG=GPU count|GPUS,COUNT=2|'

cpucount
 'STATUS=S,CODE=21,MSG=CPU count|CPUS,COUNT=0|'


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: kano on November 30, 2011, 04:54:58 AM
Well lueo all good and nice except for 2 things:
1) DeathAndTaxes, tnkflx and abracadabra already mentioned (and the thread title) that they wanted a cgminer fork, not a Python version of it - and adjusting the cgminer code is required to do all the things requested - so although you may put a wrapper around cgminer, programming the 'C' changes are necessary ... and since I've already posted all that on my git ... and you've already stated you don't know 'C' very well ... um I think your missing the point that you've not done what the bounty requires
2) I've already got a response from ckolivas that he will add it into his git when it's finished

and I have above stated if any of the original people who put up the bounty say they must have JSON, then I'll add it.
(it's not difficult to add, just it seems pointless to me as I have said in a few posts as to why)
But if anyone else wants it they can add to the bounty :P

I will also add so you know - building a windows version of cgminer is a nightmare :)

Lastly - does anyone who put up the bounty disagree with what I've said?

Edit: oops :) I forgot to mention.
If you check my git I've just added API.java (and API.class) a java version of api-example.php since almost everyone on the planet has java on their PC (or can get it easily) that gives another way for anyone to try it out.
Usage for API.java is (as written in the top of the code)
  java API command IP port
(if any are missing or blank they are replaced with the defaults: command='summary' IP='127.0.0.1' port='4028')
Oh and IP can be a hostname or an IP address


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: lueo on November 30, 2011, 06:28:44 AM
Dear Kano,

First of all, thanks for your effort so that all of the cgminer users could benefit from it. If anyone believe it deserve the bounty then go ahead.

However, in my opinion, according to the requirement, I don't think it's necessary to use 'C' language or modify cgminer to achieve those requirements. Forking it or modify it is just a bonus.

All we want is a daemon that could accept JSON RPC to control GPU and cgminer, monitoring GPU status and miner status.

Quote
The daemon should respond to the following RPC (at a minimum) to satisfy the bounty:
* Start/stop/restart individual GPUs (on restart recheck config file for any changes)
* Shutdown instance (stop all GPU, and end cgminer)
* Report current monitors (a min of current temp/load/clock/hashing speed)
* Report global output (a min of total shares, accepted shares, rejected shares, stale shares, etc)
* Report individual card output (same but on per card basis)
* Report any failures (a min of card down & pool not responding)

Obviously more advanced features could be added in the future (changing clock speeds, voltage, intensity, etc) however those could be handled by future bounties/donations once project is up and running.  This is just a rough draft but the hope is it will spark attention of potential developers and further discussion among those interested in RPC capable cgminer.
All the requirement could be achieved via a modified version of guiminer. I've already done a daemon via guiminer. But guiminer could neither monitor GPU status nor could it receive JSON RPC, so I am working on my own daemon and GUI. What I want is cgminer could be extensible in the future.

The prototype could be check on http://github.com/lueo/poclbm (http://bit.ly/unibFd). A running instance is attached below:

https://lh4.googleusercontent.com/-h4Hrtgab7-s/TtXJwl6wVOI/AAAAAAAAB-o/sUiH_DeZ8bI/s800/individual.jpg
https://lh6.googleusercontent.com/-nTLSYrUVThI/TtXNi7lZjVI/AAAAAAAAB-4/lcJHOLPMJ0w/s800/setting.jpg

Well lueo all good and nice except for 2 things:
1) DeathAndTaxes, tnkflx and abracadabra already mentioned (and the thread title) that they wanted a cgminer fork, not a Python version of it - and adjusting the cgminer code is required to do all the things requested - so although you may put a wrapper around cgminer, programming the 'C' changes are necessary ... and since I've already posted all that on my git ... and you've already stated you don't know 'C' very well ... um I think your missing the point that you've not done what the bounty requires
2) I've already got a response from ckolivas that he will add it into his git when it's finished

and I have above stated if any of the original people who put up the bounty say they must have JSON, then I'll add it.
(it's not difficult to add, just it seems pointless to me as I have said in a few posts as to why)
But if anyone else wants it they can add to the bounty :P

I will also add so you know - building a windows version of cgminer is a nightmare :)

Lastly - does anyone who put up the bounty disagree with what I've said?

Edit: oops :) I forgot to mention.
If you check my git I've just added API.java (and API.class) a java version of api-example.php since almost everyone on the planet has java on their PC (or can get it easily) that gives another way for anyone to try it out.
Usage for API.java is (as written in the top of the code)
  java API command IP port
(if any are missing or blank they are replaced with the defaults: command='summary' IP='127.0.0.1' port='4028')
Oh and IP can be a hostname or an IP address


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: abracadabra on November 30, 2011, 02:02:48 PM
Kano, sorry haven't checked this thread recently, with Thanksgiving last week. Didn't realize someone was going to take this on so quickly (and cheaply  ;D j/k)

Anyways.. see my comments inline below.. please forgive the newbishness of some of my questions..

https://github.com/kanoi/cgminer

API v0.1

Includes a sample api-example.php


The .php would be run locally?

Quote
6 files added/changed from current ckolivas master:

main.c, miner.h, AUTHORS, api.c, api-example.php, Makefile.am

(also has the updated linux-usb-cgminer)

OK so this obviously isn't final (though it does work fine for me)

Anyone who can build their own cgminer and is interested could you have a look?

Not sure if this should have been mentioned earlier, but I need a windows version and unfortuantely I can't build from scratch.  :-[

Quote
It currently has 3 API commands:
apiversion - returns a version string "0.1"
dev - returns a status string of all the devices (CPU and or GPU)
pool - returns a status string of all the pools

Do the status strings differentiate the data returned as to which "rig" and which GPU on said "rig"? ie.  Is the name of the "rig" returned with the status string? Or we have to remember which one were were just talking to when we got the status return?

Quote
The included PHP file (api-example.php) simply converts the returned string into a data structure
Very simple and very easy in PHP the way I've done it.

No I'm not expecting people to give me bitcoins yet ... :)

The 3 main questions I have are:
1) what other API commands do people want
2) what parameters should I add to cgminer: --api-port = 4028, --api-address = 127.0.0.1, --api-access = 192.168.5.* and anything else?

I'm assuming --api-port & --api-address is the port and address of the actual "rig" we are talking to? --api-access is the ip of the computer allowed to communicate with the rig?

Quote
the numbers shown are of course examples :)
(I haven't added any parameters yet)
3) what socket I/O do people want: by this I mean: default port and access restriction.
It currently runs on port 4028 and only listens on 127.0.0.1 - for security reasons of course.

I guess I don't get this.  I understand listening port, but what other ip would the "rig" running cgminer listen to other than it's own?

Quote
Edit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?

No idea what this means.

Quote
Edit2: minor change - it wasn't closing the connection if an invalid command was sent

Edit3: added 'quit' and 'summary'

Do you have any screenshots of what frontend you have running for you right now?

Thanks!


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: abracadabra on November 30, 2011, 02:07:11 PM
...
So ... what's missing?

The Windows version? ;-)

+1


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: abracadabra on November 30, 2011, 02:14:55 PM
If a reply returns multiple sets of data (e.g. multiple pools) then it will just be multiple "type=value,...|" sections.
e.g. POOL=0,URL=http://url.com:8223,MHS=30000.00,...|POOL=1,URL=http://url2.com:8888,MHS=10000.00,...|

By "multiple pools" I assume you mean when you have cgminer setup to have a backup pool? Not sure, since that's not a feature of cgminer I use.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: abracadabra on November 30, 2011, 02:19:45 PM

I will also add so you know - building a windows version of cgminer is a nightmare :)


I thought that's what the majority of the bounty was for!  ;D

Quote
Lastly - does anyone who put up the bounty disagree with what I've said?

I agree, but seeing the screenshots from lueu's project, makes me interested in what is going on there too  ;)



Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: DeathAndTaxes on November 30, 2011, 02:36:05 PM
A long post but I wanted to wrap up a couple of different issues all at once.

Very rapid development:
I also wasn't expecting such a rapid development, it kinda caught me off guard.  Not that this is a bad thing just unexpected.

Clarification of the bounty:
As I indicated in the thread my bounty is for a fork of cgminer or integration into cgminer mainline.  While maybe I was unclear (if so I apologize) I have no need/desire for a wrapper in an alternate language.  My experience in project development tells me that will make forward compatibility tough and likely require never ending "mainteance bounties" to keep current.  Sorry lueo you front end looks nice and people will need front ends so hopefully the front end work isn't wasted and can be adapted.  This bounty is for the cgminer modification but I am sure other projects/bounties will be required for the remote control application.

Speaking for others:
I can't speak for all of those pledging funds on if a wrapper is compatible w/ the goals of the project.  I am assuming (possibly incorrectly) they feel the same as me. To anyone pledging a clarification on if a wrapper is acceptable to the terms of the project would be appreciated.

I will be out of the loop:
I am going on a cruise this Friday, need to pack, and am swamped at work wrapping up things before I am gone for a week.  I won't have time to test anything before I get back.  Sorry Kano just bad timing.  Everything you have shown looks good and on paper is exactly what I was looking for when I started the thread.  If what you have developed is as presented I don't see an issue w/ awarding the bounty but for me it won't be until Dec 11th at the earliest.

Windows support:
Since cgminer supports both Linux & Windows I think it is assumed that any code which qualifies for the bounty must work on both operating systems.  Personally I don't really care as my rigs are linux but others likely do and it would be "clunky" to have a portion which only compiles in Linux.  I feel the pain of anyone trying to get the code working in Windows but that is likely non-negotiable.
Note to self reading the entire thread helps.  kano already published a windows version.

In my absence:
To any of the others w/ pledges if anyone feels the work completed meets the requirements for the bounty then no need to wait for me to get back to award some/all funds.  I will award once I get back but my absence shouldn't be taken as putting things on hold.

Sockets vs. JSON:
 In the OP I indicated JSON was acceptable but not required.  As far as I know nobody indicated dissatisfaction w/ that requirement.   My personal position is still the same.  I have done extensive windows development work w/ sockets so that is a non-issue for me.  If anyone who has pledged funds feels otherwise please speak up now.  It is unfair for developers to labor under false constraints and waste time.  

Fork vs Mainline:
Since there is a "Bonus" of 25 BTC for integration into the mainline, if kano code is acceptable and ckolivas integrates it I think a fair split would be the main bounty to Kano and the "bonus" to ckolivas.  I will add another 5 BTC to the "bonus" portion.  Obviously it is up to each individual awarding but I think that is the best way to encourage mainline integration.  Hopefully this clears up some of the vagueness about "who" gets the bonus if integrated into the mainline.

To YOU reading right now who haven't pledged (my soap box):
It makes me embarrassed by how little ckolivas has been compensated for all his hard work.  
Goddamnit that's the sum total of how much I've earned in donations in total for cgminer  >:(
If this project is interesting to you then here is a chance to make it right.  Pledge 1, 2 or 5 BTC towards the mainline integration "bonus" portion.  I have written shareware poker apps which generated 5 figures in revenue.  It is beyond sad that such an amazing project (which likely has required hundreds of hours) is so under-compensated.  If you don't support developers then don't complain when projects stall and die.  Saying "great work" is one thing putting your money where your mouth is means a lot more.  


Conclusion:
Wow that was lot.  If you are paying for internet by the bit/byte well I am sorry.  ;D
If anyone who has pledged has a disagreement with what I wrote please state so in the thread.  This isn't a dictatorship it is more like herding cats.  I can only speak for "my funds" and anything I say should be taken like that.

The future ....(will he ever shut up)
web developers & android developers ... obviously RPC miner will need some remote front ends to be useful.  I am already thinking of web front end & android app front ends which connect to cgminerRPC.  Obviously that would be a separate projects/bounties but I am willing to put some funds towards that too.  Nothing formal yet and it likely won't happen (unless started by someone else) until I get back but if you want a head start take a look at this thread and get thinking on how you would write your front end.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on November 30, 2011, 02:52:09 PM
+1

Plus maybe some testing by users.  Testing doesn't need only be done by those who have pledged.  If you are interested in remote control cgminer, download it, use kano scripts to control it remotely and report back.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: -ck on November 30, 2011, 02:54:59 PM
For those talking about the windows version, perhaps you missed this:

Well after going through all the pain and agony of building a windows executable ...

It's here: https://github.com/kanoi/cgminer/downloads


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on November 30, 2011, 02:56:44 PM
For those talking about the windows version, perhaps you missed this:

Well after going through all the pain and agony of building a windows executable ...

It's here: https://github.com/kanoi/cgminer/downloads

Wow reading comprehension fail on my part.  Thanks.


Title: Re: Request for an RPC capable fork of cgminer (120 BTC pledged so far)
Post by: kano on November 30, 2011, 04:09:18 PM
Firstly ... and just in case it isn't obvious ...
I'm not asking anyone to pay me the bounty now.
I just want feedback to ensure it is what's required or what needs changing.
Of course once it is what's required ... then yes I'll be chasing bounties :)

abracadabra, I'll respond to each of your points since I guess others may not
fully understand what it does and how it works.

However, some of your questions are due to not reading all my posts.
I have posted quite a bit so yes unfortunately you should read them all :)

Anyway ...

Kano, sorry haven't checked this thread recently, with Thanksgiving last week. Didn't realize someone was going to take this on so quickly (and cheaply  ;D j/k)

Anyways.. see my comments inline below.. please forgive the newbishness of some of my questions..

https://github.com/kanoi/cgminer

API v0.1

Includes a sample api-example.php


The .php would be run locally?
The point of an RPC interface is something you can access to get information from cgminer
Currently, you look at the screen and respond with keystrokes to what you see :)

I've added a socket interface that anyone can access with software and also given 2 sample
programs that do that - api-example.php and API.class (API.java)

How the interface works is you simply either just run cgminer as you always do,
or use one or two of the new options.
the new cgminer always has the RPC interface available but by default only listens
to commands sent from the same computer it is running on.
the --api-listen option changes that to allow any computer that has network access
to the miner computer to send it commands.

The point of the RPC interface is so that you can control cgminer via software instead
of only via the keyboard - thus as an example you could write a web page using php
that shows you the status of the miner and also has options to send it commands

e.g. the simple api-example.php shows the basic rules of how to do that and then you just
add your own web page design on top of that.

Quote
Quote
6 files added/changed from current ckolivas master:

main.c, miner.h, AUTHORS, api.c, api-example.php, Makefile.am

(also has the updated linux-usb-cgminer)

OK so this obviously isn't final (though it does work fine for me)

Anyone who can build their own cgminer and is interested could you have a look?

Not sure if this should have been mentioned earlier, but I need a windows version and unfortuantely I can't build from scratch.  :-[
Yes as quoted by conman, there is a windows version to test it out

Quote
Quote
It currently has 3 API commands:
apiversion - returns a version string "0.1"
dev - returns a status string of all the devices (CPU and or GPU)
pool - returns a status string of all the pools

Do the status strings differentiate the data returned as to which "rig" and which GPU on said "rig"? ie.  Is the name of the "rig" returned with the status string? Or we have to remember which one were were just talking to when we got the status return?
The return data is from the rig you are talking to.
If you would like, I could add another option to cgminer --api-description that would be returned in the status section of the return data.
But of course, that would require you to specify that when you run cgminer.
Another option is I could return the hostname  or some windows equivalent, however that is not always useful unless you gave the computer a useful name when you set it up.
The --api-description idea is a very simple change so if that solves your problem, just say you want that.

Quote
Quote
The included PHP file (api-example.php) simply converts the returned string into a data structure
Very simple and very easy in PHP the way I've done it.

No I'm not expecting people to give me bitcoins yet ... :)

The 3 main questions I have are:
1) what other API commands do people want
2) what parameters should I add to cgminer: --api-port = 4028, --api-address = 127.0.0.1, --api-access = 192.168.5.* and anything else?

I'm assuming --api-port & --api-address is the port and address of the actual "rig" we are talking to? --api-access is the ip of the computer allowed to communicate with the rig?

Quote
the numbers shown are of course examples :)
(I haven't added any parameters yet)
3) what socket I/O do people want: by this I mean: default port and access restriction.
It currently runs on port 4028 and only listens on 127.0.0.1 - for security reasons of course.

I guess I don't get this.  I understand listening port, but what other ip would the "rig" running cgminer listen to other than it's own?
I updated that info later. Read past that post for the details of the 2 new cgminer options, however to explain the numbers:
It either listens on 127.0.0.1 or on 0.0.0.0
What 127.0.0.1 means is that it will only respond to a message sent from the mining computer to the address 127.0.0.1 - i.e. it is pretty secure.
What 0.0.0.0 means it will listen (and reply) to a message from any computer that has network access to it - i.e. this could be a security issue for some.
So the default is 127.0.0.1 (but --api-listen makes it the other)

Quote
Quote
Edit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?

No idea what this means.
ckolivas responded to that part of the post later.
I was simply verifying that what I thought was true was correct :)

Quote
Quote
Edit2: minor change - it wasn't closing the connection if an invalid command was sent

Edit3: added 'quit' and 'summary'

Do you have any screenshots of what frontend you have running for you right now?

Thanks!
I simply just run api-example.php at a termina/command prompt (or API.class)
So the last post where I posted all the output is what I see in my terminal excluding the reformatted data
(since it's the same data but just formatted neatly)
https://bitcointalk.org/index.php?topic=52466.msg634588#msg634588

Also, only 4 of the commands show anything on the cgminer screen:
cguenable|N, gpudisable|N, gpurestart|N, quit
The first 3 show as I said above in that link, and of course quit makes cgminer exit.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on November 30, 2011, 04:23:25 PM
Ok I lied about not testing.
I dropped a copy into a windows development box at work.

Tried using API.class to connect to cgminer.

Code:
C:\bitcoin\cgminer-2.0.8-remote>java API
Attempting to send 'summary' to 127.0.0.1:4028
java.net.SocketException: Software caused connection abort: recv failed

The RPC version is listening on 127.0.0.1 by default right? I shouldn't need to add anything to the config.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on November 30, 2011, 05:00:35 PM
Ok I lied about not testing.
I dropped a copy into a windows development box at work.

Tried using API.class to connect to cgminer.

Code:
C:\bitcoin\cgminer-2.0.8-remote>java API
Attempting to send 'summary' to 127.0.0.1:4028
java.net.SocketException: Software caused connection abort: recv failed

The RPC version is listening on 127.0.0.1 by default right? I shouldn't need to add anything to the config.
Sigh - that's depressing :(
Maybe java on windows works differently on different versions of windows?

By default it listens on 127.0.0.1 (--api-listen means listen on 0.0.0.0)

But I'll state the obvious just in case ... cgminer should be saying 2.0.8w at the top of course.

What I've tried (and works fine for me):
php linux to linux miner
php linux to windows miner
java linux to linux miner
java linux to windows miner
java windows to windows miner
java windows to linux miner

So I have tried all combinations except php in windows.
My kids windows box is only WindowsXP Home (and it doesn't have php)

Maybe try to recompile the java? (javac API.java)
I 'compiled' the java on Linux FC12.

Googling I found comments of 'no idea' and 'possible networking problems'

Does the socket still exist? or has the socket thread crashed in cgminer?
(of course you can tell by simply trying again and see if it connects or not)

Which command did you send? Or is it all commands?

I'll write a little 'C' program tomorrow and compile it on windows also
so you can try that and see if it's windows or java
Also note if you run it with "--api-listen" you need to allow it in the firewall
(WindowsXP shows a popup to enable it in the firewall the first time you run it with --api-listen)
It's after 4am here so yeah I'm not gonna try writing any code this late :)


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on November 30, 2011, 05:12:45 PM
Does the socket still exist? or has the socket thread crashed in cgminer?
(of course you can tell by simply trying again and see if it connects or not)

Which command did you send? Or is it all commands?

Yes 2.08w is what is running.

Not sure if the socket still exists but subsequent commands give the same error.

The error occurs on all commands.  Well I only tested a half dozen but the simplest apiversion also gets the error.

Before you rip your hair out I am accessing the windows box (both cgminer & api.class are on the same box) via remote desktop from my work workstation.  Let me check when I get home it may be some "weirdness" w/ RDP.

Quote
It's after 4am here so yeah I'm not gonna try writing any code this late
Yeah no rush.  Get some sleep.


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: lueo on November 30, 2011, 05:47:48 PM
Dear DeathAndTaxes,

Thanks for your clarification. I will start up a new thread for my project. And, like I said, anyone who believe the bounty is fulfilled just go ahead.

Dear kano,

Yeah, you deserve the bounty according to the clarification. I really hope that JSON RPC could be added to cgminer, so that any GUI could call cgminer in a uniform way. For now we have to parse different output from different miners, it's painful.

A long post but I wanted to wrap up a couple of different issues all at once.

Very rapid development:
I also wasn't expecting such a rapid development, it kinda caught me off guard.  Not that this is a bad thing just unexpected.

Clarification of the bounty:
As I indicated in the thread my bounty is for a fork of cgminer or integration into cgminer mainline.  While maybe I was unclear (if so I apologize) I have no need/desire for a wrapper in an alternate language.  My experience in project development tells me that will make forward compatibility tough and likely require never ending "mainteance bounties" to keep current.  Sorry lueo you front end looks nice and people will need front ends so hopefully the front end work isn't wasted and can be adapted.  This bounty is for the cgminer modification but I am sure other projects/bounties will be required for the remote control application.

Speaking for others:
I can't speak for all of those pledging funds on if a wrapper is compatible w/ the goals of the project.  I am assuming (possibly incorrectly) they feel the same as me. To anyone pledging a clarification on if a wrapper is acceptable to the terms of the project would be appreciated.



Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: -ck on November 30, 2011, 10:50:33 PM
To YOU reading right now who haven't pledged (my soap box):
It makes me embarrassed by how little ckolivas has been compensated for all his hard work.  
Goddamnit that's the sum total of how much I've earned in donations in total for cgminer  >:(
If this project is interesting to you then here is a chance to make it right.  Pledge 1, 2 or 5 BTC towards the mainline integration "bonus" portion.  I have written shareware poker apps which generated 5 figures in revenue.  It is beyond sad that such an amazing project (which likely has required hundreds of hours) is so under-compensated.  If you don't support developers then don't complain when projects stall and die.  Saying "great work" is one thing putting your money where your mouth is means a lot more.  
Thanks very much for the sentiment. A few more people have donated, and some previous people have donated more since I made that comment. Indeed it was hundreds of hours as I spent the greater proportion of my time working on cgminer when I had 3 months off work.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on December 01, 2011, 07:06:11 PM
Ok I lied about not testing.
I dropped a copy into a windows development box at work.

Tried using API.class to connect to cgminer.

Code:
C:\bitcoin\cgminer-2.0.8-remote>java API
Attempting to send 'summary' to 127.0.0.1:4028
java.net.SocketException: Software caused connection abort: recv failed

The RPC version is listening on 127.0.0.1 by default right? I shouldn't need to add anything to the config.

So I never got it working under Windows even when on machine locally so it wasn't any weirdness w/ RDP.

Now I added the following to me config file.

Code:
"api-listen" : true,
"api-port" : "44444"

And it works. Even when connecting to 127.0.0.1.

If I take this out (which if I am understanding this right should still work connecting from local machine) then I get nothing (same error messages).

One change I would recommend (to assist w/ integration into mainline) is to have RPC turned off by default.  Not sure how you want to handle that (RPC off, local connection only, remote connection) but I think it would be best to have RPC disabled until explicitly enabled.  Not a huge issue but something to think about.

Still I have no idea why I can't connect from the same machine without adding the above to my config.  Didn't have much time to experiment but it looks good.


Some RPC calls
Code:
C:\bitcoin\cgminer-2.0.8-remote>java API apiversion 127.0.0.1 44444
Attempting to send 'apiversion' to 127.0.0.1:44444
Answer='0.3 '
[0.3 ] =>
(
   [0] => 0.3
)

C:\bitcoin\cgminer-2.0.8-remote>java API summary 127.0.0.1 44444
Attempting to send 'summary' to 127.0.0.1:44444
Answer='STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=492,ALGO=sse2_32,MHS=2277.80
,SOL=0,Q=286,A=263,R=0,HW=0,U=32.10,DW=4,ST=0,GF=0,LW=0,RO=0,BC=1| '
[STATUS] =>
(
   [STATUS] => S
   [CODE] => 11
   [MSG] => Summary
)
[SUMMARY] =>
(
   [SUMMARY] => all
   [EL] => 492
   [ALGO] => sse2_32
   [MHS] => 2277.80
   [SOL] => 0
   [Q] => 286
   [A] => 263
   [R] => 0
   [HW] => 0
   [U] => 32.10
   [DW] => 4
   [ST] => 0
   [GF] => 0
   [LW] => 0
   [RO] => 0
   [BC] => 1
)

C:\bitcoin\cgminer-2.0.8-remote>java API devs 127.0.0.1 44444
Attempting to send 'devs' to 127.0.0.1:44444
Answer='STATUS=S,CODE=9,MSG=6 GPU(s) - 0 CPU(s)|GPU=0,GT=0.00,FR=0,FP=0,EN=Y,STA
=ALIVE,MHS=387.40,A=38,R=0,HW=0,U=4.54,I=9|GPU=1,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIV
E,MHS=387.13,A=44,R=0,HW=0,U=5.26,I=9|GPU=2,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS
=373.15,A=44,R=0,HW=0,U=5.26,I=9|GPU=3,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS=372.
62,A=42,R=0,HW=0,U=5.02,I=9|GPU=4,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS=367.08,A=
44,R=0,HW=0,U=5.26,I=D|GPU=5,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS=384.05,A=54,R=
0,HW=0,U=6.46,I=9| '
[STATUS] =>
(
   [STATUS] => S
   [CODE] => 9
   [MSG] => 6 GPU(s) - 0 CPU(s)
)
[GPU0] =>
(
   [GPU] => 0
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 387.40
   [A] => 38
   [R] => 0
   [HW] => 0
   [U] => 4.54
   [I] => 9
)
[GPU1] =>
(
   [GPU] => 1
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 387.13
   [A] => 44
   [R] => 0
   [HW] => 0
   [U] => 5.26
   [I] => 9
)
[GPU2] =>
(
   [GPU] => 2
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 373.15
   [A] => 44
   [R] => 0
   [HW] => 0
   [U] => 5.26
   [I] => 9
)
[GPU3] =>
(
   [GPU] => 3
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 372.62
   [A] => 42
   [R] => 0
   [HW] => 0
   [U] => 5.02
   [I] => 9
)
[GPU4] =>
(
   [GPU] => 4
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 367.08
   [A] => 44
   [R] => 0
   [HW] => 0
   [U] => 5.26
   [I] => D
)
[GPU5] =>
(
   [GPU] => 5
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 384.05
   [A] => 54
   [R] => 0
   [HW] => 0
   [U] => 6.46
   [I] => 9
)

C:\bitcoin\cgminer-2.0.8-remote>
[/code][/code]


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 02, 2011, 02:25:29 AM
OK, I'll put in permanent debug so it can be checked with the --debug option if ever needed (and needed now)

hmm maybe MS have done something strange about port numbers?
What Windows OS are you running on?
It really should just be 0-1024 is restricted but all the rest should work the same.
Since I use 4028 by default - could you try that with the config file and see if it is simply just the port number?
I don't know what DTServer is - but: http://tcp-udp-ports.com/port-4028.htm
(though a bit of googling found one app that uses the webcam on that port)

I've written the .c api interface example, works fine on linux but having trouble with it on windows ...
I'll sort that out tonight and also correct all the socket error message code on windows then too.

RPC off by default ... I guess I could do that by giving "--api-listen" 3 options: 'off' (default), 'network' or 'local'
(so without it, it defaults to 'off')
That sound OK - or got another preference?


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on December 02, 2011, 02:43:32 AM
OK, I'll put in permanent debug so it can be checked with the --debug option if ever needed (and needed now)

hmm maybe MS have done something strange about port numbers?
What Windows OS are you running on?
It really should just be 0-1024 is restricted but all the rest should work the same.
Since I use 4028 by default - could you try that with the config file and see if it is simply just the port number?
I don't know what DTServer is - but: http://tcp-udp-ports.com/port-4028.htm
(though a bit of googling found one app that uses the webcam on that port)

Well nobody has reported it yet but me so it may be an issue w/ my system.  I am running Windows 7 Professional x64.  Unless someone else reports an issue I would chalk it up to a system specific bug.  I am leaving for my cruise tomorrow (woot) so I won't be able to do any more testing for a week.  I like what I see so far, seems very solid.  Once I manually enabled api-listen and set a port I haven't encountered any errors, bugs, or unexpected results.  No crashes or instability on the miner side either.

Quote
RPC off by default ... I guess I could do that by giving "--api-listen" 3 options: 'off' (default), 'network' or 'local'
(so without it, it defaults to 'off')
That sound OK - or got another preference?

That works for me.  At this point it doesn't matter so much but IMHO it makes for a better design (and easier integration to the mainline) if a potential attack vector must be explicitly enabled.

Anyways can't wait to see what it looks like in a week.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 02, 2011, 01:56:01 PM
Added another commit of the api-example.c that works in both windows and linux
https://github.com/kanoi/cgminer/commit/c33553d5a65556a4802bea6ec251e7aa80b809d5
and the downloads includes the windows binary api-example.exe

Made a few other changes not yet up in the git:
I've fixed the windows socket error messages and ended up making the api options a bit different again ...
This seems to be the easiest:
 --api-listen (boolean - default is off which means the api thread doesn't wait for connections, specifying it means to turn on the api socket)
 --api-network (boolean - default is off which means only 127.0.0.1 can connect it if is listening, specifying it means anything with netowrk access can connect to cgminer)

Added debug to be able to see what's happening with sends/recvs

Next change - I'll enhance the apiversion command (and just rename it to 'version')
It will return the api version and the cgminer version

Lastly I think I'll change all the field names to actual names - e.g. like for a GPU, instead of "R=0" it will say something like "Rejected=0"
That way everyone isn't trying to translate the codes, cgminer will do it correctly already (also the data quantity is quite small ...)

Lastly, I'll add an identifier to the [STATUS] section (as stated above) --api-description (defaults to "cgminer" or some such)
So if you specify --api-description "7990" it will return that at the bottom of every status section reply


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: jamesg on December 02, 2011, 02:18:50 PM
Added another commit of the api-example.c that works in both windows and linux
https://github.com/kanoi/cgminer/commit/c33553d5a65556a4802bea6ec251e7aa80b809d5
and the downloads includes the windows binary api-example.exe

Made a few other changes not yet up in the git:
I've fixed the windows socket error messages and ended up making the api options a bit different again ...
This seems to be the easiest:
 --api-listen (boolean - default is off which means the api thread doesn't wait for connections, specifying it means to turn on the api socket)
 --api-network (boolean - default is off which means only 127.0.0.1 can connect it if is listening, specifying it means anything with netowrk access can connect to cgminer)

Added debug to be able to see what's happening with sends/recvs

Next change - I'll enhance the apiversion command (and just rename it to 'version')
It will return the api version and the cgminer version

Lastly I think I'll change all the field names to actual names - e.g. like for a GPU, instead of "R=0" it will say something like "Rejected=0"
That way everyone isn't trying to translate the codes, cgminer will do it correctly already (also the data quantity is quite small ...)

Lastly, I'll add an identifier to the [STATUS] section (as stated above) --api-description (defaults to "cgminer" or some such)
So if you specify --api-description "7990" it will return that at the bottom of every status section reply

Kano, thank you for all of your hard work on this feature.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 03, 2011, 01:41:55 PM
My git ( https://github.com/kanoi/cgminer ) has been updated with the changes:
(called it 2.0.8x)

Renamed the 'apiversion' command to just 'version' and it now returns a structure like the rest - now with 2 fields:
   [CGMiner] => 2.0.8x
   [API] => 0.5

Changed all the return field names everywhere to be descriptions (except 2: URL, MHS)

Added all the other ADL GPU properties that cgminer knows to the GPU status fields
(GPU Clock, Memory Clock, GPU Voltage, GPU Activity, Powertune)
Not sure why I forgot them before :P

Added a new cgminer option: --api-description
This is added to the end of the STATUS section of all replies as [Description] => string
(default is the software version, currently cgminer 2.0.8x)

In the downloads section on my git I've uploaded the cgminer-2.0.8x version of the Linux executable (replacing the cgminer-2.0.8w version)

I'll try to make a windows binary tomorrow.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 04, 2011, 01:02:42 PM
OK windows binary 2.0.8x in my git download now also https://github.com/kanoi/cgminer/downloads
Use the two 2.0.8w DLLs there if you don't already have them.

All source updated in my GIT also https://github.com/kanoi/cgminer

Made one extra change that removes the need for the 2 extra inet_* functions I added coz they were missing from windows, but there are others that do the same job that do exist in windows (and linux of course)
and I also found that the code might? have been causing issues with connecting so that may have been DeathAndTaxes problem also - though it worked fine on my XP-Home before so I'm not exactly sure if that was the cause

This is now ready as far as I can tell.
Anything else missing?

The last thing left for me to do is update the doc files - but I'll do that when it's clear it's got all the required code done.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 07, 2011, 10:59:22 AM
Sheesh there really isn't much interest?

Anyway - rather than just having an API I decided to write a PHP web page that uses the API
Very simple (though of course I may make some minor future changes)
Main reason was so I could actually look at it via a web page :P

It's in my git: miner.php ( https://github.com/kanoi/cgminer/blob/master/miner.php )

Now some help to actually use it :)

Firstly I'll assume you are using xubuntu and my linux install script.
If not, well then wipe your miner and start again with my install script :D :D
Or work it out yourself but it should be similar.

Anyway, with xubuntu 11.04:

start cgminer with the extra red options:
 cgminer -c kanocoin.conf --auto-cpu --auto-gpu -I 9 --api-listen --api-description "My Miner PC"
(of course you can call it whatever you like ...)

(this takes up about 50Mb of USB space)
 sudo apt-get install apache2
 sudo apt-get install php5
 sudo /etc/init.d/apache2 reload

Then copy miner.php into /var/www/
something like:
 sudo cp miner.php /var/www/
From the directory wherever you managed to copy miner.php

Then view the page with something like: http://computerIP/miner.php
(where computerIP is of course the IP address of the miner computer)

If you were wondering what the actual IP address of the miner is:
 sudo ifconfig
It should usually be the 2nd line of 'eth0' after it says 'inet addr:'

You can of course also use the miner.php running on any computer on your network that has apache and php ...
as long as you also add --api-network to cgminer when you run it.
Then also set the '$miner' variable at the top of miner.php to the address of the PC running cgminer

Free extra :) YMMV

Edit: hmm I think I need to revise the "MHS" fields in the API output.
I'll change them soon - to show/add "MHS av" and "MHS 5s"  wherever possible


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: Red Emerald on December 07, 2011, 07:32:16 PM
Looking great.  When I get a chance (probably this weekend), I will get it running on my miner.

I'm assuming we pay the bounty once its stable?


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 07, 2011, 09:06:13 PM
As soon as you like :D :D

But yeah I'll make one more change myself as I said above (the MHS fields need 'adjusting')

Of course it won't get into the main git until it's ready to go there so the sooner everyone actually checks it and says nothing is missing the sooner everyone can pay the first part of the bounty and thus the sooner I can pass it onto ckolivas to add it to his git and then you can pay him too :)

Just noticed in the first post - it's 125 BTC + 30 BTC not 120+30 :)


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 08, 2011, 12:47:57 PM
Adjusted MHS version (2.0.8y) now in my git downloads:
https://github.com/kanoi/cgminer/downloads

(source in the git as usual)

This shows the MHS fields as "MHS av" for SUMMARY
For CPU and GPU it shows "MHS av" and "MHS 5s"
(though the '5' in '5s' is actually whatever the "--log|-l <arg>" is set to - it defaults to 5)

Also the API version is 0.6 for 2.0.8y

I've put up 3 versions downloadable:
linux 2.0.8y GPU miner
windows 2.0.8y GPU miner
windows 2.0.8y CPU miner (this is the one I test, the above one is just this with GPU enabled that I can't test)


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: abracadabra on December 10, 2011, 05:24:12 PM
kano,

I'm going to start installing this on a few of my rigs.  I should have some feedback for you soon :)


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: runeks on December 11, 2011, 11:08:17 AM
What would be a good way of connecting to cgminer in Python code? I tried using this (https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Python) example from the Bitcoin client. But I get a "Connection reset by peer" error:

Code:
>>> from jsonrpc import ServiceProxy
>>> access = ServiceProxy("http://127.0.0.1:4028")
>>> access.getinfo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "jsonrpc/proxy.py", line 42, in __call__
    respdata = urllib.urlopen(self.__serviceURL, postdata).read()
  File "/usr/lib/python2.7/urllib.py", line 86, in urlopen
    return opener.open(url, data)
  File "/usr/lib/python2.7/urllib.py", line 207, in open
    return getattr(self, name)(url, data)
  File "/usr/lib/python2.7/urllib.py", line 343, in open_http
    errcode, errmsg, headers = h.getreply()
  File "/usr/lib/python2.7/httplib.py", line 1099, in getreply
    response = self._conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1027, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
    line = self.fp.readline()
  File "/usr/lib/python2.7/socket.py", line 430, in readline
    data = recv(1)
IOError: [Errno socket error] [Errno 104] Connection reset by peer
>>> access = ServiceProxy("http://127.0.0.1:4028")

cgminer 2.0.8y is running and it says "API running in restricted access mode" in the log. "netstat -n|grep 4028" doesn't show any output (should it?).


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 11, 2011, 11:20:52 AM
It's a socket, not a web server :)

http://docs.python.org/howto/sockets.html

If you look at the php, java or C code, you'll see that it's a simple TCP socket you connect to, send one string (the command), receive a reply and then close the socket.
Very quick and very simple.
That link above should help you with the 4 commands necessary to do that.
(plus one to initialise the socket)

On the miner
 sudo netstat -na | grep 4028
should give 2 different responses if you used --api-listen

1) If you have also used --api-network:
  tcp        0      0 0.0.0.0:4028            0.0.0.0:*               LISTEN

2) If you haven't also used --api-network:
  tcp        0      0 127.0.0.1:4028          0.0.0.0:*               LISTEN


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: DeathAndTaxes on December 11, 2011, 03:06:42 PM
Kano,
I just got back from my vacation.  Hopefully tonight or tomorrow I will be able to test latest version.  Looks good so far.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: tnkflx on December 11, 2011, 06:33:47 PM
Kano,

Sorry about the long wait, I'm going to test this as soon as I can find some time... Hopefully this evening or tomorrow ;-)


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: runeks on December 11, 2011, 11:26:47 PM
It's a socket, not a web server :)

http://docs.python.org/howto/sockets.html

[...]
Thank you Sir! I will be looking in to that.

netstat -na displays a listening cgminer. It seems it was the missing -a switch that made it not show sockets on localhost.

By the way, is this (https://bitcointalk.org/index.php?topic=52466.msg634588#msg634588) the most official description of the various API functions, or is there another place for that documentation?


Title: Re: Request for an RPC capable fork of cgminer (120/145 BTC pledged so far)
Post by: runeks on December 12, 2011, 02:42:48 AM
First of all, thank you for extending cgminer with this functionality! I'm planning on using it to control my Bitcoin Radiator (yes, that's right, stay tuned for updates), so it comes in handy for me. With regards to JSON, I disagree a bit on your position, but don't take that as me not appreciating your work.

Though ... if someone actually has some really unexpected need for a JSON format response ...
(I can think of no reason, since this format is way easier to read and parse but has a detail level equivalent to JSON for this requirement)
One reason for the JSON format would be that most languages has an implementation of it already. Thus no JSON parsing would be written, it would be handled by a separate library that has been written already. The following line in Python would replace a custom implementation of parsing your custom format:

Code:
obj = json.load(msg)

So I guess the reason to choose the JSON format is because it reduces redundancy. Chances are that in whichever language one chooses to write an application that wants to control cgminer, this language already has a JSON parsing implementation. You've written an implementation of your format in php, I'll have to write an implementation in Python, and someone who wants to use Ruby will have to write an implementation in Ruby, and so on and so forth for C, C++, Perl, bash, JavaScript, etc.


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 12, 2011, 05:38:08 AM
Actually ... I've written and supplied the basics in C, Java and PHP ...
If you can't work out the VERY simple code to parse the output from one of those 3 languages, then ...

As I've said before, if anyone wants JSON they can add to the bounty.
No one replied (fortunately) so it hasn't been added.
I also said that if anyone was already listed in the bounty for me; then if they want it I guess I'll add it for them.
Again, no reply to that either so JSON is out :)


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: runeks on December 12, 2011, 10:01:27 AM
I tried translating your PHP example directly to Python. Does this look right?

Code:
'STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=42875,ALGO=sse2_64,MHS=722.96,SOL=583,Q=59563,A=517,R=66,HW=0,U=0.72,DW=10075,ST=0,GF=65,LW=0,RO=0,BC=2801|'
becomes
{'STATUS': {'STATUS': 'S', 'MSG': 'Summary', 'CODE': '11'}, 1: {'A': '517', 'EL': '42875', 'RO': '0', 'LW': '0', 'BC': '2801', 'SOL': '583', 'SUMMARY': 'all', 'Q': '59563', 'GF': '65', 'R': '66', 'U': '0.72', 'ALGO': 'sse2_64', 'DW': '10075', 'HW': '0', 'ST': '0', 'MHS': '722.96'}, 'SUMMARY': {'A': '517', 'EL': '42875', 'CODE': '11', 'STATUS': 'S', 'SOL': '583', 'SUMMARY': 'all', 'Q': '59563', 'R': '66', 'U': '0.72', 'ALGO': 'sse2_64', 'MSG': 'Summary', 'DW': '10075', 'HW': '0', 'MHS': '722.96'}}

'STATUS=S,CODE=17,MSG=GPU1|GPU=1,GT=69.00,FR=2575,FP=56,EN=Y,STA=ALIVE,MHS=365.10,A=271,R=19,HW=0,U=0.38,I=9|'
becomes
{'STATUS': {'STATUS': 'S', 'MSG': 'GPU1', 'CODE': '17'}, 'GPU1': {'FP': '56', 'A': '271', 'FR': '2575', 'GT': '69.00', 'STA': 'ALIVE', 'I': '9', 'HW': '0', 'EN': 'Y', 'U': '0.38', 'GPU': '1', 'R': '19', 'MHS': '365.10'}}

'STATUS=S,CODE=20,MSG=GPU count|GPUS,COUNT=2|'
becomes
{'STATUS': {'STATUS': 'S', 'MSG': 'GPU count', 'CODE': '20'}, 'GPUS': {0: 'GPUS', 'COUNT': '2'}}

EDIT: The code is this:
Code:
def parseResponse(message):
   data = {}
   objs = message.split('|')

   for obj in objs:
      if (len(obj) > 0):
         items = obj.split(',')
         item = items[0]
         item_id = items[0].split('=', 1)
         if (len(item_id) == 1 or not item_id[1].isdigit()):
            name = item_id[0]
         else:
            name = item_id[0] + item_id[1]

         if (len(name) == 0):
            name = "null"     

         if (name in data):
            num = 1
            while ((name+str(num)) in data):
               num =+ 1
            name =+ str(num)

         counter = 0

         for item in items:
            item_id = item.split('=', 2)
            if not (name in data):
               data[name] = {}
            if (len(item_id) == 2):
               data[name][item_id[0]] = item_id[1]
            else:
               data[name][counter] = item_id[0]

         counter =+ 1

   return data


Title: Re: Request for an RPC capable fork of cgminer (120/150 BTC pledged so far)
Post by: kano on December 12, 2011, 10:43:42 AM
Yeah looks OK. I guess :)
Edit: no actually the SUMMARY one is messed up there's only supposed to be 2 sections "STATUS" and "SUMMARY"

One thing I noticed up front is that you are running an older version of cgminer - the newest version uses full descriptions for the field names.
Current one is 2.0.8y
It also has no exception to the rule of the reply format
(earlier there was an exception to the rule: 'apiversion' - that's gone and now there is only 'version' which uses the same format as the rest)
... and it shows more GPU details that were missing before.

Note to DeathAndTaxes if you see this:
I keep thinking about the "MHS 5s" fields.
That means you already have the field description correct, however, you can't search for it by full name, since it's name will change to match --log
So if --log is 7 the field will be called "MHS 7s"
Is that OK?
Or would you prefer 2 fields instead something like: MHS Ns=1234.99 and Log Interval=5
Thus you can directly index access the field with "MHS Ns"
(or both these 2 and the old 1)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 12, 2011, 01:30:38 PM
Note to DeathAndTaxes if you see this:
I keep thinking about the "MHS 5s" fields.
That means you already have the field description correct, however, you can't search for it by full name, since it's name will change to match --log
So if --log is 7 the field will be called "MHS 7s"
Is that OK?
Or would you prefer 2 fields instead something like: MHS Ns=1234.99 and Log Interval=5
Thus you can directly index access the field with "MHS Ns"
(or both these 2 and the old 1)

Um you sure it was me?  I haven't looked at the MHS fields yet.  Sorry coming back from a cruise, and getting caught up at work is brutal.  Hopefully I can get a chance to look at it tonight.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 12, 2011, 07:47:06 PM
No - it was me - but you seemed to be the best person to ask :)
(it's something I've been thinking about since after I made that last change)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 12, 2011, 10:44:31 PM
Minor change to miner.php - the simple web page that uses the API
(headers are a darker background and a few of the values are formatted)
https://github.com/kanoi/cgminer/commit/da798519b0a2b8c98aea31923f85e4074888757d


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: gnar1ta$ on December 16, 2011, 11:06:23 PM
Is this being paid out yet or still testing?


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 16, 2011, 11:20:57 PM
Kano has been very responsive and quick to develop this, but very few have tested it, and no one has paid him yet. I quite like what I see so far.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 17, 2011, 12:13:42 AM
Kano has been very responsive and quick to develop this, but very few have tested it, and no one has paid him yet. I quite like what I see so far.

I apologize for this.  I was gone of vacation and since coming back I have been overwhelmed at work.  I just don't have the time to put the code through its paces.  However based on my limited testing I am going to pay out my portion of the bounty now.  Kano shouldn't be penalized due to a lack of testing.

I anticipate if any issues are discovered after payment Kano has sufficient incentive to resolve them in order to collect rest of bounty.  I sent a PM to Kano to verify the address he wants payment at.  Once I get that I will payout 30 BTC.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: gnar1ta$ on December 17, 2011, 12:43:51 AM
I have no problem paying out on the progress made, just need an address - sig address ok Kano?


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 17, 2011, 12:26:43 PM
Yep sig is fine - just post or PM me so I know who it came from.
No worries about the time as long as I get paid if I've done what's required.
Though waiting longer seems to be making the bounty worth more :D :D (BTC is now worth more)

I mainly just want to get it into ckolivas' git so I can work on it on a proper fork of his git and also sort if there are any problems he finds with what I've done and fix them.
Even from my point of view there's more that I'll do (and I've already got the extra interface programs and PHP web page written as everyone already knows)

Though the next thing I will probably do is look at the cgminer shutdown code (which may get rid of the windows crash)

Then add more API stuff to send more commands to cgminer (e.g. GPU settings etc)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 17, 2011, 06:39:47 PM
30 BTC sent to 1LPbuDSPT4DdYbwiqAVWDJm2sHHuh6PnqB

It is coming from one of my exchange account so I have no idea what address it will be sent from.  Thanks for all the good work so far.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 17, 2011, 09:24:51 PM
Thanks DeathAndTaxes and gnar1ta$ got both of yours.
OK so I better update the docs first today :)
(yeah I forgot that needs to be done next before anything else)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 17, 2011, 11:22:29 PM
Just got the miner compiled.  As soon as I get an RPC command sent, I'll send you the bounty.

Then I'll probably start working on a fork that uses JSON so that devs won't have to write their own parsers.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 18, 2011, 12:41:57 AM
Just got the miner compiled.  As soon as I get an RPC command sent, I'll send you the bounty.

Then I'll probably start working on a fork that uses JSON so that devs won't have to write their own parsers.
LOL - you didn't read my posts?
Since you're a bounty payer and you seem to want JSON also, I'll just do that next.
(I've already said that as an option before but no one bothered to reply ... ... ...)

Of course it will be done the simplest way:
If the string sent over the socket starts with '{' then I'll assume it's JSON and reply with a JSON string.
If the string sent doesn't start with '{' then it's the same as it is now with the same simpler reply.

As for doing your own fork ... you do realise what you are in for if you do that?
Do you use windows or was your fork just going to ignore that?

Edit: P.S. the basic parser is already written in 3 languages, so "devs" shouldn't have any issues ... ...


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 18, 2011, 12:56:33 AM
Just got the miner compiled.  As soon as I get an RPC command sent, I'll send you the bounty.

Then I'll probably start working on a fork that uses JSON so that devs won't have to write their own parsers.
LOL - you didn't read my posts?
Since you're a bounty payer and you seem to want JSON also, I'll just do that next.
(I've already said that as an option before but no one bothered to reply ... ... ...)

Of course it will be done the simplest way:
If the string sent over the socket starts with '{' then I'll assume it's JSON and reply with a JSON string.
If the string sent doesn't start with '{' then it's the same as it is now with the same simpler reply.

As for doing your own fork ... you do realise what you are in for if you do that?
Do you use windows or was your fork just going to ignore that?

Edit: P.S. the basic parser is already written in 3 languages, so "devs" shouldn't have any issues ... ...

Github makes forking really easy.  I don't think that the JSON code would have anything platform specific, so don't know how being on windows would make a difference.

Although if you want to do it, that would be even better since you already know this part of the code.

The string that gets returned isn't consistent. "STATUS=S" starts the first section, but "SUMMARY" starts the second.

EDIT: I just sent 10BTC to the address in your sig.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: tnkflx on December 18, 2011, 09:23:32 AM
@Kano

30 BTC sent to 1LPbuDSPT4DdYbwiqAVWDJm2sHHuh6PnqB

It is coming from one of my exchange account so I have no idea what address it will be sent from.  Thanks for all the good work so far.

I keep good on my promises, so 30 BTC has been sent to your account ;-) Thanks for all the hard work!


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 18, 2011, 10:20:19 AM
Thanks to both of you also - Red Emerald and tnkflx.
Received both of your bounties.
Heh funny in one day I've already received more BTC than I have received in total since I started in July ... and there's still more to go :)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 18, 2011, 10:25:47 AM
Thanks to both of you also - Red Emerald and tnkflx.
Received both of your bounties.
Heh funny in one day I've already received more BTC than I have received in total since I started in July ... and there's still more to go :)

I just had to point out to them that you had done the work and there was no point procrastinating any further...


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: tnkflx on December 18, 2011, 01:52:47 PM
Thanks to both of you also - Red Emerald and tnkflx.
Received both of your bounties.
Heh funny in one day I've already received more BTC than I have received in total since I started in July ... and there's still more to go :)

I just had to point out to them that you had done the work and there was no point procrastinating any further...

We all listen to Con! ;-)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: jamesg on December 18, 2011, 05:24:42 PM
Hi Kano, just sent my 30 btc to 1LPbuDSPT4DdYbwiqAVWDJm2sHHuh6PnqB via transaction id 2745910cf076dd5087a1d21c8760bb5f17f8cb60937fa180f785b9a980657fa7

http://blockchain.info/address/d4b0ac9fb41430891cccf8a6de096a10b48e8aea

Thanks for all of the hard work. Can't wait to see this integrated into BAMT.



Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 18, 2011, 08:37:58 PM
Thanks gigasvps :)
Bounty received.
(working on 2.0.8z now ...)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 18, 2011, 08:41:40 PM
Any ETA for JSON?  The python parse script in this thread doesn't work properly and I started to write my own, but it got pretty ugly.  I want to play around with monit kind of like how BAMT does.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: abracadabra on December 18, 2011, 11:53:09 PM
Anyone running this on windows?  What are you using to serve the miner.php?


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 19, 2011, 01:06:21 AM
JSON might be a while, got 2 client calls just after I posted that 'z' comment :(
Should be done by tonight though (it's midday here in Aus now)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 20, 2011, 01:53:34 AM
OK 'z' version is up on my git
If the request sent starts with '{' it is assumed to be JSON and sends a JSON reply
otherwise same as before.

Code: https://github.com/kanoi/cgminer
Downloads: https://github.com/kanoi/cgminer/downloads
(obviously in downloads, the filenames with 'z' in them)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 20, 2011, 02:18:47 AM
Super awesome.  The best of both worlds.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 20, 2011, 05:29:20 AM
... and I've updated the README in my git.
Next step is to create a Pull Request for ckolivas' git ...

As usual, anyone with any questions, issues, suggestions, changes or otherwise - please say so.

And lastly I'm only waiting on just abracadabra and ThiagoCMC for their bounties :)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 20, 2011, 07:33:38 AM
So I built it in git and successfuly got an error message in JSON.  Can you give an example command?

Code:
{"STATUS":[{"STATUS":"E","Code":23,"Msg":"Invalid JSON","Description":"cgminer 2.0.8x"}],"id":1}

Also, the version is still showing as cgminer 2.0.8x.  I thought that this was z

EDIT: woohoo!

Code:
[user@miner cgminer-pyrpc]$ python cgminer-rpc.py devs
{"command": "devs"}
{"STATUS":[{"STATUS":"S","Code":9,"Msg":"3 GPU(s) - 0 CPU(s)","Description":"cgminer 2.0.8x"}],"DEVS":[{"GPU":0,"Enabled":"Y","Status":"Alive","Temperature":74.50,"Fan Speed":4359,"Fan Percent":85,"GPU Clock":830,"Memory Clock":350,"GPU Voltage":1.049,"GPU Activity":99,"Powertune":0,"MHS av":377.53,"MHS 5s":377.48,"Accepted":160,"Rejected":8,"Hardware Errors":0,"Utility":4.70,"Intensity":"8"},{"GPU":1,"Enabled":"Y","Status":"Alive","Temperature":71.00,"Fan Speed":-1,"Fan Percent":-1,"GPU Clock":820,"Memory Clock":350,"GPU Voltage":1.049,"GPU Activity":99,"Powertune":0,"MHS av":373.36,"MHS 5s":368.26,"Accepted":179,"Rejected":6,"Hardware Errors":0,"Utility":5.26,"Intensity":"8"},{"GPU":2,"Enabled":"Y","Status":"Alive","Temperature":68.50,"Fan Speed":1612,"Fan Percent":44,"GPU Clock":1000,"Memory Clock":350,"GPU Voltage":1.162,"GPU Activity":99,"Powertune":0,"MHS av":321.44,"MHS 5s":323.91,"Accepted":138,"Rejected":13,"Hardware Errors":0,"Utility":4.05,"Intensity":"8"}],"id":1}

EDIT AGAIN: only kinda woohoo!

Code:
'{"STATUS":[{"STATUS":"S","Code":11,"Msg":"Summary","Description":"cgminer 2.0.8x"}],"SUMMARY":[{"Elapsed":2862,"Algorithm":"c","MHS av":1071.31,"Found Blocks":0,"Getworks":754,"Accepted":676,"Rejected":42,"Hardware Errors":0,"Utility":14.17,"Discarded":44,"Stale":0,"Get Failures":5,"Local Work":44,"Remote Failures":0,"Network Blocks":6}],"id":1}\x00'

That null byte at the end makes python's json module complain. Is there any reason you have it there? I've just stripped it off for now.

Here is my basic socket client in python

https://gist.github.com/1500780


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 20, 2011, 11:21:11 AM
The git version number makes no difference since it wont be going back to ckolivas
I keep my own version number in my local copy

The NULL character ensures termination in C and means I don't have to add it in C.
It also works fine in my Java and PHP code.

The README of course explains the API usage - which is as you have worked out.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 20, 2011, 12:57:49 PM
I've temporarily pulled Kano's changes into a new api branch on my own git tree. Pending further testing and auditing by myself, it will eventually be pulled into the master branch and be incorporated into the next release whenever I get around to it. Thanks so very much for taking on this task, Kano.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 20, 2011, 02:26:13 PM
I've temporarily pulled Kano's changes into a new api branch on my own git tree. Pending further testing and auditing by myself, it will eventually be pulled into the master branch and be incorporated into the next release whenever I get around to it. Thanks so very much for taking on this task, Kano.

A +1 to kano and a +1 for ckolivas looking to integrate into the mainline.  I am currently using a hacked together command line utility to keep track of my server farm.  It is ugly code but it works as a proof of concept.  I can from a single "utility" (kinda a stretch to call it that) gets stats and make changes to any one of 24 GPUs on 4 rigs.   WOOT!

I imagine when someone builds a real utility (either android based, or web based) it will be smoking.  Imagine controlling 11GH of hashing power from your android phone.  Getting vibration notifications when a GPU fails.  Checking a chart of last hour (or 24 hours) of hashing performance, having a built in realtime cashflow counter (in both bitcoins & USD).    Granted none of that exists but it COULD exist thanks to the work of Kano and ckolivas.



Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 20, 2011, 02:29:21 PM
For those wanting to run cgminer as a daemon using "real-quiet" : true option in config file disables curses and makes cgminer even lighterweight.  For some weird reason ever couple of reboots I would get cgminer to hang launching the "display" (cpu usage would go to 99.9% and system would become very unresponsive).  Trying to end cgminer would fail and the process would go defunct.  I believe it is some curses glitch on my rigs but since it only happens at boot I never investigated it much and instead used the scientific "hand temp" test to determine if cgminer launched successfully after a boot.

Since running in "real-quiet" I have never had a hang on reboot.  I even rebooted 22 times one day to try and cause it.  :)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 20, 2011, 02:35:50 PM
A gentle reminder to the following who made pledges on this project.  
* abracadabra - 10 BTC
* ThiagoCMC - 5 BTC

I believe everyone else has paid (let me know if right Kano).

There are still bounties for integration into mainline but those should be the last two for standalone project.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: abracadabra on December 20, 2011, 02:57:56 PM
Bounty sent.  2 transactions
#1 - 3.89465464
#2 - 6.10534536

Thanks kano!

Looking forward to future apps using this new feature of cgminer.  The android phone control is exactly what I was thinking!


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 20, 2011, 09:03:51 PM
Bounty sent.  2 transactions
#1 - 3.89465464
#2 - 6.10534536

Thanks kano!

Looking forward to future apps using this new feature of cgminer.  The android phone control is exactly what I was thinking!
#1 - 3.89
#2 - 6.10534536
Total: 9.99534536 close enough :)
(yes seriously - close enough - don't worry about the 0.00465464 it's worth less than 2c even now)

Only one left is ThiagoCMC - 5 BTC


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Turbor on December 20, 2011, 10:47:14 PM
Only one left is ThiagoCMC - 5 BTC

If there should be a problem for him to pay the 5 BTC at the moment, i can help !


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 21, 2011, 07:15:16 AM
Yeah looks like it may be a while before he pays ...
https://bitcointalk.org/index.php?topic=54968.0


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Turbor on December 21, 2011, 11:23:57 AM
If you can't wait, let me know. ;)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: runeks on December 21, 2011, 03:47:33 PM
Here is my basic socket client in python

https://gist.github.com/1500780
FYI, you need to send and receive like this (refer to kano's link on sockets (http://docs.python.org/howto/sockets.html)):

Code:
RECVSIZE=65500

def _sendmsg(sock, msg):
   totalsent = 0
   while totalsent < len(msg):
      sent = sock.send(msg[totalsent:])
      if sent == 0:
         raise RuntimeError("socket connection broken")
      totalsent = totalsent + sent

def _recvmsg(sock):
   msg = ''
   while True:
      chunk = sock.recv(RECVSIZE)
      if (chunk == ''):
         break
      msg = msg + chunk
   return msg

yeah it's tiring, but there are no guarantees that your entire message will be transmitted at once. It will most of the time, but unless you do it like the above, sometimes odd errors will creep in that will take you forever to figure out, until you find out that send() only sends the number of bytes it returns (not necessarily the whole message), and recv() has only received the entire message when it returns an empty string (ie. receives nothing).

EDIT: Oh, and you should run shutdown() before close() :)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 21, 2011, 07:29:07 PM
Here is my basic socket client in python

https://gist.github.com/1500780
FYI, you need to send and receive like this (refer to kano's link on sockets (http://docs.python.org/howto/sockets.html)):

Dunno how I missed that example when I was reading through the docs.  I'll clean it up.

EDIT: https://gist.github.com/1500780

I realized that most people are going to want to check multiple mining rigs and having to make a new CgminerClient for each host seemed like extra work. I made it so that the client can check multiple hosts and ports easily rather than being bound to one at creation.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 23, 2011, 08:54:22 PM
After auditing the code, the API branch has been merged into my cgminer master branch now. Please refer any further API discussion to the regular cgminer thread.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 24, 2011, 01:52:24 AM
After auditing the code, the API branch has been merged into my cgminer master branch now. Please refer any further API discussion to the regular cgminer thread.

There is 30 BTC pledge towards integration into mainline.  Do you want it sent to your signature address?
148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 24, 2011, 01:57:24 AM
After auditing the code, the API branch has been merged into my cgminer master branch now. Please refer any further API discussion to the regular cgminer thread.

There is 30 BTC pledge towards integration into mainline.  Do you want it sent to your signature address?
148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq
That will be fine, thanks.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 24, 2011, 02:08:29 AM
My 5 BTC integration bonus paid (5.000777 so I could track it as I paid it from an exchange account).

http://blockchain.info/tx-index/13548043/89fc06ad9196facee2741ce173e3a525a9017df90eb0e61352c46f2fcd1f18f3


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 24, 2011, 02:09:14 AM
Received, thanks :)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 26, 2011, 07:29:01 AM
Well, I got half the 30 BTC bounty, thanks! 15 to go...


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 26, 2011, 07:40:52 AM
Well, I got half the 30 BTC bounty, thanks! 15 to go...
As soon as I am paid for today's mining, I'll send you my 5 :)

I've compiled your 2.0.9 and it hasn't crashed on me yet :D  I haven't really done anything with the RPC yet though. Maybe tomorrow on the train I'll get a little something written.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 26, 2011, 08:06:04 AM
Well, I got half the 30 BTC bounty, thanks! 15 to go...
As soon as I am paid for today's mining, I'll send you my 5 :)

I've compiled your 2.0.9 and it hasn't crashed on me yet :D  I haven't really done anything with the RPC yet though. Maybe tomorrow on the train I'll get a little something written.
Thanks. Do be aware 2.0.9 is a development release and I won't be releasing an "official" version till I'm sure it all works fine. There was a race on longpoll switch that has been a bitch to nail down but I hope I'm there now. Also, a fried motherboard in my main miner will significantly slow down the final release  :-\


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 26, 2011, 03:56:19 PM
Received, thanks :)
Well, I got half the 30 BTC bounty, thanks! 15 to go...

If you update the thread w/ person(s) who have paid the pledges I will update the first post.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 27, 2011, 02:28:09 AM
Since code is now in the mainline and planned for next official version once tested I would like to wrap up this thread/project and lock it.


Already paid:
  • DeathAndTaxes - 30 BTC (+5 BTC more for integration into the mainline)
  • Gigasvps - 30 BTC
  • Tnkflx - 30 BTC
  • abracadabra - 10 BTC
  • Red Emerald - 10 BTC (+5 BTC more for integration into mainline)
  • gnar1ta$ - 10 BTC (+10 BTC more for integration into the mainline)

Owed to Kano for standalone project:
  • ThiagoCMC - 5 BTC

Owed to ckolivas for mainline integration:
  • Red Emerald - 5 BTC
  • gnar1ta$ - 5 BTC
  • Chefnet - 15 BTC

ckolivas says another 10 BTC has been paid but looking at block explorer it came from a single address so it matches no existing pledge.
 Update:  It was gnar1ta$, he paid beyond his pledge.


If you have paid please update the thread.  
If you have not yet paid on your pledge please do so promptly as the code is functional and integrated so further delays are not warranted.
If you have no intention on fulfilling your pledge please indicate your reason why.

Thank You,
Death & Taxes.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 27, 2011, 03:12:30 AM
gnar1ta$ has paid 5 BTC + 5 extra for general cgminer dev. Therefore 10/30 of this bounty has been paid, thanks.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: gnar1ta$ on December 27, 2011, 04:18:31 AM
Sorry for the confusion. Sent one transaction and PM instead of posting. Looks like it's sorted out. Thanks again to Kano and ckolivas for the work.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 27, 2011, 07:03:01 AM
Just sent my 5 to 148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq

Thanks again.  I'll post something that actually uses this soon.  Is anyone else who pledged (or not) actually using the RPC yet?


Title: Re: Request for an RPC capable fork of cgminer (110 BTC pledged so far)
Post by: ThiagoCMC on December 29, 2011, 10:58:49 PM
Hi!

 I would love to support this... I can give 5 BTCs now.

 And I have a suggestion:

 1- Identify a GPU by its "device ID" (possible?);
 2- Configuration of each GPU based on its ID;
 3- A different "pool / login / worker" per device (fixed by its ID).

 This way, no matter if a GPU is GPU0 or GPU1, the ID will be the same, so its own configurations...

 This can be usefull if we change a GPU slot or add/remove GPUs from a machine.

 It can works more or less like Linux file system UUID, with it, no matter if the device is sda or sdb, the FS UUID will be always the same and the file system will be mounted without any problem if you change the disk connection.

Best,
Thiago

Hi!

 How to use that?!
 I'll pay! Of course...
 Thank you!!

Best,
Thiago


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: ThiagoCMC on December 30, 2011, 12:22:16 AM
Hi!

 Guys, how much will cost to add support for Scrypt (Litecoin mining) to cgminer (maybe cgminer-cpuonly)?

 Of course, based on: https://github.com/pooler/cpuminer

 10 BTC?

 So, with only one cgminer instance, we can find Bitcoin/Namecoin and Litecoin blocks!

 But keeping the option to mine for Bitcoins using cgminer-cpuonly too, if user wish that...

Best!
Thiago


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 30, 2011, 12:25:37 AM
Hi!

 Guys, how much will cost to add support for Scrypt (Litecoin mining) to cgminer (maybe cgminer-cpuonly)?

 Of course, based on: https://github.com/pooler/cpuminer

 10 BTC?

 So, with only one cgminer instance, we can find Bitcoin/Namecoin and Litecoin blocks!

 But keeping the option to mine for Bitcoins using cgminer-cpuonly too, if user wish that...

Best!
Thiago
You should probably make a new thread for this since it has nothing to do with RPC.  My hopes for litecoin are low, but this would still be an interesting idea.

You would also likely need the CPU mining to be on a different pool, so this request will likely require more than just scrypt support.



It would be nice if the RPC had a "help" command that output available commands along with a short description of what they do just like bitcoind does.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 30, 2011, 01:41:37 AM
Still missing some of the bounty  :-\


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 30, 2011, 02:33:13 AM
I wish javascript could talk over plain TCP Sockets... :(

A simple web client cannot query cgminer on 4028 directly.  This is too bad.  I was really hoping that I could write a simple index.html that could query any cgminer instance without having to add anything to the server running cgminer.

For now it looks like I will use my python script to proxy calls so that an ajax request can get them.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 30, 2011, 03:17:07 AM
I wish javascript could talk over plain TCP Sockets... :(

A simple web client cannot query cgminer on 4028 directly.  This is too bad.  I was really hoping that I could write a simple index.html that could query any cgminer instance without having to add anything to the server running cgminer.

For now it looks like I will use my python script to proxy calls so that an ajax request can get them.

Minor adjustment of what you said: You need to add to the server running the web page.

If the web page is on the miner - then you can add php as easily as you added the web server.
(and if you didn't install the web server, but someone else did - ask them why they forgot php)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on December 30, 2011, 07:30:51 AM
I wish javascript could talk over plain TCP Sockets... :(

A simple web client cannot query cgminer on 4028 directly.  This is too bad.  I was really hoping that I could write a simple index.html that could query any cgminer instance without having to add anything to the server running cgminer.

For now it looks like I will use my python script to proxy calls so that an ajax request can get them.

Minor adjustment of what you said: You need to add to the server running the web page.

If the web page is on the miner - then you can add php as easily as you added the web server.
(and if you didn't install the web server, but someone else did - ask them why they forgot php)

A simple web server that serves just html is way lighter weight than installing PHP. My miner doesn't have the space for much at all since its running off a USB stick. It barely had the space for the tiny python site I made.

I was planning on using phonegap to make a monitor app.  This creates an app that is just an html and javascript page running right on the smartphone. I wanted the phonegap app to directly query the cgminer instance.

Instead, I am querying a small website that is running on the miner.  I've setup my site so it can run anywhere though.  It also has some basic caching and can add authentication or any number of things pretty easily. This is probably better than querying cgminer directly anyways.

Quote
http://mining-stats.stitthappens.com/

http://mining-stats.stitthappens.com/api/<command>/<host>/
http://mining-stats.stitthappens.com/api/<command>/<host>/<port>/

http://mining-stats.stitthappens.com/api/devs/169.237.101.194/

I'll likely move this over to my actual webserver and set --api-network since litecoin mining is making the site sometimes unresponsive. I'll also get it running on port 80.

Right now the site is super minimal.  I'm probably going to use backbone and jquery mobile to make a really easy to use page.  Maybe even play around with image generation to make sigs (although we can't use images here anymore :( )


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: ThiagoCMC on December 30, 2011, 07:54:21 AM
If you can't wait, let me know. ;)

Turbor, have you paid him for me!?!  ^_^

If not, I would like to pay that... In a couple days.

5 BTC to Kano at 1LPbuDSPT4DdYbwiqAVWDJm2sHHuh6PnqB ?

Right?!

Thank you guys!!
Thiago


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: tnkflx on December 30, 2011, 10:00:20 AM
Still missing some of the bounty  :-\

Who hasn't paid yet?


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Turbor on December 30, 2011, 10:03:30 AM
Hey Thiago

No payment has been made so far. Let me know when i can help.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 30, 2011, 10:13:09 AM
Still missing some of the bounty  :-\

Who hasn't paid yet?

From top post:

Pledged so far (any additional limits/requirements marked):
* DeathAndTaxes - 30 BTC <Paid> (+5 BTC more if integrated into the mainline instead of a fork <Paid>)
* Red Emerald - 10 BTC <Paid>(+5 BTC more if integrated into the mainline instead of a fork)  <Paid>
* gnar1ta$ - 10 BTC <Paid> (+5 BTC more if integrated into the mainline instead of a fork <Paid>)
* Chefnet -  (+15 BTC only if integrated into the mainline instead of a fork)

Unpaid: 5 BTC (15 BTC for integration into mainline)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on December 30, 2011, 04:24:05 PM
Still missing some of the bounty  :-\

Who hasn't paid yet?

Owed to Kano for standalone project:
  • ThiagoCMC - 5 BTC

Owed to ckolivas for mainline integration:
  • Chefnet - 15 BTC


Unless my accounting is wrong it is just Chefnet (Thiago looks to be "paying" or intends to pay in next couple days.  I will wait for an update from Kano).

I sent a PM to Chefnet same day as Thiago but got no response from him.  I asked him to either pay or issue reason for non-payment in the thread.  He has done neither.  He has logged in multiple times, the latest on 12/29 so I have to assume he has seen the PM and simply ignored it.

Chefnet responded on 1/3/2012.  He was without internet.


I feel bad. :(  Developers deserve compensation, especially promised compensation. If anyone feels this project (now integrated into mainline) has merit and it is wrong that ckolivas hasn't been compensated for all his hard work then please make a donation to his donation address and post in this thread.  I am sure in the cgminer userbase we can find 15 people to donate 1 (or more) BTC each to make up the deficit.

Sure you can tell yourself "I don't need to pay, I didn't make that pledge", but the end result is still that ckolivas is the one who loses.  As a developer myself I will let everyone in on a secret.  Developers who feel under appreciated tend to not develop.  >:(  Developers start up doing something for fun, and 20 versions later the fun is mostly gone.  They then keep "going" because they feel the project is good and don't want it to die.  A donation shows your appreciation and keeps the project alive.  So if you feel RPC support is worthwhile and has the potential for really cool stuff in the future (which I think it does) then show your support and donate 1 BTC right now.  Let me know in this thread as I will make sure ckolivas gets the full pledge one way or another.

I'll start.  1 BTC sent to 148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq
(txn ID: db281024dbbfa2b06aa4644dd2b7d865fbc5526bdaca68025b2dbf7e68293a58)

14 to go ...

I would like to see ckolivas receive the full compensation promised (even if it doesn't come from the person(s) who made the promise).


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on December 30, 2011, 09:32:52 PM
@DeathAndTaxes

Thanks man, you're one of the few then who understands how I feel. Don't take all the responsibility and kill yourself over it though.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 30, 2011, 10:56:11 PM
I wish javascript could talk over plain TCP Sockets... :(

A simple web client cannot query cgminer on 4028 directly.  This is too bad.  I was really hoping that I could write a simple index.html that could query any cgminer instance without having to add anything to the server running cgminer.

For now it looks like I will use my python script to proxy calls so that an ajax request can get them.

Minor adjustment of what you said: You need to add to the server running the web page.

If the web page is on the miner - then you can add php as easily as you added the web server.
(and if you didn't install the web server, but someone else did - ask them why they forgot php)

A simple web server that serves just html is way lighter weight than installing PHP. My miner doesn't have the space for much at all since its running off a USB stick. It barely had the space for the tiny python site I made.

I was planning on using phonegap to make a monitor app.  This creates an app that is just an html and javascript page running right on the smartphone. I wanted the phonegap app to directly query the cgminer instance.

Instead, I am querying a small website that is running on the miner.  I've setup my site so it can run anywhere though.  It also has some basic caching and can add authentication or any number of things pretty easily. This is probably better than querying cgminer directly anyways.

Quote
http://miner.stitthappens.com:5000/

http://miner.stitthappens.com:5000/api/<command>/
http://miner.stitthappens.com:5000/api/<command>/<host>/
http://miner.stitthappens.com:5000/api/<command>/<host>/<port>/

http://miner.stitthappens.com:5000/api/devs

I'll likely move this over to my actual webserver and set --api-network since litecoin mining is making the site sometimes unresponsive. I'll also get it running on port 80.

Right now the site is super minimal.  I'm probably going to use backbone and jquery mobile to make a really easy to use page.  Maybe even play around with image generation to make sigs (although we can't use images here anymore :( )
As given here: https://bitcointalk.org/index.php?topic=52466.msg642914#msg642914
Yes I have apache and php installed on my USB.
As stated it's only an extra approximately 50Mb on my USB for both apache and php.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on December 30, 2011, 11:37:44 PM
... and I will add ...
If anyone is looking for me to ask questions about it - I'm usually in the #cgminer thread as 'kanoi'
... lately mostly chatting to ckolivas (conman) about Zelda :)
I leave IRC on 24/7 but of course I'm not always in front of my PC :P
I reset my home network at 1am UTC+11 Sydney time, so I sometimes lose connection from then until I wake up if I forgot to auto reconnect my PC and went to sleep before 1am


Title: Re: Request for an RPC capable fork of cgminer (100 BTC pledged so far)
Post by: abracadabra on December 31, 2011, 03:43:52 AM
Theres so many projects that I want to help out!  Bitcoiners are still coming up with great ideas.

I'll pledge 10 BTC.  I'll pledge 5 more if I ckolivas pulls the code into his main branch (even if he codes it).  I think this would help us by keeping bugs to a minimum.  Multiple versions of cgminer are sure to only complicate things and slow features down.
agree +1.

add 15BTC by me if it will be mainline.

I think we should provide him 1 week to either comment or pay up.  Otherwise he should be treated as something of a scammer. I take pledging BTC for development work as a contract. 


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: tnkflx on December 31, 2011, 03:07:46 PM
I will donate 5 BTC extra in 2 days to Con for his work on integrating this into mainline. (Can't access my wallet for the next 2 days ;-))


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: runeks on January 01, 2012, 04:48:21 PM
I feel bad. :(  Developers deserve compensation, especially promised compensation. If anyone feels this project (now integrated into mainline) has merit and it is wrong that ckolivas hasn't been compensated for all his hard work then please make a donation to his donation address and post in this thread.  I am sure in the cgminer userbase we can find 15 people to donate 1 (or more) BTC each to make up the deficit.
1 BTC sent. (http://blockexplorer.com/tx/8150dc59695736e59e3716960abf7d40772d4cf12fa49b628d1610404fdfac1f)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: tnkflx on January 02, 2012, 04:48:52 PM
I will donate 5 BTC extra in 2 days to Con for his work on integrating this into mainline. (Can't access my wallet for the next 2 days ;-))

5 BTC donated last night, thanks again Con!


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: ThiagoCMC on January 02, 2012, 08:40:08 PM
Hi!

 I just sent 5 Bitcoins to Kano!

Thanks!
Thiago


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on January 02, 2012, 09:48:54 PM
I'm making progress on my mining stats page.

http://mining-stats.stitthappens.com/

Right now, it is set to watch my miner, but I'll add a form to let you connect to any IP or port.  Everything under /api/ can already connect to anywhere (as long as the destination's firewall is open) so it won't take much work. I still need to see what happens when this points to a CPU miner

I'm planning on building some simple images out of these stats.  I might take the "api description" and turn it into a QR code (kind of like my avatar) with the MH/s underneath.

Would it be possible to get pool info via the RPC?  It would be nice to tell if a pool is down.  I was expecting that everything available via the current command line interface would also be available via the RPC but we just have "summary" and "devs"


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on January 02, 2012, 10:51:27 PM
I'm making progress on my mining stats page.

http://mining-stats.stitthappens.com/

Right now, it is set to watch my miner, but I'll add a form to let you connect to any IP or port.  Everything under /api/ can already connect to anywhere (as long as the destination's firewall is open) so it won't take much work. I still need to see what happens when this points to a CPU miner

I'm planning on building some simple images out of these stats.  I might take the "api description" and turn it into a QR code (kind of like my avatar) with the MH/s underneath.

Would it be possible to get pool info via the RPC?  It would be nice to tell if a pool is down.  I was expecting that everything available via the current command line interface would also be available via the RPC but we just have "summary" and "devs"
"pools" ... (that and the rest are documented in the README file)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on January 02, 2012, 10:54:56 PM
Hi!

 I just sent 5 Bitcoins to Kano!

Thanks!
Thiago
5 Received! Thanks Thiago - that's the final one for me.

Now just to sort out what happened to Chefnet for ckolivas' last payment.
I also sent Chefnet a PM a couple of days ago.
But that was a day after his last login and he hasn't logged in since.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Red Emerald on January 02, 2012, 11:44:12 PM
I'm making progress on my mining stats page.

http://mining-stats.stitthappens.com/

Right now, it is set to watch my miner, but I'll add a form to let you connect to any IP or port.  Everything under /api/ can already connect to anywhere (as long as the destination's firewall is open) so it won't take much work. I still need to see what happens when this points to a CPU miner

I'm planning on building some simple images out of these stats.  I might take the "api description" and turn it into a QR code (kind of like my avatar) with the MH/s underneath.

Would it be possible to get pool info via the RPC?  It would be nice to tell if a pool is down.  I was expecting that everything available via the current command line interface would also be available via the RPC but we just have "summary" and "devs"
"pools" ... (that and the rest are documented in the README file)

Dunno how I missed that.  Thanks.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: Chefnet on January 03, 2012, 02:08:30 PM
sorry I was without Inet here are my 15 BTC to 148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: DeathAndTaxes on January 03, 2012, 02:10:20 PM
sorry I was without Inet here are my 15 BTC to 148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq

YEAH!  Chefnet is back.  What a happy resolution to this project.
Yes your pledge can be paid to 148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: -ck on January 03, 2012, 08:33:57 PM
Thanks very much!

Those who gave me alternative payments in case chefnet didn't pay out, please PM me your address and I'll send it back if you like.


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: tnkflx on January 03, 2012, 08:42:57 PM
Thanks very much!

Those who gave me alternative payments in case chefnet didn't pay out, please PM me your address and I'll send it back if you like.

No, you can have it (at least my share :p) :) Consider it an extra donation :)


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: JinTu on January 03, 2012, 10:04:57 PM
Sorry for cross-posting, but this would seem to be relevant to both the main cgminer and this API thread.

I hacked together a workalike version of api-example in Perl leveraging the JSON parlance of the API supported by Kano's wonderful enhancements.

Details are here (https://bitcointalk.org/index.php?topic=28402.msg665181#msg665181).


Title: Re: Request for an RPC capable fork of cgminer (125/155 BTC pledged so far)
Post by: kano on January 03, 2012, 10:59:25 PM
Sorry for cross-posting, but this would seem to be relevant to both the main cgminer and this API thread.

I hacked together a workalike version of api-example in Perl leveraging the JSON parlance of the API supported by Kano's wonderful enhancements.

Details are here (https://bitcointalk.org/index.php?topic=28402.msg665181#msg665181).
It's part of the core cgminer now - so you can post about it in the cgminer thread :)


Title: Re: COMPLETED: Request for an RPC capable fork of cgminer (155 BTC pledged and paid)
Post by: Red Emerald on January 12, 2012, 10:53:49 PM
So I realized it was going to be way too much work to write a full monitoring/notification center for cgminer.

Instead I am just going to write a simple plugin for Zabbix and let it handle all the graphs and what-not.

Also, this works quite well.
Code:
echo "version|" | nc ip.addr.of.miner 4028


Title: Re: COMPLETED: Request for an RPC capable fork of cgminer (155 BTC pledged and paid)
Post by: kano on January 12, 2012, 11:49:02 PM
So I realized it was going to be way too much work to write a full monitoring/notification center for cgminer.

Instead I am just going to write a simple plugin for Zabbix and let it handle all the graphs and what-not.

Also, this works quite well.
Code:
echo "version|" | nc ip.addr.of.miner 4028
Hmm, I didn't know about nc.
Ah the joy of simple sockets :)


Title: Re: COMPLETED: Request for an RPC capable fork of cgminer (155 BTC pledged and paid)
Post by: jake262144 on January 13, 2012, 12:40:17 AM
If you never heard of netcat, you'll be glad to learn about cryptcat Kano.

Cryptcat uses Bruce Schneier's Twofish encryption algorithm to secure the connection. Sweet.
If you forget to provide a passphrase, the hard-coded default is "metallica". How can one NOT love open source software?