Efficient Elliptic Curve Arithmetic in sCrypt/Script

Elliptic Curve

Addition

For each i, each point Pi is represented by two coordinates (xi, yi). To compute P3 = P1 + P2, we use the following formula:

Point Addition Formula
When P1 != P2
When P1 == P2

Efficient Solution

Instead of directly calculating point addition, we turn the issue on the head by passing the expected point P3 in the unlocking script. We only verify P3 = P1 + P2 in Script. To avoid modular multiplicative inverse in the verification, we transform the formula into the following equivalent form.

When P1 != P2
When P1 == P2
Point Addition Verification

Multiplication

Point Multiplication Verification

Acknowledgements

This article is based on the work of Craig Wright and Owen Vaughan, with invaluable feedback from Enrique Larraia and Owen Vaughan of nChain.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
sCrypt

sCrypt

sCrypt (https://scrypt.io) is a company with a mission to provide integrated on-chain smart contracting solutions on Bitcoin SV