or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Batch-ECDSA for optimistic rollups
Optimistic rollups may be able to reduce calldata costs by aggregating ECDSA signatures from their on-chain transaction data into a SNARK. This document outlines some of the steps that would be necessary specifically.
Background on batch ECDSA verification
An ECDSA signature on an elliptic curve group with base point
G
of ordern
consists of a pair of non-zero integers(r, s)
modn
. To verify that a messagem
was signed by public keyQ
, we check for a hashH(m) \in [0, n - 1]
that:Q
is a valid public key(x, y) = (H(m) s^{-1}) G + (r s^{-1}) Q
, check that(x, y)
is notO
and thatr = x
.We can extend this to ECDSA* verification, meaning that there is a point
R = (r, r')
so thatR = (H(m) s^{-1}) G + (r s^{-1}) Q
. We can ask the prover to provider'
.For batch verification, suppose we have signatures
(r_i, s_i)
for messagesm_i
with hashesh_i = H(m_i)
and public keysQ_i
. For the completed signaturesR_i = (r_i, r_i')
provided by the prover and a randomt in [0, n - 1]
, we verify the RLC equationFor
k
signatures, this requires:5k
BigInt multiplications modn
.2k + 1
base points and these coefficients.R_i
is a valid completion of(r_i, -)
to a point on the curve.Costs without caching multiples of
G
We do this by amortizing the double steps in the double and add algorithm, so if
n
has 256 bits, this should cost:(2k + 1) * 256
secp256k1 addsThe cost of
k
independent ECDSA verifications is:256 * k
secp256k1 doubles2k * 256
secp256k1 addsCosts with caching multiples of
G
If we cache multiples of
G
with a window of size 10, we get(2k) * 256 + 26 + 1
secp256k1 addsThe cost of
k
independent ECDSA verifications is:256 * k
secp256k1 doubles256 * k + 27 * k
secp256k1 addsCosts with dynamic windowed method and caching for
G
Suppose we use the dynamic windowed method with window size
w
and also cacheG
with window size 10. Our costs are:2^w * 2 k
adds for dynamic caching of multiples ofR_i
andQ_i
256
doubles shared on the batch MSM26
additions forG
(256 / w) * (2k)
additions forR_i
andQ_i
This is a total of
256
doubles and(2 * 2^w + 512/w)k + 26
additions when we ignore costs of selecting.If we use the dynamic windowed method on each signature separately, we get:
2^w * k
adds for dynamic caching of multiples ofQ_i
256 * k
doubles26 * k
additions forG
(256/w) * k
additionsThis is a total of
256k
doubles and(2^w + 256/w + 26)k
adds.Note: This is the strategy suggested at:
Outstanding issues
Technical roadmap
ZK Circuits
Snark spec:
Possibly will want to use batch Keccak optmizations.
Steps to Production
Benefits and Tradeoffs
Gas Savings
We can estimate the gains from this approach in two ways:
A few consequences:
Additional latency
The SNARKs for batch ECDSA verification will need to be generated before commitment on L1, which may introduce more latency in this process.
References