Skip to content

VirtualMaster.mineSaltAsync

Searches for a salt that satisfies TIP-1022 PoW using parallel workers and WASM-accelerated keccak256.

TIP-1022

Uses WASM-accelerated keccak256 with parallel workers when available. Falls back to chunked single-threaded mining in environments without worker support.

  • Node.js / Bun / Deno: Spawns worker_threads with inline WASM keccak256. - Browsers: Spawns Web Workers via Blob URLs with inline WASM keccak256.

Imports

Named
import { VirtualMaster } from 'ox/tempo'

Examples

import { Address } from 'ox'
import { VirtualMaster } from 'ox/tempo'
 
const result = await VirtualMaster.mineSaltAsync({
  address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
})

Definition

function mineSaltAsync(
  parameters: mineSaltAsync.Parameters,
): Promise<mineSalt.ReturnType | undefined>

Source: src/tempo/VirtualMaster.ts

Parameters

parameters

  • Type: mineSaltAsync.Parameters

Search parameters.

parameters.address

  • Type: TempoAddress.Address

Master address. Accepts both hex and Tempo addresses.

parameters.chunkSize

  • Type: number
  • Optional

Number of salts each worker processes before sending a progress update.

parameters.count

  • Type: number
  • Optional

Number of consecutive salts to try.

parameters.onProgress

  • Type: (progress: Progress) => void
  • Optional

Progress callback invoked after each completed chunk.

parameters.signal

  • Type: AbortSignal
  • Optional

AbortSignal for cancellation.

parameters.start

  • Type: Salt
  • Optional

Starting salt value.

parameters.workers

  • Type: number
  • Optional

Number of workers to use.

Set to 0 or 1 to disable worker parallelism.

Return Type

The first matching salt, if any.

Promise<mineSalt.ReturnType | undefined>