Closed wyattzheng closed 6 years ago
i can't understand why the implements of algos need extensions.it should be pure php like this project
Yes, i tried to implement cryptonight algo... But without direct access to machine instructions (like intel 128 bit integers) is very slow.. Extensions is written on C language and muuuuch faster than pure PHP. And CN also require fast random memory r/w...-I can't found work-around of this problem....
Final variant of php-miner produce 1 hash per 15-30 seconds)) Incredible speed
that is too slow,and that is why CN algo can prevent ASIC,fast memory speed is needed.have you try running phpminer at local machine
Yes, i running performance tests using php-cli (machine is 8-core AMD processor, 8GB RAM, debian 9) so slow...
Maybe need look to /dev/shm or some other fast memory, but this to invoke syscall to read/write and probably increase mem access time... No solution
that is a bad news.php 7.0 is 2 times faster than php5.6. hope php can provide cpu cache mem interface,or really no solution.i will use your algo implements to build a phpminer to start my tests
i noticed that CryptoNight for NodeJs works well.have you read coinhive source codes? 3H/s it can reach in my PC.Theoretically,php should work as well as nodejs
i test on php 7.2 with opcache. You can use code as you want and anywhere...) Please tell me you result stat when all is done
Theoretically,php should work as well as nodejs :)
all right,thanks
i start perf test of these codes,i found that oaes_mix_cols cause too much times,when i disable this,the efficiency increase to 3 times higher than before
also, 'global' is toooooooooooooooo slow
those array with many default value spend much time,i think they can combine into a string,then substring them
I think about this... And PHP can apply bitwise operations to string like XOR so, faster XOR 2 strings fully than 2 arrays of N elements because ^ is operator, and perform 1 operation to any-length string "hello"^"12345" equals to five ops: h^1 e^2 l^3 ...
also need to unroll all loop, if's... etc
oaes is totally copied from C lang and adopted to PHP lang.. without any changes
About coinhive: -In browser used WebAssembly -nodejs load external dll/so with miner (i believe)
30seconds a hash is too slow,i think there are still spaces to optimize the codes.although it can not achieve the speed like WebAssembly.
There is another problem, cryptonight use AESENC x86 instruction: https://www.felixcloutier.com/x86/AESENC.html But PHP don't obtain this feature never
I thing general problem is in AESENC.. because extra hashes is supplimental and take less of 0.01% of all time, non-critical
right,One Round Aes spends almost full of time
Any working solution? maybe need check built-in extensions? Like bcmath?
using extensions rathan than writing whole the CN algo into a extension.I'm trying as much as possible to optimize the codes without a extension so i can upload this to freehost to earn XMR-coin
hey man,look this https://github.com/ZhyMC/phpminer
i code mine.php and found a solution of SubAndShiftAndMixAddRoundInPlace,this is very fast and i have verified it's correct.but i haven't finish mine.php, hope tonight i can finish it
Good But where you found cryptonight file ? I missed and not uploaded to github maybe)
i code it by myself spend over 20 hours.your blake256.php work in 64bit system caught some problems,so i have to fix it
how much hashes now?
20~30secs a hash just like yours,but i prepare to optimize codes when i finish the phpminer
i gonna use microtimes to check Timings.See which part is most slow and try to do a change
i uploaded cn.php may it's help you, don't know
i almost finish the cn.php myself, hahaha
what is problem with blake256?
maybe don't upload updates to project until it's ready and final stats available?)
it's about PHP_INT_MAX, php allow a number > 2147483647 when environment is 64bit,but somethings we need integer overflow
try to make it 0.1H/s,i think it's possible,and over this speed the project start to be a kind of useful,
ok
You debug hash func's, and after i finalize it - write usefull library,make code good write unit-tests for hash fn-s... etc and you add this as composer dep :)
so i write crypto-library, you write phpminer Good
that's nice
i fixed blake256 and work well in 64bit system.and CN is done! watch my codes at https://github.com/ZhyMc/phpminer
finally!!
it's worked now? how much h/s?
i just finished it.and the next step is to optimize it. (1/20 )h/s
CN hash is correct?
what is function trans($nb) actually doing? I have no idea what can broke b256 on 64 bit windows platform (i tested on PHP 7.2 for AMD x86_64) and blake hashes is fine calculated
but in my computer it calculated wrong results.trans() make 64int overflow like 32int
ok, later i create test cases for blake with more data&hash pairs and we can check this behavior
Please, after it's ready, create inplace(remove function call) code for SubAndShiftAndMixAddRoundInPlace, xor_blocks .... etc This increase calc speed in 3-5 times, i tested
wow 3-5times ,that makes me feel there are lots of spaces to optimze
i'm working on stratum protocol,it is exciting to me
i suggest to not use stratum.. Use long poll instead. Because it's easiest way and not require extra threads for IO.
Miner arch should be like this: 1 master process-communicate with minepoll and receiver tasks N slave processes compute hashes +This allow to stop process if hash is already mined by somebody other +Not required thread model
IPC can be implemented used named pipe
just like what you said,i learn the theory of pool .You can see that my phpminerBridge.js and phpminer.php
yes, i seen latest u'r activity
are you going to build a php-miner of Monero coin? they are all algos that CryptoNote mentioned
thanks to your contributions!