Skip to content

VirtualMaster

TIP-1022 master registration utilities.

TIP-1022

These utilities expose deterministic hashing and bounded salt mining helpers for registerVirtualMaster(bytes32 salt) without introducing any extra hashing dependency.

Examples

import { Address, Hex } from 'ox'
import { VirtualMaster } from 'ox/tempo'
 
const registration = {
  address: Address.from('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'),
  salt: Hex.from('0x00000000000000000000000000000000000000000000000000000000abf52baf'),
}
 
const registrationHash = VirtualMaster.getRegistrationHash(registration) // keccak256(address || salt)
const masterId = VirtualMaster.getMasterId(registration) // bytes [4:8] of the hash

Functions

NameDescription
VirtualMaster.getMasterIdDerives the 4-byte TIP-1022 masterId from a master address and salt.
VirtualMaster.getRegistrationHashComputes the TIP-1022 registration hash for a master address and salt.
VirtualMaster.mineSaltSearches a bounded range of salts for the first value that satisfies TIP-1022 PoW.
VirtualMaster.mineSaltAsyncSearches for a salt that satisfies TIP-1022 PoW using parallel workers and WASM-accelerated keccak256.
VirtualMaster.validateSaltValidates that a salt satisfies the TIP-1022 32-bit proof-of-work requirement.

Types

NameDescription
VirtualMaster.SaltA valid salt input for TIP-1022 master registration.