Pages:
Author

Topic: [LTC] Online Litecoin Miner - page 3. (Read 52246 times)

hero member
Activity: 838
Merit: 507
December 01, 2011, 08:36:17 PM
#75
If this miner is running on a site and I open the site in 5 tabs or in tabs in 2 different browsers, how is this handled?  Will only one instance of the miner run?  Even if people opt in, I think by default it should still limit the rate on their box so as to not hurt performance.

That's another thing that is worth investigating. Of course at present every webpage loads its own miner, and that can be a problem if you have more than one page open. But... is it possible for an applet to detect the presence of other applets running?

Well, it turns out it is possible after all. Smiley
I have updated the jar file; now if you open a second tab the second applet should refuse to start mining.
I have not had the time to test it extensively; as always, if you encounter any issue please let me know.
full member
Activity: 154
Merit: 101
Bitcoin!
November 30, 2011, 12:42:44 PM
#74
That's another thing that is worth investigating. Of course at present every webpage loads its own miner, and that can be a problem if you have more than one page open. But... is it possible for an applet to detect the presence of other applets running?
Could it be done based on CPU usage?  If CPU usage is above a certain level, don't start the miner.
hero member
Activity: 838
Merit: 507
November 30, 2011, 12:02:47 PM
#73
I'm not a Java expert, but it would appear to be possible by interfacing with native OS APIs.  For example, on Windows, use JNI or JNA to call native Windows API functions to monitor battery status. Native calls could also be investigated for Linux and OSX.

Calling OS API functions from Java:
JNA http://stackoverflow.com/questions/2389156/calling-win32-api-method-from-java
JNI http://www.atwistedweb.com/java/jni.html

Windows Battery API functions:
http://stackoverflow.com/questions/3154554/how-do-i-get-battery-information-in-windows
http://stackoverflow.com/questions/233446/monitor-battery-charge-with-win32-api

I'm not saying it's easy or even possible at this point, but I think it warrants a bit more investigation.

The problem is that, unless I'm mistaken, it is not possible to make native calls from an unsigned applet.

Another suggestion/question.

If this miner is running on a site and I open the site in 5 tabs or in tabs in 2 different browsers, how is this handled?  Will only one instance of the miner run?  Even if people opt in, I think by default it should still limit the rate on their box so as to not hurt performance.

That's another thing that is worth investigating. Of course at present every webpage loads its own miner, and that can be a problem if you have more than one page open. But... is it possible for an applet to detect the presence of other applets running?
full member
Activity: 154
Merit: 101
Bitcoin!
November 30, 2011, 11:01:02 AM
#72
Another suggestion/question.

If this miner is running on a site and I open the site in 5 tabs or in tabs in 2 different browsers, how is this handled?  Will only one instance of the miner run?  Even if people opt in, I think by default it should still limit the rate on their box so as to not hurt performance.
sr. member
Activity: 305
Merit: 250
Trust but confirm!
November 30, 2011, 10:59:51 AM
#71
Well "to not steal" my clans website has warning before you can acces forum. It says that user solely accepts that we can use their cpu for mining if they step in our forum. None forces them to join my forum and its their freedom to decide if they want. Luckily finnish law is great and its fair enought to infrom users before they access. So practically its not stealing... There are no free meals, everything cost something for someone.
full member
Activity: 154
Merit: 101
Bitcoin!
November 30, 2011, 10:57:52 AM
#70
Another question-- is this, or will it be, open-sourced?

Didn't read the thread, eh? Smiley Yes, the source will be released soon.
I skimmed it, but I must have missed that.  Thanks.

It would also be very nice if you could detect a laptop/device running on battery power and not mine in that case.  http://www.google.com/search?q=get%20battery%20level%20java

That would be nice, but sadly a standard way of getting battery level information in Java doesn't seem to exist. You may be able to get it on some phones, but I don't think an unsigned applet can get that kind of information when running on a laptop.
I'm not a Java expert, but it would appear to be possible by interfacing with native OS APIs.  For example, on Windows, use JNI or JNA to call native Windows API functions to monitor battery status. Native calls could also be investigated for Linux and OSX.

Calling OS API functions from Java:
JNA http://stackoverflow.com/questions/2389156/calling-win32-api-method-from-java
JNI http://www.atwistedweb.com/java/jni.html

Windows Battery API functions:
http://stackoverflow.com/questions/3154554/how-do-i-get-battery-information-in-windows
http://stackoverflow.com/questions/233446/monitor-battery-charge-with-win32-api

I'm not saying it's easy or even possible at this point, but I think it warrants a bit more investigation.

Quote
You also wouldn't want to mine if someone visits on a smartphone or some other low-powered device, but I guess the 2-core threshold will take care of that.
Not completely: dual-core mobile phones already exist. I will investigate, thank you for the suggestion!
You're welcome.
full member
Activity: 154
Merit: 101
Bitcoin!
November 30, 2011, 10:46:51 AM
#69
I have done some research, and it looks like at present no mobile phone can run ordinary Java SE applets.
That would mean one less problem to deal with.
Can anyone confirm or refute this?

Of course the problem of laptops running on battery power still remains. I think the only satisfactory solution implies using cookies to remember users that have opted-out. My Javascript is a bit rusty, but if I remember correctly it shouldn't be too difficult to set these cookies client-side.
I am obviously talking about the first choice to start mining, not the page switch.
When you first ask you also point out what they are doing (not hide it like a scammer)
Your reply seems to directly imply that you don't ask - (since you didn't already have a cookie to remember their choice) - thus it sounds like you ARE stealing CPU cycles ...
It should detect things like battery state and number of cpus, to offer reasonable defaults, or not even offer the option of running the miner.  It's not even about whether you as the user or not.
hero member
Activity: 560
Merit: 501
November 30, 2011, 10:42:44 AM
#68
I have done some research, and it looks like at present no mobile phone can run ordinary Java SE applets.
That would mean one less problem to deal with.
Can anyone confirm or refute this?

Of course the problem of laptops running on battery power still remains. I think the only satisfactory solution implies using cookies to remember users that have opted-out. My Javascript is a bit rusty, but if I remember correctly it shouldn't be too difficult to set these cookies client-side.
I am obviously talking about the first choice to start mining, not the page switch.
When you first ask you also point out what they are doing (not hide it like a scammer)
Your reply seems to directly imply that you don't ask - (since you didn't already have a cookie to remember their choice) - thus it sounds like you ARE stealing CPU cycles ...
Oh cut it out with the stealing already. Am I stealing your screen space if you visit my website?
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
November 30, 2011, 09:50:57 AM
#67
I have done some research, and it looks like at present no mobile phone can run ordinary Java SE applets.
That would mean one less problem to deal with.
Can anyone confirm or refute this?

Of course the problem of laptops running on battery power still remains. I think the only satisfactory solution implies using cookies to remember users that have opted-out. My Javascript is a bit rusty, but if I remember correctly it shouldn't be too difficult to set these cookies client-side.
I am obviously talking about the first choice to start mining, not the page switch.
When you first ask you also point out what they are doing (not hide it like a scammer)
Your reply seems to directly imply that you don't ask - (since you didn't already have a cookie to remember their choice) - thus it sounds like you ARE stealing CPU cycles ...
hero member
Activity: 838
Merit: 507
November 30, 2011, 09:14:31 AM
#66
I have done some research, and it looks like at present no mobile phone can run ordinary Java SE applets.
That would mean one less problem to deal with.
Can anyone confirm or refute this?

Of course the problem of laptops running on battery power still remains. I think the only satisfactory solution implies using cookies to remember users that have opted-out. My Javascript is a bit rusty, but if I remember correctly it shouldn't be too difficult to set these cookies client-side.
hero member
Activity: 838
Merit: 507
November 30, 2011, 06:41:42 AM
#65
Um - hang on a tick ... that should never be an issue.
You do ask them before taking their CPU cycles right?
You just simply say that "if they are on a mobile phone that they shouldn't" do it.

Edit: and the same issue regarding a laptop on a battery ... if you ask and explain the consequences there should be no issue .... unless you hid the consequences ... but you wouldn't do that coz that would be scamming them Smiley

Unfortunately it's not that simple. I think opt-out is more practical than opt-in for most sites, otherwise I'm pretty sure that many visitors who don't mind simply wouldn't bother turning the miner on.
Even if you start the applet on an opt-in basis, you certainly don't want the user to manually start the miner every time he goes from one page to another. You would probably use a cookie to remember the user's decision. So it would still be nice if the miner could automatically detect when a laptop is running on battery power and when it is not, as this could change at any time.
legendary
Activity: 4466
Merit: 1798
Linux since 1997 RedHat 4
November 30, 2011, 06:20:21 AM
#64
Another question-- is this, or will it be, open-sourced?

Didn't read the thread, eh? Smiley Yes, the source will be released soon.

It would also be very nice if you could detect a laptop/device running on battery power and not mine in that case.  http://www.google.com/search?q=get%20battery%20level%20java

That would be nice, but sadly a standard way of getting battery level information in Java doesn't seem to exist. You may be able to get it on some phones, but I don't think an unsigned applet can get that kind of information when running on a laptop.

Quote
You also wouldn't want to mine if someone visits on a smartphone or some other low-powered device, but I guess the 2-core threshold will take care of that.

Not completely: dual-core mobile phones already exist. I will investigate, thank you for the suggestion!
Um - hang on a tick ... that should never be an issue.
You do ask them before taking their CPU cycles right?
You just simply say that "if they are on a mobile phone that they shouldn't" do it.

Edit: and the same issue regarding a laptop on a battery ... if you ask and explain the consequences there should be no issue .... unless you hid the consequences ... but you wouldn't do that coz that would be scamming them Smiley
hero member
Activity: 838
Merit: 507
November 30, 2011, 05:57:25 AM
#63
Another question-- is this, or will it be, open-sourced?

Didn't read the thread, eh? Smiley Yes, the source will be released soon.

It would also be very nice if you could detect a laptop/device running on battery power and not mine in that case.  http://www.google.com/search?q=get%20battery%20level%20java

That would be nice, but sadly a standard way of getting battery level information in Java doesn't seem to exist. You may be able to get it on some phones, but I don't think an unsigned applet can get that kind of information when running on a laptop.

Quote
You also wouldn't want to mine if someone visits on a smartphone or some other low-powered device, but I guess the 2-core threshold will take care of that.

Not completely: dual-core mobile phones already exist. I will investigate, thank you for the suggestion!
full member
Activity: 154
Merit: 101
Bitcoin!
November 30, 2011, 04:27:26 AM
#62
Another question-- is this, or will it be, open-sourced?
full member
Activity: 154
Merit: 101
Bitcoin!
November 30, 2011, 04:26:44 AM
#61
It would also be very nice if you could detect a laptop/device running on battery power and not mine in that case.  http://www.google.com/search?q=get%20battery%20level%20java  You also wouldn't want to mine if someone visits on a smartphone or some other low-powered device, but I guess the 2-core threshold will take care of that.
hero member
Activity: 838
Merit: 507
November 29, 2011, 08:12:15 PM
#60
Also, if you set threads to -1, will it not run on systems with 1 cpu?

Yes, that's what I proposed a couple days ago. The current default is:

1 cpu = leave it alone (0% of all resources)
2 cpus = use 80% of one (40% of all resources)
3 cpus = use 1.6 (80% of two) (53% of all resources)
4 cpus = use 2.4 (80% of three) (60% of all resources)

This looks very similar to what you proposed. The only noticeable difference is in the single-core case.
But again, I'm not sure we should put any stress on single-core machines. Correct me if I'm wrong, but these would mainly be relatively old 32-bit cpus, and at 25% you wouldn't get much out of them.
We should also consider that every connection to the work provider puts a little more load on the server, so I wonder if it would be worth it.
full member
Activity: 154
Merit: 101
Bitcoin!
November 29, 2011, 07:44:01 PM
#59
Also, if you set threads to -1, will it not run on systems with 1 cpu?
full member
Activity: 154
Merit: 101
Bitcoin!
November 29, 2011, 07:41:56 PM
#58
The first version of the embeddable miner is ready. Smiley
I have written a short guide for webmasters interested in testing:
http://www.litecoinpool.org/embed
It would be nice to have some more granularity in throttling the miner. A way to accomplish the following:

1 cpu = use 25% of it (25% of all resources)
2 cpus = use 75% of one (37.5% of all resources)
3 cpus = use 1.5 (100% of one and 50% of the second) (50% of all resources)
4 cpus = use 2.5 (100% of two and 50% of the third) (62.5% of all resources)

The goal would be to not overtax old systems, but give a little more work to newer systems that can handle it.
sr. member
Activity: 305
Merit: 250
Trust but confirm!
November 29, 2011, 06:09:13 PM
#57
Yes its awesome, it make Litecoinpool.org bit more better place when it has something that others doesnt have yet like this website embedded miner Cheesy I had honor to betatest it Cheesy and it works like a dream.
hero member
Activity: 560
Merit: 501
November 29, 2011, 06:05:13 PM
#56
The first version of the embeddable miner is ready. Smiley
I have written a short guide for webmasters interested in testing:
http://www.litecoinpool.org/embed
Looks great! I'll tinker around with it a little in a bit.

Add the ability to mine directly to a specific address and I'm all set. I understand that this will require some changes to your backend due to the way workers are handled, though.
Pages:
Jump to: