Standalone

### Implementing Elliptic Curves

Part II

# Elliptic Curve Operations

With field arithmetic abstracted away, we can now implement our elliptic curve. For efficiency purposes, we want to implement the elliptic curve in the Jacobian space, where points are represented as $(x,y,z)$.In `contracts/EllipticCurve.sol`

, we have defined a new `struct JacPoint`

to represent points on the curve.

```
struct JacPoint {
Felt x;
Felt y;
Felt z;
}
```

We want to implement functions to support point manipulation. Specifically, we wish to implement the following functions.

Function | Description |

| Adds 2 Jacobian points and returns the result. If the points are equivalent, then double the point instead. |

| Multiplies a Jacobian point with a scalar value and returns the result. |

| Multiplies the generator point $G$ with a scalar value and returns the result. |

In our implementation, we define the point at infinity to be any point with z-coordinate of value $0$. For example, $(4,8,0)$ and $(1,1,0)$ are both the point at infinity.

## Your Task

In `contracts/EllipticCurve.sol`

, implement the logic for `jacAdd`

, `jacMul`

, and `generatePoint`

. These functions must be implemented efficiently.

Run tests in Questplay

Having grasped the runic lexicon, you can now begin to enchant fresh power atop that with had begun to fade...