Skip to content

Stealth Address

Table of contents

Open Table of contents

What it is

A Stealth Address protocol allows for the derivation of valid public keys by 3rd parties without knowledge of the connected private key.

Stealth Addresses are used in Blockchains to protected the privacy fund recipients. To do so, senders generate a new Stealth Address non-interactively to which they send funds. The recipient can spend the funds given that the generated Stealth Address is linked to a private key only the recipient has knowledge of.

How it works

In our example, Alice wants to send funds to Bob in a privacy-preserving manner. She therefore generates a Stealth Address that’s linked to a private key Bob controls.

Throughout the writeup we’ll be working with an Elliptic Curve EE that is of order qq and has a generator GG. All calculations are done mod q\bmod\ q if not stated otherwise.

Basic Stealth Address

As a first step, Alice and Bob both generate their private- and public keys.

To generate a private key, Alice samples a random value from Zq\mathbb{Z}_q.

a$Zqa \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q

She then multiplies this private key aa with the generator GG to derive her public key.

A=aGA = aG

Bob does the same and also samples a random value from Zq\mathbb{Z}_q which he uses as his private key.

b$Zqb \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q

He then derives his public key by multiplying the private key bb with GG.

B=bGB = bG

Next up, Alice and Bob both share their public keys with each other.

Using the public key they just received, both can derive a shared secret SS following the Elliptic Curve Diffie-Hellman protocol.

To do so, Alice multiplies Bob’s public key BB with her private key aa.

S=aB=abG\begin{aligned} S &= aB \\ &= abG \end{aligned}

Bob calculates the same SS-value by multiplying Alice’s public key AA with his private key bb.

S=bA=baG\begin{aligned} S &= bA \\ &= baG \end{aligned}

Alice can now generate a new Stealth Address that’s linked to Bob’s private key bb.

To do so, she first has to hash the shared secret SS via a cryptographic hash function HH. The result of this operation is interpreted as a point on the curve EE. She then multiplies this result with the curve generator GG and adds Bob’s public key BB to it.

Pkst=B+G×H(S)Pk_{st} = B + G \times H(S)

This end result is the public key of the Stealth Address to which Alice can send funds to.

Bob can follow the same steps to derive the same Stealth Address public key.

Pkst=B+G×H(S)Pk_{st} = B + G \times H(S)

Furthermore, Bob can calculate a private key he can use to spend the funds from the Stealth Address by hashing the shares secret SS with a cryptographic hash function HH to which he adds his private key bb.

Skst=b+H(S)Sk_{st} = b + H(S)

Basic Stealth Address

Stealth Address with View Key

The downside of the aforementioned Stealth Address implementation is that Bob needs to monitor the Blockchain to find transactions that were sent to Stealth Addresses he can control. This problem of active monitoring can be outsourced to a service provider by introducing the concept of a view key.

It’s important to note that this view key can only be used to find Stealth Address transactions. It can’t be used to spend funds from such addresses as it’s not the corresponding private key.

The Stealth Address protocol variation follows similar steps as the basic Stealth Address implementation described above.

First, Alice generates her private key aa by sampling a random value from Zq\mathbb{Z}_q.

a$Zqa \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q

She then calculates her public key AA by multiplying this private key aa with the generator GG.

A=aGA = aG

Bob does the same and also samples his private key bb randomly from Zq\mathbb{Z}_q.

b$Zqb \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q

He also derives his public key BB by multiplying his private key bb with GG.

B=bGB = bG

In addition to this, he also generates a view key. A randomly sampled value from Zq\mathbb{Z}_q is used as the view key’s private value.

v$Zqv \overset{{\scriptscriptstyle\$}}{\leftarrow} \mathbb{Z}_q

The view key’s public value is it’s private value vv multiplied by GG.

V=vGV = vG

Following the stealth address protocol outlined above, Alice and Bob exchange their public keys AA and BB with each other. Bob also sends the public value of the view key VV to Alice.

Both can now derive a shared secret SS. To do so, Alice multiplies her private key aa with the view key’s public value VV.

S=aV=avG\begin{aligned} S &= aV \\ &= avG \end{aligned}

Bob calculates the same, shared value SS by multiplying the view key’s private value vv with Alice’s public key AA.

S=vA=vaG\begin{aligned} S &= vA \\ &= vaG \end{aligned}

Alice can now generate a valid Stealth Address by hashing the shared secret value SS with a cryptographic hash function HH, the result of which is interpreted as a point on the curve EE. This result is then multiplied by the generator GG to which Bob’s public key BB is added.

Pkst=B+G×H(S)Pk_{st} = B + G \times H(S)

Alice can now send funds to this public key.

A third party can now use the view key to monitor the Blockchain for Stealth Addresses to which Bob has the spending key bb. This is done by Bob handing the view key’s private value vv to the third party provider. The provider can then search for potential Stealth Addresses Bob controls by iterating over all the SS values and calculating the corresponding PkstPk_{st}.

Pkst=B+G×H(S)Pk_{st} = B + G \times H(S)

Once a stealth address is found, Bob can be notified. He can then calculate the Stealth Addresses’ private key SkstSk_{st} to be able to spend the funds.

Skst=b+H(S)Sk_{st} = b + H(S)

Again, it’s important to note that only Bob can spend the funds from the Stealth Address, as only he knows bb. Knowledge of vv and VV only allows for the identification of Stealth Addresses, but not for the control of them.

Stealth Address with View Key

Why it works

To see, why Bob can control any Stealth Address someone else generated with his public key BB or his public view key VV we can expand the Stealth Address equation.

Pkst=B+G×H(S)=bG+G×H(S)=G(b+H(S))=G(Skst)\begin{aligned} Pk_{st} &= B + G \times H(S) \\ &= bG + G \times H(S) \\ &= G(b + H(S)) \\ &= G(Sk_{st}) \end{aligned}

As can be seen, the public key PkstPk_{st} is equal to the private key SkstSk_{st} Bob calculates multiplied by the generator GG which is in alignment with the way private- and public keys are generated in regular Elliptic Curve Cryptography.

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.