# ECDSA

* Definition of an elliptic curve: $y^2 = ax^3 + bx + c$
* Elliptic curve that Ethereum uses: $y^2 = x^3 + 7$
* unique characteristic of an elliptic curve is that its possible to connect two points to produce a third point - kind of like a binary operation
* points on an elliptic curve form a group
* identity element - point at infinity (straight line; gradient is infinite)
* if A = (x, y), the inverse of A is A = (x, -y)
* ECDSA malleability attack
* every point has an image across the x-axis (how about the point on the x-axis where the tangent is vertical)
* points on an ECDSA also form an abelian group
* tl;dr of elliptic curve addition:
* we have the points

<figure><img src="https://3023085841-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPx19QJfp3ypeVgsH4aV5%2Fuploads%2FFv7lPEOSFx4H87kFRFH5%2Fimage.png?alt=media&#x26;token=16d95197-8ead-41c9-9ad4-c59c5ecc1ca0" alt=""><figcaption></figcaption></figure>

* in the curve

<figure><img src="https://3023085841-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPx19QJfp3ypeVgsH4aV5%2Fuploads%2FxC0azkFXELJzJiZoXEzz%2Fimage.png?alt=media&#x26;token=2fb90712-f4a0-4618-96b6-0f96490ee18b" alt=""><figcaption></figcaption></figure>

* which gives us a third point (x\_r, y\_r)&#x20;

<figure><img src="https://3023085841-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPx19QJfp3ypeVgsH4aV5%2Fuploads%2FRhvz7n1PCgBiqCpbZYCq%2Fimage.png?alt=media&#x26;token=41d36a58-245e-409e-babd-03f6a8b4699c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3023085841-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPx19QJfp3ypeVgsH4aV5%2Fuploads%2FcGNBZofXgrAfFD9EPgUf%2Fimage.png?alt=media&#x26;token=329da5a8-2dce-48b2-b76c-eecd7766382d" alt=""><figcaption></figcaption></figure>

* ethereum has ECDSA precompiles (ecrecover) so we can do elliptic curve manipulation on chain
* bn128 curve is pairing friendly
