grindKeyPairs
Generates multiple Ed25519 key pairs whose base58-encoded public key
satisfies the provided matches criterion.
Key pairs are generated in batches of concurrency in parallel and tested
against the matcher. The loop continues until amount matching key pairs
have been found or the provided abortSignal is aborted.
When matches is a RegExp, its literal characters are validated
against the base58 alphabet up front to prevent infinite loops caused by
typos (e.g. /^anza0/). When matches is a function, it is used as-is
with no validation.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | GrindKeyPairsConfig | See GrindKeyPairsConfig. |
Returns
Promise<CryptoKeyPair[]>
A promise that resolves to an array of exactly amount
CryptoKeyPair instances, each of which satisfies the matcher. When
amount <= 0, the promise resolves to an empty array.
Examples
Find four key pairs whose address starts with anza:
Use a predicate function for arbitrary matching logic:
Cancel a long-running grind using an AbortSignal: