Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC5564, a standard proposing stealth addresses for private interactions between senders and recipients.
The following material is translated, summarized, and supplemented with explanations.
As of January 7, 2024, 5564 was at the Review stage.
I have also covered a range of other EIPs.
Overview
This standard proposes a mechanism for addresses known as stealth addresses. A sender executing a transaction or transfer can use stealth addresses to non-interactively generate a private account accessible only to the intended recipient.
Non-interactive means the operation can be performed without direct communication between the sender and recipient. This reduces the effort and time required while preserving privacy.
The standard also provides a basic implementation approach for developing stealth address protocols.
A singleton contract deployed at 0x55649E01B5Df198D18D95b5cc5051630cfD45564 provides a standard way to notify recipients of the necessary information. Projects can build stealth address functionality on top of this singleton contract.
The standard also proposes an implementation of a cryptographic scheme using the SECP256k1 curve. SECP256k1 is used in cryptography for Bitcoin, Ethereum, and other systems and helps secure stealth addresses and preserve privacy.
What Is SECP256k1?
SECP256k1 is an important technology underpinning the security of cryptocurrencies such as Bitcoin and Ethereum. It uses a mechanism known as elliptic curve cryptography (ECC).
What Is Elliptic Curve Cryptography (ECC)?
ECC is a cryptographic technique for encrypting data. It enables secure data transmission and transactions. Elliptic curve cryptography performs calculations using points on a particular curve.
How SECP256k1 Works
Shape of the Elliptic Curve
The elliptic curve used by SECP256k1 is represented by the following equation.
Points on this curve are used for encryption and digital signatures.
Finite Field
Calculations are performed in a special mathematical set with a finite number of elements (numbers), called a finite field. SECP256k1 uses a very large prime number (approximately 10 to the power of 77). This makes the relevant computational problems very difficult, increasing security.
Public-Key Cryptography and Digital Signatures
The main applications of ECC include public-key encryption and digital signatures.
Public-Key Encryption
- Private key
- A secret number that you hold.
- You must not disclose this number to anyone.
- Public key
- A value derived mathematically from the private key that can be shared with anyone.
- The public key enables encryption or verification without knowing the private key.
For example, suppose you want to send a secret message to a friend. You use your private key to encrypt the message. Your friend can use your public key to decipher that message.
Digital Signatures
A digital signature is a mechanism for proving that you really sent a message.
- Signing
- Sign the message using your private key.
- The signature is calculated from the message and private key.
- Verification
- The recipient verifies the signature using your public key.
- Verification establishes that the message has not been altered and identifies who signed it.
Applications of SECP256k1
- Bitcoin
- In Bitcoin transactions, the sender signs with a private key, and other network participants verify the signature using the public key.
- Ethereum
- Ethereum also uses SECP256k1 to derive addresses and sign transactions.
Motivation
Standardizing non-interactive stealth address generation could substantially improve privacy on Ethereum and other EVM-compatible chains. This mechanism allows recipients to preserve their privacy when receiving assets. Stealth address generation is based on a cryptographically derived shared secret known only to the sender and recipient. The sender uses the shared secret to create a temporary stealth address for the recipient. This is a temporary receiving address dedicated to that recipient.
Outside observers cannot determine whether the stealth address is associated with a particular recipient. The sender knows the intended recipient of the stealth address, preserving the recipient's privacy from outsiders.
A single contract supports multiple cryptographic schemes, allowing recipients to monitor all stealth addresses in one place. Recipients can therefore manage assets efficiently without missing transactions.
Specification
A stealth meta-address is a set of public keys used to generate a stealth address calculated specifically for a recipient. This protects the recipient's privacy by concealing from others who owns the address.
A spending key is the private key used to spend funds sent to a stealth address; its corresponding public key is called the spending public key. A viewing key is the private key used to check whether funds sent to a stealth address belong to the recipient; its corresponding public key is the viewing public key.
Stealth addresses may use different formats, and the length of a stealth meta-address depends on the public key length.
For example, if a public key is n bytes long, an n-byte stealth meta-address uses the same key as both the spending and viewing public keys.
For a 2n-byte stealth meta-address, the first n bytes are the spending public key and the remaining n bytes are the viewing public key.
This mechanism lets recipients determine whether funds sent to them are theirs and spend those funds securely. It also preserves recipient privacy because outsiders cannot determine who owns the funds.
/// @notice Generates a stealth address from a stealth meta address.
/// @param stealthMetaAddress The recipient's stealth meta-address.
/// @return stealthAddress The recipient's stealth address.
/// @return ephemeralPubKey The ephemeral public key used to generate the stealth address.
/// @return viewTag The view tag derived from the shared secret.
function generateStealthAddress(bytes memory stealthMetaAddress)
external
view
returns (address stealthAddress, bytes memory ephemeralPubKey, bytes1 viewTag);The code above defines a function that lets a sender generate a recipient-specific stealth address from the recipient's stealth meta-address. It takes the recipient's stealth meta-address as a parameter.
Calling the function returns three results.
stealthAddress- A newly generated stealth address for the recipient.
- It is used for transfers and communication, protecting the recipient's privacy.
ephemeralPubKey- The ephemeral public key used to generate the stealth address.
- It is used once and then discarded.
viewTag- A view tag derived from the shared secret.
- It helps recipients identify transactions intended for them.
This function can be called externally and is read-only. It retrieves information without changing blockchain state. Senders can use it to generate stealth addresses for secure, privacy-preserving transfers.
/// @notice Returns true if funds sent to a stealth address belong to the recipient who controls
/// the corresponding spending key.
/// @param stealthAddress The recipient's stealth address.
/// @param ephemeralPubKey The ephemeral public key used to generate the stealth address.
/// @param viewingKey The recipient's viewing private key.
/// @param spendingPubKey The recipient's spending public key.
/// @return True if funds sent to the stealth address belong to the recipient.
function checkStealthAddress(
address stealthAddress,
bytes memory ephemeralPubKey,
bytes memory viewingKey,
bytes memory spendingPubKey
) external view returns (bool);The code above defines a function allowing a recipient to check whether a given stealth address belongs to them. Recipients can use it to determine whether the funds sent belong to them.
The function takes four parameters.
stealthAddress- The recipient's stealth address to check.
ephemeralPubKey- The ephemeral public key used to generate the stealth address.
viewingKey- The recipient's private viewing key, used to identify their transactions.
spendingPubKey- The recipient's public spending key.
The function returns a Boolean value (True or False).
If it returns True, funds sent to the stealth address belong to the recipient.
This function is also externally callable and read-only, so it checks information without changing blockchain state.
Recipients can use it to check securely and efficiently whether funds sent to an address belong to them.
/// @notice Computes the stealth private key for a stealth address.
/// @param stealthAddress The expected stealth address.
/// @param ephemeralPubKey The ephemeral public key used to generate the stealth address.
/// @param viewingKey The recipient's viewing private key.
/// @param spendingKey The recipient's spending private key.
/// @return stealthKey The stealth private key corresponding to the stealth address.
/// @dev The stealth address input is not strictly necessary, but it is included so the method
/// can validate that the stealth private key was generated correctly.
function computeStealthKey(
address stealthAddress,
bytes memory ephemeralPubKey,
bytes memory viewingKey,
bytes memory spendingKey
) external view returns (bytes memory);The code above defines a function for recipients to compute the private key for a stealth address. Calling it lets recipients obtain the private key corresponding to their stealth address.
The function takes four parameters.
stealthAddress- The target stealth address.
ephemeralPubKey- The ephemeral public key used to generate the stealth address.
viewingKey- The recipient's private viewing key, used to identify transactions.
spendingKey- The recipient's private spending key.
The function returns a stealth private key named stealthKey.
This is the private key corresponding to the stealth address and is required to spend funds sent to it.
The function also requires the stealth address as an input to verify that the address was generated correctly.
This function also supports external read-only calls to retrieve information without modifying state.
Recipients can use it to compute the private key corresponding to their stealth address securely and reliably.
With stealth addresses, recipients can receive funds from senders while keeping their own addresses private. Implementing this system requires specific methods and procedures.
The precise behavior of stealth addresses depends on rules known as a scheme. A proposal for a new stealth address scheme must define method implementations appropriate to that scheme. These methods are expressed in Solidity but must also be implementable using other languages and tools.
Schemes are identified by a 256-bit integer (schemeId).
An ERC standardizing a new stealth address scheme must map its schemeId to a detailed specification.
Sequential integer values for schemeId are recommended for simplicity, although values may also be chosen arbitrarily or given a particular meaning.
Specifically, the following algorithms must be defined.
- Scheme identifier
- An integer uniquely identifying each scheme.
- Stealth meta-address encoding and decoding
- A way to convert the spending and viewing public keys to a byte array and back.
generateStealthAddress- A procedure for generating a stealth address for the recipient.
checkStealthAddress- A procedure for checking whether a particular stealth address belongs to the recipient.
computeStealthKey- A procedure for calculating the private key corresponding to a stealth address.
These algorithms and methods are essential for the correct and secure operation of stealth address schemes. Their details matter because each scheme requires its own approach.
/// @notice Interface for announcing when something is sent to a stealth address.
contract IERC5564Announcer {
/// @dev Emitted when sending something to a stealth address.
/// @dev See the `announce` method for documentation on the parameters.
event Announcement (
uint256 indexed schemeId,
address indexed stealthAddress,
address indexed caller,
bytes ephemeralPubKey,
bytes metadata
);
/// @dev Called by integrators to emit an `Announcement` event.
/// @param schemeId The integer specifying the applied stealth address scheme.
/// @param stealthAddress The computed stealth address for the recipient.
/// @param ephemeralPubKey Ephemeral public key used by the sender.
/// @param metadata An arbitrary field MUST include the view tag in the first byte.
/// Besides the view tag, the metadata can be used by the senders however they like,
/// but the below guidelines are recommended:
/// The first byte of the metadata MUST be the view tag.
/// - When sending/interacting with the native token of the blockchain (cf. ETH), the metadata SHOULD be structured as follows:
/// - Byte 1 MUST be the view tag, as specified above.
/// - Bytes 2-5 are `0xeeeeeeee`
/// - Bytes 6-25 are the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.
/// - Bytes 26-57 are the amount of ETH being sent.
/// - When interacting with ERC-20/ERC-721/etc. tokens, the metadata SHOULD be structured as follows:
/// - Byte 1 MUST be the view tag, as specified above.
/// - Bytes 2-5 are a function identifier. When a function selector (e.g.
/// the first (left, high-order in big-endian) four bytes of the Keccak-256
/// hash of the signature of the function, like Solidity and Vyper use) is
/// available, it MUST be used.
/// - Bytes 6-25 are the token contract address.
/// - Bytes 26-57 are the amount of tokens being sent/interacted with for fungible tokens, or
/// the token ID for non-fungible tokens.
function announce (
uint256 schemeId,
address stealthAddress,
bytes memory ephemeralPubKey,
bytes memory metadata
)
external
{
emit Announcement(schemeId, stealthAddress, msg.sender, ephemeralPubKey, metadata);
}
}The specification defines a single ERC5564Announcer contract that emits events when something is sent to a stealth address. It is a singleton contract, with one instance required per chain.
The IERC5564Announcer contract defines an Announcement event emitted when something is sent to a stealth address.
The event includes the stealth address scheme identifier (schemeId), the calculated stealth address (stealthAddress), the caller's address (caller), the ephemeral public key (ephemeralPubKey), and metadata.
Integrators call announce to emit an Announcement event.
The function accepts the stealth address scheme identifier (schemeId), the stealth address calculated for the recipient (stealthAddress), the sender's ephemeral public key (ephemeralPubKey), and metadata.
The first byte of the metadata must contain the view tag.
The sender may use the metadata following the view tag as needed, although following specific guidelines is recommended.
For example, the metadata structure differs depending on whether ETH is sent or tokens such as ERC20 or ERC721 are involved.
The IERC5564Announcer contract and its announce function provide transparency and traceability for transfers to stealth addresses and help recipients monitor and manage transactions sent to them.
Stealth Meta-address Format
The stealth meta-address format clearly identifies a stealth address by adding a special st: (stealth) prefix to a conventional chain-specific address format.
An Ethereum stealth meta-address has a format such as st:eth:0x<spendingKey><viewingKey>.
Here, <spendingKey> denotes the spending public key and <viewingKey> denotes the viewing public key.
Users can manage their stealth meta-addresses themselves or register them in a public registry contract as described in ERC6538. This registry provides a central place to discover other users' stealth meta-addresses and lets recipients indicate that they are willing to communicate using stealth addresses.
Importantly, the st: (stealth) prefix simply distinguishes stealth addresses from standard addresses and is removed before calculations are performed.
This enables efficient and accurate handling of both stealth and standard addresses.
Initial SECP256k1 Implementation With View Tags
This ERC aims to establish a foundation independent of any particular cryptographic system through the IERC5564Announcer contract. It also introduces an initial implementation of a stealth address scheme using the SECP256k1 elliptic curve with view tags. This elliptic curve, used by many cryptocurrencies including Bitcoin, is defined by a specific mathematical equation.
The implementation is divided into three sections.
- Generating stealth addresses
- The recipient's public keys and the sender's secret information are combined to create a new stealth address.
- Parsing announcements
- Information published through the IERC5564Announcer contract is examined to determine which transactions relate to the recipient.
- Deriving the stealth private key
- The recipient uses their private keys and information from the sender to calculate the private key needed to spend funds sent to the stealth address.
The SECP256k1 elliptic curve is defined by the following equation.
The following notation is also used.
The initial implementation of this ERC provides a foundation for applying stealth address schemes in different environments and achieving greater privacy and security. The technology strengthens privacy by enabling transactions without revealing their association to others.
Generation - Generating a Stealth Address From a Stealth Meta-address
The recipient holds a private spending key and a private viewing key , from which the public keys and are derived, respectively. The recipient combines and publishes these public keys, and , as the stealth meta-address.
The sender passes this stealth meta-address to generateStealthAddress.
The function performs the following calculations.
- Generate a random
32-byte ephemeral private key . - Derive the ephemeral public key from this ephemeral private key.
- Parse the spending public key and viewing public key from the stealth meta-address.
- Calculate the shared secret as .
- Hash the shared secret to obtain .
- Extract the view tag as the most significant byte of the hashed shared secret.
- Multiply the hashed shared secret by the generator point to obtain .
- Calculate the recipient's stealth public key as .
- Calculate the recipient's stealth address as .
The function finally returns the stealth address , ephemeral public key , and view tag . The sender can thus transfer funds to a private address accessible only to the recipient, preserving transaction privacy.
Parsing - Finding Your Own Stealth Addresses
The user holds the private viewing key and public spending key .
The user also has access to a sequence of announcement events and applies checkStealthAddress to each to find their own stealth addresses.
The checkStealthAddress function performs the following calculations.
- Multiply the private viewing key by the announcement's ephemeral public key to compute the shared secret .
- Hash the shared secret to obtain .
- Extract the most significant byte as the view tag and compare it with the supplied view tag.
- If the view tags do not match, the announcement is not intended for the user, so skip the remaining steps.
- If they match, continue.
- Multiply the hashed shared secret by the generator point to calculate .
- Add this point to the spending public key to calculate the stealth public key .
- Derive the stealth address from this stealth public key as .
- Return
trueif the stealth address in the announcement matches the derived stealth address, andfalseotherwise.
This process allows users to identify transactions intended for them efficiently and track funds sent to their private stealth addresses reliably.
Private Key Derivation - Deriving the Stealth Address Private Key From the Hashed Shared Secret and Private Spending Key
The user holds the private viewing key and private spending key .
The user also has access to a sequence of announcement events for which checkStealthAddress returns true.
The computeStealthKey function performs the following calculations.
- Multiply the announcement's ephemeral public key by the private viewing key to calculate the shared secret .
- Hash the shared secret to obtain .
- Calculate the stealth private key as .
This process lets users derive the private key required to access funds sent to their stealth address. The key is required to transfer funds and execute other transactions. Users can thus manage their funds securely and transact while preserving privacy.
Parsing Considerations
When examining a stealth address transaction, a recipient typically needs to perform several computations to determine whether the transaction is intended for them.
These include two elliptic curve multiplications (ecMUL), two hash calculations (HASH), and one elliptic curve addition (ecADD).
View tags, however, can significantly reduce parsing time.
With this approach, users initially need only one elliptic curve multiplication and one hash calculation to parse each announcement.
This can eliminate one ecMUL, one ecADD, and one HASH, substantially reducing the computation required.
The view tag is 1 byte long, minimizing the space required to filter out unrelated announcements efficiently.
Using a 1-byte view tag, after hashing the shared secret to obtain , the remaining calculations for unrelated announcements can be skipped with probability .
In other words, these computations can be skipped for almost all unrelated announcements.
However, because the view tag reveals one byte of the shared secret, the security margin decreases slightly from 128 bits to 124 bits.
This affects privacy but does not affect secure stealth address generation.
The approach allows users to identify transactions intended for them efficiently and securely while preserving transaction privacy.
Additional Details
The ERC aims to provide a privacy-focused way for people to transfer ownership without revealing their identities. Revealing token ownership risks exposing personal information. People may wish to donate to certain organizations or countries without disclosing the link between themselves and recipients. Standardizing stealth address generation is a significant step toward unlinkable interactions, and standardization is essential to broad adoption of stronger privacy protections.
The stealth address specification defines a protocol for transferring assets without prior communication with the recipient. Recipients can thereby confirm that they received a transfer without querying the blockchain directly or checking account balances. In particular, stealth addresses allow recipients to confirm token receipts while preserving their privacy.
The authors recognize a trade-off between on-chain and off-chain efficiency. A view tag mechanism similar to Monero's enables more efficient parsing of announcements but increases announcement event complexity.
Announcement events must include the recipient's stealth address and view tag, allowing users to verify ownership rapidly without querying the chain. This is important for efficient confirmation of token transfers while preserving privacy.
Compatibility
This ERC is fully backwards compatible.
Security
The ERC identifies potential denial-of-service (DoS) attack vectors and proposes countermeasures. Senders making stealth transfers impose a burden on recipients because parsing announcement events consumes computational resources. Parsing is not compensated through gas payments, so spamming announcement events can prolong parsing time and degrade the user experience. However, the lack of financial benefit is expected to limit incentives for such attacks.
To address potential spam, parsing providers can implement their own DoS prevention mechanisms, such as ignoring senders of spam or deprioritizing their announcements. Parsing providers can also combat spam by introducing staking mechanisms or charging senders a fee. This makes spam less economically attractive and enables effective filtering.
Regarding recipients' transaction costs, funding a stealth address wallet may compromise privacy. Senders can therefore include a small amount of ETH with each stealth address transaction to support the recipient's subsequent transactions and improve privacy. These measures help mitigate DoS risks and improve the security and usability of stealth address systems.
Citation
Toni Wahrstätter (@nerolation), Matt Solomon (@mds1), Ben DiFrancesco (@apbendi), Vitalik Buterin (@vbuterin), "ERC-5564: Stealth Addresses [DRAFT]," Ethereum Improvement Proposals, no. 5564, August 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5564.
Conclusion
This article covered ERC5564, a standard proposing stealth addresses for private interactions between senders and recipients. I hope you found it useful.
If you have questions, feel free to contact me by direct message on Twitter.
I also share information on other platforms, so feel free to explore them.


