Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Mine for asset vanity address in encode function#101

Open
raparri01 wants to merge 10 commits intodevfrom
feat/vanity_address_mining
Open

Mine for asset vanity address in encode function#101
raparri01 wants to merge 10 commits intodevfrom
feat/vanity_address_mining

Conversation

@raparri01
Copy link
Collaborator

No description provided.

@raparri01 raparri01 changed the title (WIP) Mine for asset vanity address in encode function Mine for asset vanity address in encode function Apr 18, 2025
@raparri01 raparri01 requested a review from kinrezC April 18, 2025 20:11
@raparri01 raparri01 changed the base branch from main to dev July 8, 2025 20:30
@raparri01 raparri01 requested a review from z80dev July 8, 2025 20:31
Comment on lines +593 to +608
let minedSalt = this.generateRandomSalt(userAddress);
for (let salt = BigInt(0); salt < BigInt(1_000_000); salt++) {
const saltBytes = `0x${salt.toString(16).padStart(64, "0")}` as Hash;

const token = this.computeCreate2Address(
saltBytes,
tokenInitHash,
tokenFactory
);
if (token.toLowerCase().endsWith(VANITY_ADDRESS_ENDING)) {
console.log(token);
minedSalt = saltBytes;
break;
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should set a success boolean somewhere before the loop, set it to true if we find a valid salt, and then check it after the loop, and maybe throw an error if one isnt found, or just return a 0 val

otherwise if we dont find a valid salt in 1M generations this will just return the last salt it tried without telling the user anything

1M iterations is a lot so this may be extremely unlikely lol but it doesnt cost us much to add it

export const MAX_TICK_SPACING = 30;
export const DEFAULT_PD_SLUGS = 5;
export const DAY_SECONDS = 24 * 60 * 60;
export const VANITY_ADDRESS_ENDING = "abcd";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this to be configurable by users?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this should be hardcoded

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants