Skip to content

generateStealthMetaAddress()

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / generateStealthMetaAddress

generateStealthMetaAddress(chain, label?): object

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1333

Generate a new stealth meta-address keypair for receiving private payments

Creates a reusable meta-address that senders can use to derive one-time stealth addresses. The recipient publishes the meta-address publicly, and senders generate unique payment addresses from it.

Security: Private keys must be stored securely and never shared. The meta-address (containing only public keys) can be safely published.

Algorithm: Uses secp256k1 elliptic curve (EIP-5564 style) for:

  • Ethereum, Polygon, Arbitrum, Optimism, Base, Bitcoin, Zcash

For Solana/NEAR/Aptos/Sui chains, use generateEd25519StealthMetaAddress instead.

ChainId

Target blockchain network (determines address format)

string

Optional human-readable label for identification

object

Object containing:

  • metaAddress: Public keys to share with senders
  • spendingPrivateKey: Secret key for claiming funds (keep secure!)
  • viewingPrivateKey: Secret key for scanning incoming payments (keep secure!)

metaAddress: StealthMetaAddress

spendingPrivateKey: `0x${string}`

viewingPrivateKey: `0x${string}`

If chain is invalid or not supported

import { generateStealthMetaAddress, encodeStealthMetaAddress } from '@sip-protocol/sdk'
// Generate keys
const { metaAddress, spendingPrivateKey, viewingPrivateKey } =
generateStealthMetaAddress('ethereum', 'My Privacy Wallet')
// Encode for sharing (QR code, website, etc.)
const encoded = encodeStealthMetaAddress(metaAddress)
console.log('Share this:', encoded)
// Output: "sip:ethereum:0x02abc...123:0x03def...456"
// Store private keys securely (e.g., encrypted keystore)
secureStorage.save({
spendingPrivateKey,
viewingPrivateKey,
})
// Generate different stealth keys for each chain
const ethKeys = generateStealthMetaAddress('ethereum', 'ETH Privacy')
const zkKeys = generateStealthMetaAddress('zcash', 'ZEC Privacy')
// Publish meta-addresses
publishToProfile({
ethereum: encodeStealthMetaAddress(ethKeys.metaAddress),
zcash: encodeStealthMetaAddress(zkKeys.metaAddress),
})