@tevm/voltaire / primitives/StealthAddress
primitives/StealthAddress
Classes
InvalidAnnouncementError
Defined in: src/primitives/StealthAddress/errors.js:60 Invalid announcement formatExtends
Constructors
Constructor
new InvalidAnnouncementError(Defined in: src/primitives/StealthAddress/errors.js:61message,options):InvalidAnnouncementError
Parameters
message
any
options
Returns
InvalidAnnouncementError
Overrides
StealthAddressError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
StealthAddressError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
StealthAddressError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:66
Inherited from
StealthAddressError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON
InvalidEphemeralPublicKeyError
Defined in: src/primitives/StealthAddress/errors.js:47 Invalid ephemeral public keyExtends
Constructors
Constructor
new InvalidEphemeralPublicKeyError(Defined in: src/primitives/StealthAddress/errors.js:48message,options):InvalidEphemeralPublicKeyError
Parameters
message
any
options
Returns
InvalidEphemeralPublicKeyError
Overrides
StealthAddressError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
StealthAddressError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
StealthAddressError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:53
Inherited from
StealthAddressError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON
InvalidPublicKeyError
Defined in: src/primitives/StealthAddress/errors.js:34 Invalid public key format or lengthExtends
Constructors
Constructor
new InvalidPublicKeyError(Defined in: src/primitives/StealthAddress/errors.js:35message,options):InvalidPublicKeyError
Parameters
message
any
options
Returns
InvalidPublicKeyError
Overrides
StealthAddressError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
StealthAddressError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
StealthAddressError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:40
Inherited from
StealthAddressError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON
InvalidStealthMetaAddressError
Defined in: src/primitives/StealthAddress/errors.js:21 Invalid stealth meta-address format or lengthExtends
Constructors
Constructor
new InvalidStealthMetaAddressError(Defined in: src/primitives/StealthAddress/errors.js:22message,options):InvalidStealthMetaAddressError
Parameters
message
any
options
Returns
InvalidStealthMetaAddressError
Overrides
StealthAddressError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
StealthAddressError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
StealthAddressError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:27
Inherited from
StealthAddressError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON
StealthAddressError
Defined in: src/primitives/StealthAddress/errors.js:7 Base error for StealthAddress operationsExtends
Extended by
InvalidStealthMetaAddressErrorInvalidPublicKeyErrorInvalidEphemeralPublicKeyErrorInvalidAnnouncementErrorStealthAddressGenerationError
Constructors
Constructor
new StealthAddressError(Defined in: src/primitives/StealthAddress/errors.js:8message,options):StealthAddressError
Parameters
message
any
options
Returns
StealthAddressError
Overrides
PrimitiveError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
PrimitiveError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
PrimitiveError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
PrimitiveError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
PrimitiveError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:14
Inherited from
PrimitiveError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
PrimitiveError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
PrimitiveError.toJSON
StealthAddressGenerationError
Defined in: src/primitives/StealthAddress/errors.js:73 Stealth address generation failedExtends
Constructors
Constructor
new StealthAddressGenerationError(Defined in: src/primitives/StealthAddress/errors.js:74message,options):StealthAddressGenerationError
Parameters
message
any
options
Returns
StealthAddressGenerationError
Overrides
StealthAddressError.constructor
Properties
cause?
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)optionalcause:Error
Inherited from
StealthAddressError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39
Machine-readable error code for programmatic handling
Example
Inherited from
StealthAddressError.code
context?
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debuggingoptionalcontext:Record<string,unknown>
Example
Inherited from
StealthAddressError.context
docsPath?
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this erroroptionaldocsPath:string
Example
Inherited from
StealthAddressError.docsPath
name
name: string
Defined in: src/primitives/StealthAddress/errors.js:79
Inherited from
StealthAddressError.name
Methods
getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94
Get full error chain as string for logging
Returns
string
Inherited from
StealthAddressError.getErrorChain
toJSON()
toJSON():Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetryRecord<string,unknown>
Returns
Record<string, unknown>
Inherited from
StealthAddressError.toJSON
Interfaces
CheckStealthAddressResult
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:92 Result of stealth address checkingProperties
isForRecipient
isForRecipient: boolean
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:93
stealthPrivateKey?
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:94optionalstealthPrivateKey:Uint8Array<ArrayBufferLike>
GenerateStealthAddressResult
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:83 Result of stealth address generationProperties
ephemeralPublicKey
ephemeralPublicKey: EphemeralPublicKey
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:85
stealthAddress
stealthAddress: AddressType
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:84
viewTag
viewTag: number
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:86
StealthAnnouncement
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:74 Stealth address announcement On-chain data published by sender containing ephemeral public key and view tag. Enables recipient to scan for stealth addresses.Properties
ephemeralPublicKey
ephemeralPublicKey: EphemeralPublicKey
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:75
stealthAddress
stealthAddress: AddressType
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:77
viewTag
viewTag: number
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:76
Type Aliases
EphemeralPublicKey
EphemeralPublicKey =Defined in: src/primitives/StealthAddress/StealthAddressType.ts:55 Ephemeral public key (33 bytes compressed) One-time public key generated by sender and announced on-chain. Used by recipient to derive shared secret for stealth address detection.Uint8Array&object
Type Declaration
__tag
readonly__tag:"EphemeralPublicKey"
SpendingPublicKey
SpendingPublicKey =Defined in: src/primitives/StealthAddress/StealthAddressType.ts:35 Spending public key (33 bytes compressed) Compressed secp256k1 public key used for deriving stealth addresses. Recipient uses corresponding private key to spend from stealth addresses.Uint8Array&object
Type Declaration
__tag
readonly__tag:"SpendingPublicKey"
StealthMetaAddress
StealthMetaAddress =Defined in: src/primitives/StealthAddress/StealthAddressType.ts:25 Stealth meta-address (66 bytes) Concatenation of spending public key (33 bytes compressed) and viewing public key (33 bytes compressed). Published by recipient to enable non-interactive stealth address generation. Format: spendingPubKey (33) || viewingPubKey (33)Uint8Array&object
Type Declaration
__tag
readonly__tag:"StealthMetaAddress"
See
https://eips.ethereum.org/EIPS/eip-5564#stealth-meta-address-formatViewingPublicKey
ViewingPublicKey =Defined in: src/primitives/StealthAddress/StealthAddressType.ts:45 Viewing public key (33 bytes compressed) Compressed secp256k1 public key used for scanning blockchain. Recipient uses corresponding private key to detect stealth addresses.Uint8Array&object
Type Declaration
__tag
readonly__tag:"ViewingPublicKey"
ViewTag
ViewTag = number
Defined in: src/primitives/StealthAddress/StealthAddressType.ts:66
View tag (1 byte)
First byte of hashed shared secret. Enables fast rejection
of non-matching stealth addresses (~255/256 probability).
Reduces scanning overhead by ~6x.
Variables
COMPRESSED_PUBLIC_KEY_SIZE
Defined in: src/primitives/StealthAddress/constants.js:19 Compressed public key length (33 bytes) Format: 0x02/0x03 prefix + x-coordinate (32 bytes)constCOMPRESSED_PUBLIC_KEY_SIZE:33=33
PRIVATE_KEY_SIZE
Defined in: src/primitives/StealthAddress/constants.js:30 Private key length (32 bytes)constPRIVATE_KEY_SIZE:32=32
SCHEME_ID
Defined in: src/primitives/StealthAddress/constants.js:41 ERC-5564 scheme ID for SECP256k1 with view tagsconstSCHEME_ID:1=1
STEALTH_META_ADDRESS_SIZE
Defined in: src/primitives/StealthAddress/constants.js:13 Stealth meta-address length (66 bytes) Format: spendingPubKey (33) || viewingPubKey (33)constSTEALTH_META_ADDRESS_SIZE:66=66
UNCOMPRESSED_PUBLIC_KEY_SIZE
Defined in: src/primitives/StealthAddress/constants.js:25 Uncompressed public key length (64 bytes) Format: x-coordinate (32) || y-coordinate (32)constUNCOMPRESSED_PUBLIC_KEY_SIZE:64=64
VIEW_TAG_SIZE
Defined in: src/primitives/StealthAddress/constants.js:36 View tag size (1 byte) First byte of hashed shared secretconstVIEW_TAG_SIZE:1=1
Functions
checkStealthAddress()
checkStealthAddress(Defined in: src/primitives/StealthAddress/checkStealthAddress.js:48 Check if stealth address belongs to recipient Implements ERC-5564 stealth address checking:viewingPrivateKey,ephemeralPublicKey,viewTag,spendingPublicKey,stealthAddress):CheckStealthAddressResult
- Compute shared secret: ECDH(viewingPrivKey, ephemeralPubKey)
- Hash shared secret
- Check view tag matches (fast rejection)
- If matches, compute stealth private key
- Derive address and verify match
Parameters
viewingPrivateKey
Uint8Array<ArrayBufferLike>
32-byte viewing private key
ephemeralPublicKey
EphemeralPublicKey
33-byte compressed ephemeral public key
viewTag
number
View tag from announcement
spendingPublicKey
SpendingPublicKey
33-byte compressed spending public key
stealthAddress
AddressType
Announced stealth address
Returns
CheckStealthAddressResult
Match result with optional stealth private key
See
- https://eips.ethereum.org/EIPS/eip-5564#stealth-address-checking
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation
Since
0.0.0Example
compressPublicKey()
compressPublicKey(Defined in: src/primitives/StealthAddress/compressPublicKey.js:27 Compress uncompressed secp256k1 public key Converts 64-byte uncompressed format (x, y) to 33-byte compressed format. Uses 0x02 prefix if y is even, 0x03 if y is odd.uncompressed):Uint8Array<ArrayBufferLike>
Parameters
uncompressed
Uint8Array<ArrayBufferLike>
64-byte uncompressed public key
Returns
Uint8Array<ArrayBufferLike>
33-byte compressed public key
See
https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentationSince
0.0.0Throws
If input length is invalidExample
computeStealthPrivateKey()
computeStealthPrivateKey(Defined in: src/primitives/StealthAddress/computeStealthPrivateKey.js:32 Compute stealth private key from spending private key and shared secret hash Implements ERC-5564 private key derivation: stealthPrivateKey = (spendingPrivateKey + hashedSharedSecret) mod n Where n is the secp256k1 curve order.spendingPrivateKey,hashedSharedSecret):Uint8Array<ArrayBufferLike>
Parameters
spendingPrivateKey
Uint8Array<ArrayBufferLike>
32-byte spending private key
hashedSharedSecret
Uint8Array<ArrayBufferLike>
32-byte hashed shared secret
Returns
Uint8Array<ArrayBufferLike>
32-byte stealth private key
See
- https://eips.ethereum.org/EIPS/eip-5564#stealth-private-key
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation
Since
0.0.0Throws
If computation failsExample
computeViewTag()
computeViewTag(Defined in: src/primitives/StealthAddress/computeViewTag.js:26 Compute view tag from hashed shared secret Extracts first byte of hashed shared secret as view tag. Enables fast rejection of non-matching stealth addresses.hashedSharedSecret):number
Parameters
hashedSharedSecret
Uint8Array<ArrayBufferLike>
32-byte keccak256 hash of shared secret
Returns
number
View tag (first byte as number)
See
- https://eips.ethereum.org/EIPS/eip-5564#view-tags
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation
Since
0.0.0Example
decompressPublicKey()
decompressPublicKey(Defined in: src/primitives/StealthAddress/decompressPublicKey.js:26 Decompress compressed secp256k1 public key Converts 33-byte compressed format to 64-byte uncompressed format. Decompresses by reconstructing y-coordinate from x and prefix.compressed):Uint8Array<ArrayBufferLike>
Parameters
compressed
Uint8Array<ArrayBufferLike>
33-byte compressed public key
Returns
Uint8Array<ArrayBufferLike>
64-byte uncompressed public key
See
https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentationSince
0.0.0Throws
If input length is invalid or decompression failsExample
generateMetaAddress()
generateMetaAddress(Defined in: src/primitives/StealthAddress/generateMetaAddress.js:36 Generate stealth meta-address from spending and viewing public keys Concatenates 33-byte compressed spending and viewing public keys into 66-byte stealth meta-address for ERC-5564.spendingPubKey,viewingPubKey):StealthMetaAddress
Parameters
spendingPubKey
SpendingPublicKey
33-byte compressed spending public key
viewingPubKey
ViewingPublicKey
33-byte compressed viewing public key
Returns
StealthMetaAddress
66-byte stealth meta-address
See
- https://eips.ethereum.org/EIPS/eip-5564#stealth-meta-address-format
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation
Since
0.0.0Throws
If either public key has invalid lengthExample
generateStealthAddress()
generateStealthAddress(Defined in: src/primitives/StealthAddress/generateStealthAddress.js:48 Generate stealth address from meta-address Implements ERC-5564 stealth address generation:metaAddress,ephemeralPrivateKey):GenerateStealthAddressResult
- Parse meta-address → spending + viewing public keys
- Compute shared secret: ECDH(ephemeralPrivKey, viewingPubKey)
- Hash shared secret: keccak256(sharedSecret)
- Derive view tag: first byte of hash
- Compute stealth pubkey: spendingPubKey + hash * G
- Derive stealth address from pubkey
Parameters
metaAddress
StealthMetaAddress
66-byte stealth meta-address
ephemeralPrivateKey
Uint8Array<ArrayBufferLike>
32-byte ephemeral private key
Returns
GenerateStealthAddressResult
Stealth address, ephemeral pubkey, view tag
See
- https://eips.ethereum.org/EIPS/eip-5564#stealth-address-generation
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation
Since
0.0.0Throws
If generation failsExample
parseAnnouncement()
parseAnnouncement(Defined in: src/primitives/StealthAddress/parseAnnouncement.js:26 Parse stealth address announcement Extracts ephemeral public key (33 bytes) and view tag (1 byte) from announcement data.announcement):object
Parameters
announcement
Uint8Array<ArrayBufferLike>
Announcement bytes (ephemeralPubKey + viewTag)
Returns
object
Parsed announcement
ephemeralPublicKey
ephemeralPublicKey: EphemeralPublicKey
viewTag
viewTag: number
See
- https://eips.ethereum.org/EIPS/eip-5564#announcement-format
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation
Since
0.0.0Throws
If announcement length is invalidExample
parseMetaAddress()
parseMetaAddress(Defined in: src/primitives/StealthAddress/parseMetaAddress.js:28 Parse stealth meta-address into spending and viewing public keys Splits 66-byte meta-address into 33-byte compressed public keys.metaAddress):object
Parameters
metaAddress
StealthMetaAddress
66-byte stealth meta-address
Returns
object
Parsed public keys
spendingPubKey
spendingPubKey: SpendingPublicKey
viewingPubKey
viewingPubKey: ViewingPublicKey
See
- https://eips.ethereum.org/EIPS/eip-5564#stealth-meta-address-format
- https://voltaire.tevm.sh/primitives/stealth-address for StealthAddress documentation

