Welcome, Guest. Please login or register.

Author Topic: Faster POW for windows  (Read 6430 times)

AyrA

  • BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1261
  • Karma: +75/-7
  • bitmessage.ch and timeservice operator
    • View Profile
    • AyrAs Homepage
Faster POW for windows
« on: October 18, 2013, 09:13:36 AM »
For those using windows, you can achieve up to 40 times faster POW by letting a C++ DLL file calculate the POW, as this allows you to have multi-core support. (time was measured on an i7 8 core machine, your results may differ)


The compiled bitmessage client only uses one core and calculates in python, which is highly inefficient. If you are willing to run the source, you can however make some small modifications to it to increase the speed.
The source can be found here: https://github.com/grant-olson/bitmessage-powfaster/blob/master/fastcpu/bitmsghash.cpp



Installation instructions are provided in the zip file.

My Address: BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
Bitmessage Time Service (Subscribe): BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash
Support the Multipart Message Declaration Draft for Bitmessage: https://bitmessage.org/forum/index.php/topic,1553.0.html
Free Bitmessage to E-Mail Gateway: https://bitmessage.ch

Captain_Christopher

  • Newbie
  • *
  • Posts: 16
  • Karma: +2/-0
    • View Profile
Re: Faster POW for windows
« Reply #1 on: April 23, 2014, 02:54:47 PM »
sorry to dig up an old post, I was linked here by http://bitm.sg/?menu=pow

I hate to be a pest, but would this not be vulnerable to the heart bleed bug ? since it is using open ssl ?

would it also not be easier to simply compile you're own version of the Bitmessage.exe with these modifications in place ? I ask as I'm in favor of portable applications and there are several things included in the instructions that would require installation.

also since this is so old does this still apply to the January 25th build of Bitmessage ?

AyrA

  • BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1261
  • Karma: +75/-7
  • bitmessage.ch and timeservice operator
    • View Profile
    • AyrAs Homepage
Re: Faster POW for windows
« Reply #2 on: April 23, 2014, 06:16:59 PM »
sorry to dig up an old post, I was linked here by http://bitm.sg/?menu=pow

I hate to be a pest, but would this not be vulnerable to the heart bleed bug ? since it is using open ssl ?
No, the heartbleed bug only affects TLS connections, where OpenSSL is the server.
Bitmessage is not using TLS at all. The provided DLL File only uses the sha algorithm from the openSSL library and nothing more.

would it also not be easier to simply compile you're own version of the Bitmessage.exe with these modifications in place ? I ask as I'm in favor of portable applications and there are several things included in the instructions that would require installation.
It probably would be possible but I never tried to do it at all.

also since this is so old does this still apply to the January 25th build of Bitmessage ?
Yes, I am using the newest source of bitmessage myself.
My Address: BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
Bitmessage Time Service (Subscribe): BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash
Support the Multipart Message Declaration Draft for Bitmessage: https://bitmessage.org/forum/index.php/topic,1553.0.html
Free Bitmessage to E-Mail Gateway: https://bitmessage.ch

Captain_Christopher

  • Newbie
  • *
  • Posts: 16
  • Karma: +2/-0
    • View Profile
Re: Faster POW for windows
« Reply #3 on: April 23, 2014, 07:51:16 PM »
It probably would be possible but I never tried to do it at all.

any interest in trying ? it'd make things easier for those who wished to use this.

AyrA

  • BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1261
  • Karma: +75/-7
  • bitmessage.ch and timeservice operator
    • View Profile
    • AyrAs Homepage
Re: Faster POW for windows
« Reply #4 on: April 24, 2014, 01:18:18 AM »
any interest in trying ? it'd make things easier for those who wished to use this.
I would need to learn python...
My Address: BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
Bitmessage Time Service (Subscribe): BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash
Support the Multipart Message Declaration Draft for Bitmessage: https://bitmessage.org/forum/index.php/topic,1553.0.html
Free Bitmessage to E-Mail Gateway: https://bitmessage.ch

Captain_Christopher

  • Newbie
  • *
  • Posts: 16
  • Karma: +2/-0
    • View Profile
Re: Faster POW for windows
« Reply #5 on: April 24, 2014, 02:12:45 AM »
 :o given how much you've contributed to the Bitmessage project I would have thought you'd be an expert in python.

anyway fair enough thanks for the reply :)

Edeltrauth

  • Newbie
  • *
  • Posts: 20
  • Karma: +4/-0
    • View Profile
Re: Faster POW for windows
« Reply #6 on: April 25, 2014, 07:12:51 AM »
The problem here is that it is in fact not that easy (programatically) to combine c++ and python improving the bitmessage performance at all.
This is due to the fact, that C++ is an compiled language and Python needs an interpreter.  Easy spoken: Compiled languages works better with the cpu supporting real multithreading. With Python, Bitmessage works with threads too, but there is only one Thread or Task at a time.

I think the best way would be to implement Bitmessage completely in C or C++. (Or for Mac in Objective-C).

I asked myself a lot what the core reason was that atheros choosed python for the first version of bitmessage. If somebody knows, please tell me :)

Captain_Christopher

  • Newbie
  • *
  • Posts: 16
  • Karma: +2/-0
    • View Profile
Re: Faster POW for windows
« Reply #7 on: April 25, 2014, 12:01:10 PM »
the so much reminds me of the arguments I had with my python professor.

I think I understand what you're saying, and I agree with you.

But I guess what I'm confused about is that I sort of thought compiling the program was like taking the code and placing it in a optimized box. So I would have thought the issues of it being difficult to combine c++ and python would have already been addressed while in script form. So what I'm having a hard time understanding is why if you have a this working in script form, why compiling it would break the code ? if that makes any sense.

like if understand how AyrA's Pow speed up works, is that it side steps the python code since python sucks at multithreading and calls a C++ program to do the heavy work. I would have thought a compiled python program could still make a dll call. so I don't see why you'd need to combine stuff.

please forgive me if I am asking something stupid.

AyrA

  • BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1261
  • Karma: +75/-7
  • bitmessage.ch and timeservice operator
    • View Profile
    • AyrAs Homepage
Re: Faster POW for windows
« Reply #8 on: April 25, 2014, 04:06:01 PM »
I would need to include the dll in the executable. Many People have the weird ability to somehow "loose" dll files. If it is in the exe, I somehow would need to extract it, as the method to call a DLL function in python, requires the DLL as file form and not as an in-memory image.

The only issue I am facing is the fact, that I do not really understand python. I can program in other languages and therefore are able to achieve simple tasks but I never actually tried to compile the code.
My Address: BM-Bc7Rspa4zxAPy9PK26vmcyoovftipStp
Bitmessage Time Service (Subscribe): BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash
Support the Multipart Message Declaration Draft for Bitmessage: https://bitmessage.org/forum/index.php/topic,1553.0.html
Free Bitmessage to E-Mail Gateway: https://bitmessage.ch

Captain_Christopher

  • Newbie
  • *
  • Posts: 16
  • Karma: +2/-0
    • View Profile
Re: Faster POW for windows
« Reply #9 on: April 25, 2014, 04:49:33 PM »
"blink blink" how does one "loose" a dll ? I mean if they did that you're B2M wouldn't work either.

I have limited programing ability, but I'm trying to become more useful. to be honest, it sounds like a lot of work to try and wrap in in the exe, I'd just include the extra DLL in the zip.

I'm sure there is a better way but you could always do an

 If file exsists:
proceed
else
print file.

to generate the file. but that seems clumsy.

IVIasterZox

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Faster POW for windows
« Reply #10 on: May 28, 2015, 03:58:12 PM »
Can someone compile it:
https://bitmessage.org/wiki/Compiling_instructions#Optional:_Compile_into_a_stand-alone_EXE

And put it on the Download page, so new user can access it directly.

Darth.Severus

  • Newbie
  • *
  • Posts: 38
  • Karma: +2/-0
    • View Profile
Re: Faster POW for windows
« Reply #11 on: June 30, 2015, 09:18:21 AM »
I'd like to see a version of that for Linux (libbitmsg or so). I can't do it myself since I'm still a beginner in programming, though the code doesn't look very complex.

I think the ideal scenario would be if the official BM program would use such a library if it is installed.

I don't think a complete rewrite of BM is necessary nor a good idea. Having modules which are exchangeable is the better way to go. There are for a good reason languages which compile to C, so that complete programs don't need to be written in this language. There is even at least one version of python which does that. Maintainability, security and readability of the code is more important than perfect speed.

In the scripting language I'm using currently, it is possible to use the CILK-API in Linux to use multiple cores, so it wouldn't necessary be a problem with python.

Peter Šurda

  • Full Member
  • ***
  • Posts: 137
  • Karma: +4/-0
    • View Profile
Re: Faster POW for windows
« Reply #12 on: November 10, 2015, 07:57:59 PM »
The latest version of my mailchuck fork does contain the library, and it builds and runs on Windows, OSX and linux.

I wasn't able to find out how to bundle it on time for 0.5.2 release, but in the meantime that's been sorted out too, so 0.5.3 (this weekend) will have it bundled both on Windows and OSX binaries.