Deploy and interact with Wraith Protocol’s five EVM contracts for stealth address announcements, name registration, and gas-sponsored withdrawals.
The Wraith Protocol EVM contract suite handles every on-chain operation involved in stealth payments: announcing stealth addresses, registering meta-addresses, sending assets atomically, resolving human-readable names, and sponsoring gas for recipients. The SDK wraps all of these contracts — most integrations never call them directly — but understanding their interfaces helps you build custom integrations or verify protocol behavior.
The announcer is a minimal singleton with no storage and no access control. Its only job is to emit the Announcement event whenever a stealth payment is made. Recipients scan these events to discover payments sent to them.
import { SCHEME_ID } from "@wraith-protocol/sdk/chains/evm";// After generating a stealth address for a recipient, announce it on-chainawait announcer.write.announce([ SCHEME_ID, stealthAddress, ephemeralPubKey, metadata, // view tag as first byte]);
Use WraithSender instead of calling the announcer directly. It combines the token transfer and announcement into one atomic transaction, which prevents announcements without actual payments.
The registry stores stealth meta-addresses per account. A meta-address is a pair of compressed public keys (spending key + viewing key) that senders use to generate stealth addresses for a recipient. The registry supports direct registration and delegated registration via EIP-712 signatures.
WraithSender combines asset transfer and announcement into a single atomic transaction. This guarantees that every announced stealth address actually received funds — and that senders can’t announce without transferring. The contract uses ReentrancyGuard.
import { generateStealthAddress, SCHEME_ID } from "@wraith-protocol/sdk/chains/evm";// Generate a stealth address for the recipientconst stealth = generateStealthAddress(spendingPubKey, viewingPubKey);// Encode the view tag as the first byte of metadataconst metadata = `0x${stealth.viewTag.toString(16).padStart(2, "0")}`;// Send 0.1 ETH and emit the announcement atomicallyawait sender.write.sendETH( [SCHEME_ID, stealth.stealthAddress, stealth.ephemeralPubKey, metadata], { value: parseEther("0.1") });
WraithNames maps human-readable names (like alice) to stealth meta-addresses. Ownership is proven by an ECDSA signature from the spending key embedded in the meta-address. The contract performs on-chain public key decompression and signature verification, so no trusted third party is involved.
The contract decompresses the spending public key from the first 33 bytes of the meta-address and verifies an ECDSA signature over keccak256(name || metaAddress) with the Ethereum signed message prefix. This includes on-chain elliptic curve point decompression (y = sqrt(x³ + 7) mod p).
WraithWithdrawer is an EIP-7702 delegation target that allows a sponsor to pay gas on behalf of a stealth address. The stealth address owner authorizes the contract via an EIP-7702 delegation, and a relayer submits the withdrawal, paying gas and optionally collecting a fee.
EIP-7702 is required for sponsored withdrawals. Check that your target chain supports EIP-7702 before using WraithWithdrawer.
// Sponsored: a relayer pays gas and collects sponsorFee from the stealth balancefunction withdrawETH(address payable to, uint256 sponsorFee) external;function withdrawERC20(address token, address to, uint256 sponsorFee) external;// Direct: the stealth address pays its own gasfunction withdrawETHDirect(address payable to) external;function withdrawERC20Direct(address token, address to) external;