[BOUNTY] $5000 BitUSD - LibSecp256k1 integration with FC

Started by bytemaster, March 06, 2015, 12:09:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jsidhu

Quote from: vlight on March 09, 2015, 09:44:47 PM
But the main part that slows sync is HDD not CPU. The software could also use more RAM that is left unused.

Sorry it already uses too much RAM lol
Hired by blockchain | Developer
delegate: dev.sidhujag

vlight

But the main part that slows sync is HDD not CPU. The software could also use more RAM that is left unused.

bytemaster

Quote from: pc on March 09, 2015, 10:33:01 AM
Quote from: bytemaster on March 06, 2015, 12:09:10 AM
I would like to have  a drop in replacement that implements this api:
https://github.com/BitShares/fc/blob/master/include/fc/crypto/elliptic.hpp

Using:
https://github.com/bitcoin/secp256k1

I'm making good progress. Results are promising, the ecc_test program runs about 20 times faster with libsecp256k1 than with openssl.

I noticed the current implementation of public_key::mult is broken - it computes the same result as public_key::add, only in a different way. Fortunately, it doesn't seem to be used anywhere in the bitshares code.

Quote from: vikram on March 06, 2015, 06:29:09 PM
Latest Bitcoin Core 0.10 has switched to libsecp256k1 ONLY for signing: https://github.com/bitcoin/bitcoin/blob/aeb92792281b4cb9958f3defc9e36f63e65b778a/doc/release-notes.md#improved-signing-security

If we choose to integrate this into mainline BitShares I will never use it for any more functionality than latest Bitcoin uses it for.

I can provide a "mixed" variant, where signing is done using openssl and verification using libsecp256k1. (My plan is to use a CMake cache var for selecting the ecc implementation to use.)

Good work!   That should help greatly reduce our sync CPU load.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

cube

Quote from: svk on March 09, 2015, 12:46:00 PM

Good stuff, keep up the good work! :)

For all who find his work good, please vote for Delegate dev-pc.bitcube! 

Delegate dev-pc.bitcube has been registered for some time now. Please show some love to it. :)
ID: bitcube
bitcube is a dedicated witness and committe member. Please vote for bitcube.

svk

Quote from: pc on March 09, 2015, 10:33:01 AM
Quote from: bytemaster on March 06, 2015, 12:09:10 AM
I would like to have  a drop in replacement that implements this api:
https://github.com/BitShares/fc/blob/master/include/fc/crypto/elliptic.hpp

Using:
https://github.com/bitcoin/secp256k1

I'm making good progress. Results are promising, the ecc_test program runs about 20 times faster with libsecp256k1 than with openssl.

I noticed the current implementation of public_key::mult is broken - it computes the same result as public_key::add, only in a different way. Fortunately, it doesn't seem to be used anywhere in the bitshares code.

Quote from: vikram on March 06, 2015, 06:29:09 PM
Latest Bitcoin Core 0.10 has switched to libsecp256k1 ONLY for signing: https://github.com/bitcoin/bitcoin/blob/aeb92792281b4cb9958f3defc9e36f63e65b778a/doc/release-notes.md#improved-signing-security

If we choose to integrate this into mainline BitShares I will never use it for any more functionality than latest Bitcoin uses it for.

I can provide a "mixed" variant, where signing is done using openssl and verification using libsecp256k1. (My plan is to use a CMake cache var for selecting the ecc implementation to use.)

Good stuff, keep up the good work! :)
Worker: dev.bitsharesblocks

pc

Quote from: bytemaster on March 06, 2015, 12:09:10 AM
I would like to have  a drop in replacement that implements this api:
https://github.com/BitShares/fc/blob/master/include/fc/crypto/elliptic.hpp

Using:
https://github.com/bitcoin/secp256k1

I'm making good progress. Results are promising, the ecc_test program runs about 20 times faster with libsecp256k1 than with openssl.

I noticed the current implementation of public_key::mult is broken - it computes the same result as public_key::add, only in a different way. Fortunately, it doesn't seem to be used anywhere in the bitshares code.

Quote from: vikram on March 06, 2015, 06:29:09 PM
Latest Bitcoin Core 0.10 has switched to libsecp256k1 ONLY for signing: https://github.com/bitcoin/bitcoin/blob/aeb92792281b4cb9958f3defc9e36f63e65b778a/doc/release-notes.md#improved-signing-security

If we choose to integrate this into mainline BitShares I will never use it for any more functionality than latest Bitcoin uses it for.

I can provide a "mixed" variant, where signing is done using openssl and verification using libsecp256k1. (My plan is to use a CMake cache var for selecting the ecc implementation to use.)
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 [url="http://bitcoin.quisquis.de"]http://bitcoin.quisquis.de[/url]

abit

It's said that LibSecp256k1 is much faster than OpenSSL while verifying signatures. By using it we can improve the client sync speed much, which is a bottleneck by now.

http://www.reddit.com/r/Bitcoin/comments/2weymr/experiment_bitcoin_core_0100_initial_sync_time/coqghm2
Quote
Just did a benchmark on libsecp256k1's current master, without GMP, without hand-written assembly, and it's around 3.6x faster than OpenSSL on my machine (64-bit code, i7 cpu). When the assembly is compiled in (which does not require any extra dependencies anymore), it's 4.9 times faster.
BitShares committee member: abit
BitShares witness: in.abit

julian1

This one is supposed to be fast as well, with inline gcc assembler primitives for ARM.

https://github.com/kmackay/micro-ecc

jsidhu

Quote from: vikram on March 06, 2015, 06:29:09 PM
Quote from: jsidhu on March 06, 2015, 07:32:17 AM
Quote from: testz on March 06, 2015, 02:09:55 AM
Good starting point/example can be Auroracoin sources where it's implemented (see define USE_SECP256K1):
https://compilr.com/einsteinz/auroracoin-core/src/key.cpp

Whole sources from compilr.com can be found here: https://mega.co.nz/#!VJYRXQ7A!7LjU3M8iXWZlf4WIoRdrZw7gYXL_abtNgjxeQTyYxPQ
They just based off of latest btc.... Best to look here instead https://github.com/bitcoin/bitcoin/commit/16a58a86442ad587449f321c0dbab08cc028c2bd

Btw secp256k1  is experimental and bitcoin hasnt given it the nod yet.. Why do this?

Latest Bitcoin Core 0.10 has switched to libsecp256k1 ONLY for signing: https://github.com/bitcoin/bitcoin/blob/aeb92792281b4cb9958f3defc9e36f63e65b778a/doc/release-notes.md#improved-signing-security

If we choose to integrate this into mainline BitShares I will never use it for any more functionality than latest Bitcoin uses it for.

Is the intention to use it for more? If so, then does bitshares do it now or wait?
Hired by blockchain | Developer
delegate: dev.sidhujag

liondani

It's getting interesting again.  :)

Sent from my ALCATEL ONE TOUCH 997D
[url="https://www.steempeak.com/@liondani"]https://www.steempeak.com/@liondani[/url]


xeroc

Ah .. I understand .. we are talking about the implementation libsecp256k1 ..

jsidhu

Quote from: xeroc ¯\_(ツ)_/¯ on March 06, 2015, 07:54:31 AM
Quote from: jsidhu on March 06, 2015, 07:32:17 AM
Btw secp256k1  is experimental and bitcoin hasnt given it the nod yet.. Why do this?
secp256k1 is a set of parameters for a elliptic curve and not a piece of software
https://en.bitcoin.it/wiki/Secp256k1
There is some verification so it needs to be fully tested... Its not yet.. But as long as it passes some integration and unit tests it should be ok i think.
Hired by blockchain | Developer
delegate: dev.sidhujag