Zcash javascript miner

Itā€™s already released at GitHub - mtve/yazecminer: yet another ZEC miner

Yes.

No, currently itā€™s for Zcash only.

You may add some delays in mine() function of index.html, and there is little can be done here to improve it more.

You may rewrite all emscripten part to make more delays between iteractions, and not only between algorithm steps, but also between some portions of initial blake2b strings fill to make it really smooth.

2 Likes

Hard to say without full context, but at least i canā€™t connect to ws://45.32.232.190:3131/ws

Hi, just curious, what is this exactly? A way for a visitor to help you mine? Or a visitor can mine from the browser to their wallet?

What are the server spec required?

Visitors mine to your wallet. Business model is up to you.

Since the server is kind of proxy, server load is low. 1K sessions are not noticeable, and 30K session are easy. You can do horizontal load sharing (sharding).

WOW that was much easier than I thought it would be to get set-up and running!

@mtve - you are my new hero! Do you have your own donation address? Guessing the t mining address for your site in the OP is OK? Cheers! ā€¦

- http://zcashtorservers.zapto.org/

" Welcome to the ā€˜Zcash on Torā€™ Servers Project - javascript (WebAssembly) miner - Auto CPU Donation Page ! "

" By keeping this web page open in your browser (Google Chrome is recommended) you will be contributing some CPU mining power towards the Zcash network and therefore donating a small amount of ZEC to the Zcash on Tor Servers Project;

_- https://forum.zcashcommunity.com/t/zcash-on-tor-a-community-funded-proposal/_

Whilst a number of Zcash on Tor servers are already online - we still require community donnations to help maintain and expand the project! You can find a list of existing servers and set-up instructions here;

_- https://forum.zcashcommunity.com/t/zcash-addnode-tor-hidden-service-onion/_

Every 0.00000001 ZEC mined really does helps us a lot! 100% of donations go directly towards our projects servers. Thank you! "

Thanks, nice to hear that!

1 Like

Testing some basic ā€˜optimizationsā€™ ā€¦

sudo nano yazecminer/js-backend/server.pl

    POOL_WORKER_PASS        => '256',

for zcash.flypool.org

" Password Leave empty or enter your custom share difficulty (default difficulty is 2000) "

ā€¦

We are basically running a proxy server here and need to handle thousands of concurrent TCP connections ā€¦

sudo nano /etc/security/limits.conf

add (at the base of file);

* soft nofile 51200
* hard nofile 51200

" To handle thousands of concurrent TCP connections, we should increase the limit of file descriptors opened. "

" Then, before you start the server, set the ulimit first "

ulimit -n 51200

" Tune the kernel parameters

The priciples of tuning parameters are

Reuse ports and connections as soon as possible.
Enlarge the queues and buffers as large as possible.
Choose the TCP congestion algorithm for large latency and high throughput. "

sudo nano /etc/sysctl.conf

Here is an example /etc/sysctl.conf of our production servers:

fs.file-max = 51200

net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_mem = 25600 51200 102400
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = hybla

Source : https://shadowsocks.org/en/config/advanced.html :sunglasses:

ā€¦

Also added some anti-robot HTML META TAGS etc.,

Sending some more traffic to see how it handles connections.

Mining on your smartphone browser is kinda fun !
Think I will get around to writing a separate server how-to set-up guide !

2 minute case study:
Screenshot_20170806-154530Screenshot_20170806-154311Screenshot_20170806-154549Screenshot_20170806-154411

Samsung s6 edge, android noughy.
Having 370 of these on 24/7 for a year would bring 1 ZEC worth of mining.

Only possibile ROI is through illegal actions (viruses and you no pay eletricity).

Research and Development + Educational use (for demonstration purposes etc.,) is likely to outweigh use by any bad actors for said ā€˜maliciousā€™ gain; for the same reasons assumed otherwise, IMHO.

Support coders rights, much ?

1 Like

I donā€™t believe he even bothered to read the posts between yourself and the developer. Keep up the good work @xyZcash and @mtve

You are bother adding value to this community and I appreciate it. :slight_smile:

Read the thread 2 times and find a hard time understand how to setup this and test it. How is this better option than regular miner like EWBF for example? :slight_smile:

Itā€™s more a proof of concept than anything. However, @xyZcash found an interesting use for it. If anyone wants to donate some hashrate to the development of the Zcash Tor project, they can just open his link and their browser will mine to an address+pool heā€™s specified. While individually it wonā€™t really add up to much, if multiple people do it he can make at least a little to go towards his costs.

This isnā€™t meant to replace GPU miners.

2 Likes

absolutly mate! Was just adding my own case study and sharing my personal thought of making profit with this code. Not that itā€™s invalid and didnā€™t say itā€™s immoral.

Itā€™s not better, EWBF works with GPU, in this case you work on the CPU, and only on the max CPU power of the browser, so itā€™s very limiting for actual income, as explain by xyzcash and the dev, itā€™s more of an experiment project than solution for mining.

If I was a school director I would ban cellphone at entrance and give them back when lessons are overā€¦ just throwing a free thought

cheer guys

2 Likes

No worries all. :smiley:

Where this does have a practical / development use is for the Zcash Testnet! The current hashing power on the testnet is around 5 Sol/s when I last checked.

I have a testnet node that this can be implemented on and all it requires in theory is the addition of a solo mining stratum proxy.

1 Like

nice good job thank you GitHub - mtve/yazecminer: yet another ZEC miner
Response from the server on your last submission: submitted!
just copy js-backend and run perl server. pl
check my javascript mining pool 104.131.87.144:8888

Donā€™t forget to change HTTP_HIDDEN_ADMIN_PAGE to some secret word.

Hello mtve. Great work. How can I contact you?

Hi mtve
thanks for sharing such helpful project ,
because my lack knowledge of javascript I couldnā€™t understand some point

First I figure out we get job and target and put them in
target and blkhdr

And then with Module._malloc() function we allocate memory and save addresses in target_p and blkhdr_p

Then with writeAsciiToMemory function we put then in HEAP8 array.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

Here is I could not understand , which function produces hash of block header and which function compare it with the target?

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
At the end if target achieved submit() will be called otherwise above will be called.

thank you.

Hello!

jazecminer.js is generated by emscripten, so all its magic is beyond any undestanding.

basically we call ā€œModule.asm._mine (blkhdr, target)ā€ which is inside emscripten-compiled code:
yazecminer/index.html at master Ā· mtve/yazecminer Ā· GitHub
yazecminer/main.c at master Ā· mtve/yazecminer Ā· GitHub
and we get invoked by callback ā€œsubmit(block)ā€ when we find solution below the target:
yazecminer/main.c at master Ā· mtve/yazecminer Ā· GitHub

hashing of found block and comparison with the target are here:
yazecminer/main.c at master Ā· mtve/yazecminer Ā· GitHub

1 Like

I understand it now.
Really thanks ,your are great .

1 Like