Bitcoin Forum
May 04, 2024, 03:26:23 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Point addition / double formulas in Bitcoin  (Read 205 times)
softcake (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
February 01, 2018, 03:17:19 PM
 #1

I am currently writing my master thesis about elliptic curve cryptography and Bitcoin. For the section about the performance of secp256k1 and possible improvements I wanted to look at how point addition and multiplication has been implemented in Bitcoin.
I am not the best programmer (I am doing my master in mathematics) and so I wanted to know if there is a theoretical explanation, or where I can find the source code of this part of Bitcoin, to try to figure it out with the help of some IT friends.

I found this paper (https://eprint.iacr.org/2016/103.pdf) "Speed Optimizations in Bitcoin Key Recovery Attacks"
where it says in section 4.2.3. Secp256k1 point addition formulas: "Bitcoin developers implemented a mixed coordinate formula (Jacobian-Affine)
version based on >>Weierstraß Elliptic Curves and Side-Channel Attacks<< by Eric Brier and Marc Joye :

https://s17.postimg.org/eotd6k6nz/point_multi_BTC.png

Is this still the version up to date?

In (https://www.microsoft.com/en-us/research/wp-content/uploads/2016/06/complete-2.pdf) "Complete Addition Formulas for Prime Order Elliptic Curves" by Joost Renes, Craig Costello and Lejla Batina it sais that
"compared to the incomplete addition function secp256k1 gej add var used in the Bitcoin
code, our complete addition function in Algorithm 7 saves 4S at the cost of 8a+1mul int5;
compared to Bitcoin's incomplete mixed addition function secp256k1 gej add ge var, our
complete mixed addition saves 3S at the cost of 3M + 2a + 1mul int; and, compared to
Bitcoin's doubling function secp256k1 gej double var, our formulas save 2S + 5mul int at
the cost of 3M+ 3a. In this case it is unclear which set of formulas would perform faster,
but it is likely to be relatively close and to depend on the underlying field arithmetic and/or
target platform. Furthermore, the overall speed is not just dependent on the formulas: the
if statements present in the Bitcoin code also hamper performance. On the contrary, the
complete algorithms in this paper have no if statements."
This paper is from the 28th of April 2016. Which changes of the formulas have been done since then?

I hope someone might take the time to explain the current implementations in Bitcoin, or has another reference of a paper or a forum topic where I can find some answers!
1714836383
Hero Member
*
Offline Offline

Posts: 1714836383

View Profile Personal Message (Offline)

Ignore
1714836383
Reply with quote  #2

1714836383
Report to moderator
1714836383
Hero Member
*
Offline Offline

Posts: 1714836383

View Profile Personal Message (Offline)

Ignore
1714836383
Reply with quote  #2

1714836383
Report to moderator
1714836383
Hero Member
*
Offline Offline

Posts: 1714836383

View Profile Personal Message (Offline)

Ignore
1714836383
Reply with quote  #2

1714836383
Report to moderator
According to NIST and ECRYPT II, the cryptographic algorithms used in Bitcoin are expected to be strong until at least 2030. (After that, it will not be too difficult to transition to different algorithms.)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714836383
Hero Member
*
Offline Offline

Posts: 1714836383

View Profile Personal Message (Offline)

Ignore
1714836383
Reply with quote  #2

1714836383
Report to moderator
1714836383
Hero Member
*
Offline Offline

Posts: 1714836383

View Profile Personal Message (Offline)

Ignore
1714836383
Reply with quote  #2

1714836383
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
February 01, 2018, 03:44:44 PM
 #2

The code that Bitcoin Core uses for ecdsa operations on the secp256k1 curve can be found here: https://github.com/bitcoin-core/secp256k1 (it's its own library). There are comments throughout the code and some additional documentation on the readme that should help you understand what it is actually doing.

mvrcrypto
Newbie
*
Offline Offline

Activity: 9
Merit: 4


View Profile
February 01, 2018, 04:17:31 PM
 #3

If you have some basics in python, you can check the bitcoin library.
It's complete and simpler than the C++ core library.
Check https://github.com/vbuterin/pybitcointools/blob/aeb0a2bbb8bbfe421432d776c649650eaeb882a5/bitcoin/main.py
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!