Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding --dry-run & --quiet Arguments for Testing Vanity Safe Addresses #457

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dysbulic
Copy link

@dysbulic dysbulic commented Oct 23, 2024

This PR adds support for two new arguments to the safe-creator command: --dry-run and --quiet.

--dry-run will cause the system to stop after the projected Safe address is generated. It also prevents the system from prompting before doing the generation.

--quiet limits the amount of information output to the console to prompts, errors, and the address of the generated Safe. If used in conjunction with --dry-run, only the projected Safe address will be output, making it suitable for easy scripting.

@dysbulic dysbulic requested a review from a team as a code owner October 23, 2024 19:28
Copy link

github-actions bot commented Oct 23, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@dysbulic
Copy link
Author

I have read the CLA Document, and I hereby sign the CLA.

@dysbulic
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@dysbulic
Copy link
Author

recheck

github-actions bot added a commit that referenced this pull request Oct 23, 2024
@Uxio0 Uxio0 self-assigned this Oct 28, 2024
@Uxio0
Copy link
Member

Uxio0 commented Oct 28, 2024

@dysbulic I like your idea. I guess this runs inside of a script. So I think the solution should be to edit the code to allow vanity addresses, right?

Could you share the script you are using with your code?

@dysbulic
Copy link
Author

Could you share the script you are using with your code?

#!/bin/bash

COUNT=${1:-30000}
OWNERS=(
  '0xDfCc1215c82e39F89A617b1e587704090E84e536'
  '0xAA82FB0Df1B866e4F04B154dE51ACd8734D7E688'
  '0xEb4E3e9fA819E69e5Df4ea35b9C7973062C96de9'
  '0x8a11D42Be55217369ff6C5cEE519D22c60952cfB'
)
KEY="0x$(cat /dev/urandom | tr -dc A-F0-9 | head -c64)"
while [[ $COUNT -gt 0 ]]; do
  SALT=$(cat /dev/urandom | tr -dc 0-9 | head -c${2:-25})
  ADDR=$(docker run -it safe-cli:testing safe-creator --threshold 2 --owners ${OWNERS[@]} --salt-nonce $SALT --dry-run --quiet https://mainnet.optimism.io $KEY)
  echo "$(printf '%4d' $COUNT): $SALT: $ADDR"
  COUNT=$((COUNT - 1))
done

It's pretty slow, but it illustrates the procedure. (Also, I renamed --only-generate to --dry-run to be in line with other programs.)

@dysbulic dysbulic changed the title Adding --only-generate & --quiet Arguments for Testing Vanity Safe Addresses Adding --dry-run & --quiet Arguments for Testing Vanity Safe Addresses Oct 30, 2024
@dysbulic
Copy link
Author

It took about two days to generate 30,000 address, so the current script isn't optimal, but it could be adapted to run straight from Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants