Skip to content

ECDSA Adaptor Signature

Table of contents

Open Table of contents

What it is

An adaptor signature scheme is a signing algorithm that’s carried out in two steps while binding itself to a secret value. During signature creation an incomplete, partial signature is generated which can then be turned into a valid, full signature by incorporating a secret value. Once the full signature is published, the secret value can be recovered using the partial- and full signature.

Adaptor signatures are useful primitives for Blockchain applications as they support the implementation of ”Scriptless Scripts”. Scriptless scripts can be implemented as rules that rely only on the existence of digital signatures and their verification algorithm, a requirement all Blockchains support out-of-the-box.

A prominent example for the usage of adaptor signatures is that of an ”Atomic Swap”, a protocol that allows two parties to exchange digital currencies with each other without having to trust one another. At a high level, Party A would leak the secret value that turns a partial signature into a full signature when posting a valid transaction on Blockchain #1 to move funds from Party B to Party A. Party B can then use this leaked secret to adapt a partial into a full signature to move funds from Party A to Party B on Blockchain #2.

How it works

This post describes adaptor signatures based on ECDSA Signatures, so it’s useful to have a solid understanding of both concepts before continuing.

Let’s quickly refresh our memory about adaptor signatures. There are four different operations that characterize an adaptor signature scheme:

  1. PreSign generates a partial signature bound to a secret value
  2. PreVerify verifies a partial signature for correctness
  3. Adapt turns a partial signature into a full signature
  4. Extract recovers the secret value using the partial- and full signature

In addition to the operations outlined above, there’s also a requirement for a statement / witness pair for a hard relation RR. In our case such hard relation is that of the discrete logarithm problem on Elliptic Curves (ECDLP). So if one has access to T=tGT = tG it’s computationally infeasible to calculate tt from TT. The statement which can be publicly shared would be T=tGT = tG whereas the witness which needs to be kept private is tt.

As discussed, we’ll work with an Elliptic Curve EE that has a generator GG and is of order qq. All calculations are done mod q\bmod\ q if not stated otherwise.

Our example scenario we’ll work through to learn about ECDSA-based adaptor signatures is that of Alice who knows the statement TT and witness tt wanting to get a signature over her message mm from Bob. Bob, however doesn’t simply want to sign Alice’s message mm with his private key xx. In exchange for signing her message mm, he wants to be able to learn the witness tt which could be useful for him in future interactions (e.g. when Alice and Bob use adaptor signatures in an ”Atomic Swap” protocol as touched upon above).

Setup

At first, Alice generates her statement / witness pair. She does so by randomly sampling a value tt from Zq\mathbb{Z}_q which is her witness. She then multiplies the witness by the generator GG to derive the statement TT.

t$Zqt \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q T=tGT = tG

Bob on the other hand generates his private- and public key pair. He samples a random value xx from Zq\mathbb{Z}_q which is his private key. Multiplying this private key by the generator GG results in his public key XX.

x$Zqx \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q X=xGX = xG

Next up, Alice sends the message mm she wants to get a signature for alongside her statement TT to Bob.

PreSign

Given that Bob doesn’t want go generate a full signature thats valid according to the ECDSA Signature verification algorithm, he creates a partial signature using Alice’s statement TT instead. This partial signature can then be verified for correctness by Alice.

To do so Bob generates a random nonce kk which he then multiplies by the generator GG to derive a publicly shareable nonce value RR'.

k$Zqk \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q R=kGR' = kG

Bob also generates a second, publicly shareable nonce value RR by multiplying the randomly sampled kk with Alice’s statement TT.

R=kTR = kT

Both values RR' and RR are points on the Elliptic Curve and therefore have xx- and yy-coordinates. Because of that Bob can define a value rr as the xx-coordinate of RR.

r=Rxr = R_x

Next up, Bob needs to turn Alice’s message mm into a representation that can be “mapped onto” the Elliptic Curve EE. This is done by hashing mm with a cryptographic hash function HH and interpreting the result as a point on the curve.

z=H(m)z = H(m)

As a last step, he computes the value ss' as the inverse of the nonce kk multiplied by the hashed message zz which is added to the product of the point rr and his secret key xx.

s=k1(z+rx)s' = k^{-1}(z + rx)

Bob has successfully calculated the partial signature which consists of the values rr and ss'. He sends these values alongside his public key XX as well as RR and RR' to Alice.

PreVerify

Alice can now check if the partial signature was calculated correctly.

At first, she checks if she can recompute the same value for rr by comparing it to the xx-coordinate of the RR value Bob shared.

r=?Rxr \overset{?}{=} R_x

She recomputes zz by hashing her message with the same cryptographic hash function HH that Bob used.

z=H(m)z = H(m)

Next up, the values uu and vv are calculated using the inverse of ss' and multiplying it by the hashed message zz and the value rr respectively.

u=s1zu = s'^{-1}z v=s1rv = s'^{-1}r

Alice then checks if the RR' value she received from Bob equals uu multiplied by the generator GG added to the multiplication of vv by Bob’s public key XX.

R=?uG+vXR' \overset{?}{=} uG + vX

The partial signature was calculated correctly if the above statement is true.

Adapt

Once the verification of the partial signature succeeds, Alice can turn it into a full signature by multiplying ss' with the inverse of her witness tt.

s=st1s = s't^{-1}

Extract

When Alice shares the full, valid signature publicly Bob can recover Alice’s witness tt using both, the partial- and full signature.

t=s1st = s^{-1}s'

ECDSA Adaptor Signature

Why it works

The core building block that turns a regular ECDSA Signature into an adaptor signature is the usage of the witness tt and its statement TT in the calculation of rr and ss.

PreVerify

First, recall that zz is the hash of the message mm which is interpreted as a point on the Elliptic Curve EE.

Using the equation of ss', we can isolate kk.

s=k1(z+rx)×ksk=z+rx×s1k=s1(z+rx)\begin{aligned} s' &= k^{-1}(z + rx) && \mid \times k \\ s'k &= z + rx && \mid \times s'^{-1} \\ k &= s'^{-1}(z + rx) \end{aligned}

Expanding R=uG+vXR' = uG + vX and substituting kk for s1(z+rx)s'^{-1}(z + rx) (which we’ve just calculated), we can see that R=kGR' = kG.

R=uG+vX=uG+vxG=G(u+vx)=G(s1z+s1rx)=s1G(z+rx)k=s1(z+rx)=kG\begin{aligned} R' &= uG + vX \\ &= uG + vxG \\ &= G(u + vx) \\ &= G(s'^{-1}z + s'^{-1}rx) \\ &= s'^{-1}G(z + rx) && \mid k = s'^{-1}(z + rx) \\ &= kG \end{aligned}

Taking a look at the partial signature generation above, we can verify that this Elliptic Curve point RR' is the same as the one Bob calculated by multiplying kk with GG.

However, RR' is not the same as R=kTR = kT which was used by Bob to derive the rr value used for a full signature. Alice therefore needs to adapt the partial signature first to turn it into a full, valid signature.

Adapt

A partial signature can be adapted by multiplying ss' with the inverse of the witness tt.

s=st1=k1(z+rx)t1=k1t1(z+rx)\begin{aligned} s &= s't^{-1} \\ &= k^{-1}(z + rx)t^{-1} \\ &= k^{-1}t^{-1}(z + rx) \end{aligned}

Deriving ss this way turns the partial signature into a full signature that verifies according to the ECDSA Signature verification algorithm.

Again, recall that the value zz is the result of hashing the message mm with a cryptographic hash function.

Using the ss value we just derived, we can isolate ktkt.

s=st1=k1(z+rx)t1=k1t1(z+rx)×ktskt=z+rx×s1kt=s1(z+rx)\begin{aligned} s &= s't^{-1} \\ &= k^{-1}(z + rx)t^{-1} \\ &= k^{-1}t^{-1}(z + rx) && \mid \times kt \\ skt &= z + rx && \mid \times s^{-1} \\ kt &= s^{-1}(z + rx) \end{aligned}

We can now use the regular ECDSA Signature verification algorithm to verify the adapted signature.

R=uG+vX=uG+vxG=G(u+vx)=G(s1z+s1rx)=s1G(z+rx)kt=s1(z+rx)=ktG=kT\begin{aligned} R &= uG + vX \\ &= uG + vxG \\ &= G(u + vx) \\ &= G(s^{-1}z + s^{-1}rx) \\ &= s^{-1}G(z + rx) && \mid kt = s^{-1}(z + rx) \\ &= ktG \\ &= kT \end{aligned}

Checking the partial signature generation, we can see that this Elliptic Curve point RR is the same that Bob used to derive the value rr. The signature is therefore valid.

Extract

Once Alice shares the full signature publicly, it can be used together with the partial signature to extract the witness tt.

t=s1s=(st1)1s=1st1s=1s1ts=1sts=tss=tss=tss=t\begin{aligned} t &= s^{-1}s' \\ &= (s't^{-1})^{-1}s' \\ &= \frac{1}{s't^{-1}}s' \\ &= \frac{1}{s'\frac{1}{t}}s' \\ &= \frac{1}{\frac{s'}{t}}s' \\ &= \frac{t}{s'}s' \\ &= \frac{ts'}{s'} \\ &= \frac{t\cancel{s'}}{\cancel{s'}} \\ &= t \end{aligned}

References

The following resources have been invaluable for me to learn the concepts discussed in this article.

You should definitely give them a read if you want to dive deeper into the topic.