@akshatmittal/saltshaker
v1.0.0
Published
WebGPU vanity miner for deterministic Ethereum deployments
Downloads
233
Readme
Saltshaker
Saltshaker is a WebGPU powered in-browser vanity salt miner for deterministic Ethereum deployments.
- Performance: push the search loop onto the GPU, stream live hashrate, and benchmark hardware with a standardized preset.
- Capability: Mine addresses for
CREATE2,CreateX(CREATE2andCREATE3), andSafedeployments with multiple matcher strategies. - Ease of use: Start from a tiny TypeScript API or the included browser workbench.
Why Saltshaker
- GPU-first search. The miner dispatches work through WebGPU and, by default, searches
65,535 x 16 x 64 = 67,107,840candidates per dispatch. - Browser-native workflow. No backend, no RPC requirement, and no wallet connection just to search deterministic addresses.
- Correctness guardrails. GPU hits are re-scored on the CPU before they are accepted into the result set.
- Live telemetry. Sessions report status, elapsed time, hashrate, and ranked results as they run.
- Built-in benchmark mode. The starter app includes a repeatable benchmark route so you can compare GPUs with the same preset.
Benchmark
| Device | Hashrate | | --------------- | --------- | | Nvidia RTX 3070 | 1140 MH/s |
(Consider adding your device to this list!)
What It Supports
Protocols
| Protocol | Notes |
| --------- | ------------------------------------------------------------------------------------------- |
| create2 | Deterministic contract address mining from deployer + salt + init code hash |
| createx | Supports CREATE2 and CREATE3, including caller-protected and crosschain-protected salts |
| safe | Mines proxy addresses derived from Safe initializer data and nonce |
Matchers
| Matcher | Notes |
| -------------- | ------------------------------------------------------------------ |
| leadingZeros | Search for addresses with a minimum number of leading zero nibbles |
| prefix | Nibble-precision prefix matching |
| suffix | Nibble-precision suffix matching |
| contains | Nibble-precision substring matching |
If you do not provide a matcher, Saltshaker defaults to leadingZeros: 8.
You can also create custom matcher configurations to target very specific address patterns, such as the Uniswap V4 address mining competition!
Technical Overview
Saltshaker runs the mining loop as a WebGPU compute workload.
WebGPU Mining Flow
- The CPU prepares protocol-specific constants such as deployers, factories, salt prefixes, code hashes, Safe initializer hashes, and matcher data.
- Saltshaker packs those constants into a GPU storage buffer, writes the current nonce base into a small uniform buffer, and allocates a compact result buffer for the best hit in the current dispatch.
- The shader is assembled from shared Keccak primitives, a matcher module, a protocol module, and one shared compute kernel.
- The GPU dispatches workgroups across the nonce space and each invocation derives one candidate address for one nonce.
- Each invocation scores its candidate on the GPU and only higher-scoring hits try to update the shared best-result buffer through atomics.
- After the dispatch completes, Saltshaker copies the result buffer back to the CPU, derives the final salt and address, re-scores the hit on the CPU, and merges valid results into the ranked result list.
By default, each dispatch covers 65,535 x 16 workgroups at a workgroup size of 64, which means 67,107,840 nonce candidates per dispatch.
Keccak Kernel
The compute path is centered on a shared WGSL Keccak implementation.
- The shared core shader implements the Keccak-f permutation directly in WGSL, including the
theta,rho/pi,chi, andiotarounds. - Protocol shaders only define how to build the correct preimage for a nonce.
CREATE2hashes0xff ++ deployer ++ salt ++ initCodeHash,Safederives its salt fromkeccak256(initializerHash ++ nonce), andCreateXapplies its guarded-salt rules before address derivation. - The kernel exposes fixed-size helpers such as
keccak256_32,keccak256_64,keccak256_96,keccak256_85_address, andkeccak256_23_addressso each protocol can hash the exact layout it needs. - All protocol and matcher combinations reuse the same
@compute @workgroup_size(64)entrypoint, so Saltshaker swaps protocol and matcher logic without changing the overall execution model. - The GPU only returns the best hit from a dispatch, which keeps readback small and lets the CPU stay focused on verification, ranking, and session telemetry.
Quick Start
Run the starter app
pnpm install
pnpm devThen open the local URL printed by Vite.
The starter app includes:
- a mining workbench for
CREATE2,CreateX, andSafe - live telemetry and ranked results
- a
/benchmarkroute for repeatable WebGPU throughput tests
Use the library
The core package lives in packages/saltshaker-core and exports a very small API:
checkWebGpuSupport()createMiningSession()
Example:
import { checkWebGpuSupport, createMiningSession } from "@akshatmittal/saltshaker";
const support = await checkWebGpuSupport();
if (!support.supported) {
throw new Error(support.message);
}
const session = createMiningSession({
job: {
protocol: "create2",
deployer: "0x4e59b44847b379578588920cA78FbF26c0B4956C",
fixedSaltPrefix: "0x000000000000000000000000000000000000000000000000",
initCodeHash: "0x6e1cce4955d4b57d9569397925551f2fb36c34f1cfe0f2e8c0c727c44bd08b90",
},
matcher: { type: "prefix", value: "0xdead" },
maxResults: 10,
});
const unsubscribe = session.subscribe((state) => {
console.log(state.status, state.hashrate, state.results);
if (state.results.length > 0) {
session.stop();
}
});
await session.start();
unsubscribe();API Shape
createMiningSession() accepts:
- a
jobforcreate2,createx, orsafe - an optional
matcher - optional
dispatchsizing - optional
maxResults - optional WebGPU
powerPreference
Each session exposes:
start()to begin miningstop()to stop the active runsubscribe(listener)to receive state updates
Session state includes:
statusandstatusDetailhashrateelapsedMsresultserror
Development
Repo layout
packages/saltshaker-core: Typed WebGPU mining libraryapps/web-start: Browser workbench and benchmark UI (Tanstack Start)tooling/typescript-config: Shared TypeScript config
Commands
pnpm dev
pnpm build
pnpm typecheck
pnpm lintRequirements
- Node.js
>=24 pnpm@10- A browser with WebGPU support for actual mining
viemas a peer dependency of the@akshatmittal/saltshakerpackage
