ETH Price: $3,402.15 (+5.03%)

Contract

0x31fe56609C65Cd0C510E7125f051D440424D38f3
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Stealth Keys237548822025-11-08 13:37:231 min ago1762609043IN
Umbra: Stealth Key Registry
0 ETH0.000165342.2209329
Set Stealth Keys237457742025-11-07 7:02:3530 hrs ago1762498955IN
Umbra: Stealth Key Registry
0 ETH0.000147681.98315672
Set Stealth Keys237447152025-11-07 3:28:5934 hrs ago1762486139IN
Umbra: Stealth Key Registry
0 ETH0.000026850.36077926
Set Stealth Keys237366282025-11-06 0:20:352 days ago1762388435IN
Umbra: Stealth Key Registry
0 ETH0.000097641.31138754
Set Stealth Keys237155162025-11-03 1:27:595 days ago1762133279IN
Umbra: Stealth Key Registry
0 ETH0.000008150.10949779
Set Stealth Keys237154192025-11-03 1:08:235 days ago1762132103IN
Umbra: Stealth Key Registry
0 ETH0.000043910.5898001
Set Stealth Keys237081732025-11-02 0:50:596 days ago1762044659IN
Umbra: Stealth Key Registry
0 ETH0.000072780.97780531
Set Stealth Keys237021982025-11-01 4:47:357 days ago1761972455IN
Umbra: Stealth Key Registry
0 ETH0.000154622.07665844
Set Stealth Keys236956172025-10-31 6:41:118 days ago1761892871IN
Umbra: Stealth Key Registry
0 ETH0.000010040.13492324
Set Stealth Keys236886472025-10-30 7:16:239 days ago1761808583IN
Umbra: Stealth Key Registry
0 ETH0.000006780.1957891
Set Stealth Keys236886432025-10-30 7:15:359 days ago1761808535IN
Umbra: Stealth Key Registry
0 ETH0.000014750.19815977
Set Stealth Keys236824732025-10-29 10:31:2310 days ago1761733883IN
Umbra: Stealth Key Registry
0 ETH0.000172512.31648769
Set Stealth Keys236824692025-10-29 10:30:3510 days ago1761733835IN
Umbra: Stealth Key Registry
0 ETH0.000169642.27835926
Set Stealth Keys236779502025-10-28 19:18:5910 days ago1761679139IN
Umbra: Stealth Key Registry
0 ETH0.000161312.16609499
Set Stealth Keys236779132025-10-28 19:11:3510 days ago1761678695IN
Umbra: Stealth Key Registry
0 ETH0.000159292.13930465
Set Stealth Keys236663692025-10-27 4:21:4712 days ago1761538907IN
Umbra: Stealth Key Registry
0 ETH0.000017490.23511615
Set Stealth Keys236550332025-10-25 14:20:5913 days ago1761402059IN
Umbra: Stealth Key Registry
0 ETH0.000007250.09747887
Set Stealth Keys236395092025-10-23 10:08:3516 days ago1761214115IN
Umbra: Stealth Key Registry
0 ETH0.000045250.60774316
Set Stealth Keys236390482025-10-23 8:35:1116 days ago1761208511IN
Umbra: Stealth Key Registry
0 ETH0.000156052.09585459
Set Stealth Keys236390122025-10-23 8:27:5916 days ago1761208079IN
Umbra: Stealth Key Registry
0 ETH0.000156662.10435398
Set Stealth Keys236344912025-10-22 17:16:4716 days ago1761153407IN
Umbra: Stealth Key Registry
0 ETH0.000020780.27929546
Set Stealth Keys236297902025-10-22 1:26:1117 days ago1761096371IN
Umbra: Stealth Key Registry
0 ETH0.000007680.10319392
Set Stealth Keys236193502025-10-20 14:16:3518 days ago1760969795IN
Umbra: Stealth Key Registry
0 ETH0.000051670.69398907
Set Stealth Keys236192312025-10-20 13:52:2318 days ago1760968343IN
Umbra: Stealth Key Registry
0 ETH0.000032120.43137855
Set Stealth Keys236054402025-10-18 15:31:5920 days ago1760801519IN
Umbra: Stealth Key Registry
0 ETH0.000008650.11628682
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StealthKeyRegistry

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

contract StealthKeyRegistry {
  // =========================================== Events ============================================

  /// @dev Event emitted when a user updates their registered stealth keys
  event StealthKeyChanged(
    address indexed registrant,
    uint256 spendingPubKeyPrefix,
    uint256 spendingPubKey,
    uint256 viewingPubKeyPrefix,
    uint256 viewingPubKey
  );

  // ======================================= State variables =======================================

  /// @dev The payload typehash used for EIP-712 signatures in setStealthKeysOnBehalf
  bytes32 public constant STEALTHKEYS_TYPEHASH =
    keccak256(
      "StealthKeys(uint256 spendingPubKeyPrefix,uint256 spendingPubKey,uint256 viewingPubKeyPrefix,uint256 viewingPubKey)"
    );

  /// @dev The domain separator used for EIP-712 sigatures in setStealthKeysOnBehalf
  bytes32 public immutable DOMAIN_SEPARATOR;

  /**
   * @dev Mapping used to store two secp256k1 curve public keys used for
   * receiving stealth payments. The mapping records two keys: a viewing
   * key and a spending key, which can be set and read via the `setStealthKeys`
   * and `stealthKey` methods respectively.
   *
   * The mapping associates the user's address to another mapping, which itself maps
   * the public key prefix to the actual key . This scheme is used to avoid using an
   * extra storage slot for the public key prefix. For a given address, the mapping
   * may contain a spending key at position 0 or 1, and a viewing key at position
   * 2 or 3. See the setter/getter methods for details of how these map to prefixes.
   *
   * For more on secp256k1 public keys and prefixes generally, see:
   * https://github.com/ethereumbook/ethereumbook/blob/develop/04keys-addresses.asciidoc#generating-a-public-key
   */
  mapping(address => mapping(uint256 => uint256)) keys;

  /**
   * @dev We wait until deployment to codify the domain separator because we need the
   * chainId and the contract address
   */
  constructor() {
    DOMAIN_SEPARATOR = keccak256(
      abi.encode(
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
        keccak256(bytes("Umbra Stealth Key Registry")),
        keccak256(bytes("1")),
        block.chainid,
        address(this)
      )
    );
  }

  // ======================================= Set Keys ===============================================

  /**
   * @notice Sets stealth keys for the caller
   * @param _spendingPubKeyPrefix Prefix of the spending public key (2 or 3)
   * @param _spendingPubKey The public key for generating a stealth address
   * @param _viewingPubKeyPrefix Prefix of the viewing public key (2 or 3)
   * @param _viewingPubKey The public key to use for encryption
   */
  function setStealthKeys(
    uint256 _spendingPubKeyPrefix,
    uint256 _spendingPubKey,
    uint256 _viewingPubKeyPrefix,
    uint256 _viewingPubKey
  ) external {
    _setStealthKeys(msg.sender, _spendingPubKeyPrefix, _spendingPubKey, _viewingPubKeyPrefix, _viewingPubKey);
  }

  /**
   * @notice Sets stealth keys for the registrant using an EIP-712 signature to
   * authenticate the update on their behalf.
   * @param _registrant The address for which stealth keys are being registered,
   * i.e. the address expected to be recovered from the provided signature
   * @param _spendingPubKeyPrefix Prefix of the spending public key (2 or 3)
   * @param _spendingPubKey The public key for generating a stealth address
   * @param _viewingPubKeyPrefix Prefix of the viewing public key (2 or 3)
   * @param _viewingPubKey The public key to use for encryption
   * @param _v ECDSA signature component: Parity of the `y` coordinate of point `R`
   * @param _r ECDSA signature component: x-coordinate of `R`
   * @param _s ECDSA signature component: `s` value of the signature
   */
  function setStealthKeysOnBehalf(
    address _registrant,
    uint256 _spendingPubKeyPrefix,
    uint256 _spendingPubKey,
    uint256 _viewingPubKeyPrefix,
    uint256 _viewingPubKey,
    uint8 _v,
    bytes32 _r,
    bytes32 _s
  ) external {
    // create EIP-712 Digest
    bytes32 _digest =
      keccak256(
        abi.encodePacked(
          "\x19\x01",
          DOMAIN_SEPARATOR,
          keccak256(
            abi.encode(
              STEALTHKEYS_TYPEHASH,
              _spendingPubKeyPrefix,
              _spendingPubKey,
              _viewingPubKeyPrefix,
              _viewingPubKey
            )
          )
        )
      );

    // recover the signing address and ensure it matches the registrant
    address _recovered = ecrecover(_digest, _v, _r, _s);
    require(_recovered == _registrant, "StealthKeyRegistry: Invalid Signature");

    // now that we know the registrant has authorized it, update the stealth keys
    _setStealthKeys(_registrant, _spendingPubKeyPrefix, _spendingPubKey, _viewingPubKeyPrefix, _viewingPubKey);
  }

  /**
   * @dev Internal method for setting stealth key that must be called after safety
   * check on registrant; see calling method for parameter details
   */
  function _setStealthKeys(
    address _registrant,
    uint256 _spendingPubKeyPrefix,
    uint256 _spendingPubKey,
    uint256 _viewingPubKeyPrefix,
    uint256 _viewingPubKey
  ) internal {
    require(
      (_spendingPubKeyPrefix == 2 || _spendingPubKeyPrefix == 3) &&
        (_viewingPubKeyPrefix == 2 || _viewingPubKeyPrefix == 3),
      "StealthKeyRegistry: Invalid Prefix"
    );

    emit StealthKeyChanged(_registrant, _spendingPubKeyPrefix, _spendingPubKey, _viewingPubKeyPrefix, _viewingPubKey);

    // Shift the spending key prefix down by 2, making it the appropriate index of 0 or 1
    _spendingPubKeyPrefix -= 2;

    // Ensure the opposite prefix indices are empty
    delete keys[_registrant][1 - _spendingPubKeyPrefix];
    delete keys[_registrant][5 - _viewingPubKeyPrefix];

    // Set the appropriate indices to the new key values
    keys[_registrant][_spendingPubKeyPrefix] = _spendingPubKey;
    keys[_registrant][_viewingPubKeyPrefix] = _viewingPubKey;
  }

  // ======================================= Get Keys ===============================================

  /**
   * @notice Returns the stealth key associated with an address.
   * @param _registrant The address whose keys to lookup.
   * @return spendingPubKeyPrefix Prefix of the spending public key (2 or 3)
   * @return spendingPubKey The public key for generating a stealth address
   * @return viewingPubKeyPrefix Prefix of the viewing public key (2 or 3)
   * @return viewingPubKey The public key to use for encryption
   */
  function stealthKeys(address _registrant)
    external
    view
    returns (
      uint256 spendingPubKeyPrefix,
      uint256 spendingPubKey,
      uint256 viewingPubKeyPrefix,
      uint256 viewingPubKey
    )
  {
    if (keys[_registrant][0] != 0) {
      spendingPubKeyPrefix = 2;
      spendingPubKey = keys[_registrant][0];
    } else {
      spendingPubKeyPrefix = 3;
      spendingPubKey = keys[_registrant][1];
    }

    if (keys[_registrant][2] != 0) {
      viewingPubKeyPrefix = 2;
      viewingPubKey = keys[_registrant][2];
    } else {
      viewingPubKeyPrefix = 3;
      viewingPubKey = keys[_registrant][3];
    }

    return (spendingPubKeyPrefix, spendingPubKey, viewingPubKeyPrefix, viewingPubKey);
  }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"registrant","type":"address"},{"indexed":false,"internalType":"uint256","name":"spendingPubKeyPrefix","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"spendingPubKey","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"viewingPubKeyPrefix","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"viewingPubKey","type":"uint256"}],"name":"StealthKeyChanged","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STEALTHKEYS_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_spendingPubKeyPrefix","type":"uint256"},{"internalType":"uint256","name":"_spendingPubKey","type":"uint256"},{"internalType":"uint256","name":"_viewingPubKeyPrefix","type":"uint256"},{"internalType":"uint256","name":"_viewingPubKey","type":"uint256"}],"name":"setStealthKeys","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registrant","type":"address"},{"internalType":"uint256","name":"_spendingPubKeyPrefix","type":"uint256"},{"internalType":"uint256","name":"_spendingPubKey","type":"uint256"},{"internalType":"uint256","name":"_viewingPubKeyPrefix","type":"uint256"},{"internalType":"uint256","name":"_viewingPubKey","type":"uint256"},{"internalType":"uint8","name":"_v","type":"uint8"},{"internalType":"bytes32","name":"_r","type":"bytes32"},{"internalType":"bytes32","name":"_s","type":"bytes32"}],"name":"setStealthKeysOnBehalf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_registrant","type":"address"}],"name":"stealthKeys","outputs":[{"internalType":"uint256","name":"spendingPubKeyPrefix","type":"uint256"},{"internalType":"uint256","name":"spendingPubKey","type":"uint256"},{"internalType":"uint256","name":"viewingPubKeyPrefix","type":"uint256"},{"internalType":"uint256","name":"viewingPubKey","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b50604080518082018252601a81527f556d62726120537465616c7468204b65792052656769737472790000000000006020918201528151808301835260018152603160f81b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f918101919091527f4baf469995623d4e8baaebc31ddb114fbc90e91c717e133da2fb936309b41eb9918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f1981840301815291905280516020909101206080526080516107fd61011c60003960008181608601526101b301526107fd6000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806367eaa7ac1161005057806367eaa7ac146100bb578063bb8f257b146100e2578063cec2a787146100f557600080fd5b8063100dcc531461006c5780633644e51514610081575b600080fd5b61007f61007a3660046106e2565b610128565b005b6100a87f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6100a87fab73c83a21fb894c20095a8f28177984b02f6284c760e4c1ac2f82c3d34b79c181565b61007f6100f0366004610757565b610352565b6101086101033660046106c0565b610365565b6040805194855260208501939093529183015260608201526080016100b2565b604080517fab73c83a21fb894c20095a8f28177984b02f6284c760e4c1ac2f82c3d34b79c16020808301919091528183018a9052606082018990526080820188905260a08083018890528351808403909101815260c0830190935282519201919091207f190100000000000000000000000000000000000000000000000000000000000060e08301527f000000000000000000000000000000000000000000000000000000000000000060e283015261010282015260009061012201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa15801561026d573d6000803e3d6000fd5b5050506020604051035190508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610339576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f537465616c74684b657952656769737472793a20496e76616c6964205369676e60448201527f617475726500000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103468a8a8a8a8a6104b8565b50505050505050505050565b61035f33858585856104b8565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260208181526040808320838052909152812054819081908190156103d95773ffffffffffffffffffffffffffffffffffffffff8516600090815260208181526040808320838052909152902054600294509250610410565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260208181526040808320600184529091529020546003945092505b73ffffffffffffffffffffffffffffffffffffffff8516600090815260208181526040808320600284529091529020541561047d57505073ffffffffffffffffffffffffffffffffffffffff831660009081526020818152604080832060028085529252909120546104b1565b505073ffffffffffffffffffffffffffffffffffffffff831660009081526020818152604080832060038085529252909120545b9193509193565b83600214806104c75750836003145b80156104dd575081600214806104dd5750816003145b610569576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f537465616c74684b657952656769737472793a20496e76616c6964205072656660448201527f69780000000000000000000000000000000000000000000000000000000000006064820152608401610330565b60408051858152602081018590529081018390526060810182905273ffffffffffffffffffffffffffffffffffffffff8616907fe879dede910dd3b22239a11044df83c95adcd4b54003516f42866cc1fe4f0a199060800160405180910390a26105d4600285610789565b73ffffffffffffffffffffffffffffffffffffffff86166000908152602081905260408120919550610607866001610789565b81526020808201929092526040908101600090812081905573ffffffffffffffffffffffffffffffffffffffff881681529182905281209061064a846005610789565b81526020808201929092526040908101600090812081905573ffffffffffffffffffffffffffffffffffffffff979097168752868252808720958752949052838520929092558352912055565b803573ffffffffffffffffffffffffffffffffffffffff811681146106bb57600080fd5b919050565b6000602082840312156106d257600080fd5b6106db82610697565b9392505050565b600080600080600080600080610100898b0312156106ff57600080fd5b61070889610697565b97506020890135965060408901359550606089013594506080890135935060a089013560ff8116811461073a57600080fd5b979a969950949793969295929450505060c08201359160e0013590565b6000806000806080858703121561076d57600080fd5b5050823594602084013594506040840135936060013592509050565b6000828210156107c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea264697066735822122019870f8b68c2a38dd8e08e0d8a59cc5dc5dff5338d8558eb989712ca985661e664736f6c63430008070033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100675760003560e01c806367eaa7ac1161005057806367eaa7ac146100bb578063bb8f257b146100e2578063cec2a787146100f557600080fd5b8063100dcc531461006c5780633644e51514610081575b600080fd5b61007f61007a3660046106e2565b610128565b005b6100a87fbffc56f4d2a2d2f02a0a5fd845c389cb145f77af539d336fc9ec35063764219481565b6040519081526020015b60405180910390f35b6100a87fab73c83a21fb894c20095a8f28177984b02f6284c760e4c1ac2f82c3d34b79c181565b61007f6100f0366004610757565b610352565b6101086101033660046106c0565b610365565b6040805194855260208501939093529183015260608201526080016100b2565b604080517fab73c83a21fb894c20095a8f28177984b02f6284c760e4c1ac2f82c3d34b79c16020808301919091528183018a9052606082018990526080820188905260a08083018890528351808403909101815260c0830190935282519201919091207f190100000000000000000000000000000000000000000000000000000000000060e08301527fbffc56f4d2a2d2f02a0a5fd845c389cb145f77af539d336fc9ec35063764219460e283015261010282015260009061012201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa15801561026d573d6000803e3d6000fd5b5050506020604051035190508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610339576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f537465616c74684b657952656769737472793a20496e76616c6964205369676e60448201527f617475726500000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103468a8a8a8a8a6104b8565b50505050505050505050565b61035f33858585856104b8565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260208181526040808320838052909152812054819081908190156103d95773ffffffffffffffffffffffffffffffffffffffff8516600090815260208181526040808320838052909152902054600294509250610410565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260208181526040808320600184529091529020546003945092505b73ffffffffffffffffffffffffffffffffffffffff8516600090815260208181526040808320600284529091529020541561047d57505073ffffffffffffffffffffffffffffffffffffffff831660009081526020818152604080832060028085529252909120546104b1565b505073ffffffffffffffffffffffffffffffffffffffff831660009081526020818152604080832060038085529252909120545b9193509193565b83600214806104c75750836003145b80156104dd575081600214806104dd5750816003145b610569576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f537465616c74684b657952656769737472793a20496e76616c6964205072656660448201527f69780000000000000000000000000000000000000000000000000000000000006064820152608401610330565b60408051858152602081018590529081018390526060810182905273ffffffffffffffffffffffffffffffffffffffff8616907fe879dede910dd3b22239a11044df83c95adcd4b54003516f42866cc1fe4f0a199060800160405180910390a26105d4600285610789565b73ffffffffffffffffffffffffffffffffffffffff86166000908152602081905260408120919550610607866001610789565b81526020808201929092526040908101600090812081905573ffffffffffffffffffffffffffffffffffffffff881681529182905281209061064a846005610789565b81526020808201929092526040908101600090812081905573ffffffffffffffffffffffffffffffffffffffff979097168752868252808720958752949052838520929092558352912055565b803573ffffffffffffffffffffffffffffffffffffffff811681146106bb57600080fd5b919050565b6000602082840312156106d257600080fd5b6106db82610697565b9392505050565b600080600080600080600080610100898b0312156106ff57600080fd5b61070889610697565b97506020890135965060408901359550606089013594506080890135935060a089013560ff8116811461073a57600080fd5b979a969950949793969295929450505060c08201359160e0013590565b6000806000806080858703121561076d57600080fd5b5050823594602084013594506040840135936060013592509050565b6000828210156107c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea264697066735822122019870f8b68c2a38dd8e08e0d8a59cc5dc5dff5338d8558eb989712ca985661e664736f6c63430008070033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.