Skip to content

vanity move address #1229

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

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

vanity move address #1229

wants to merge 12 commits into from

Conversation

Primata
Copy link
Contributor

@Primata Primata commented May 14, 2025

Summary

  • RFCs: scripts.

Adds util to mine move vanity addresses.

Vanity Addresses are widely used across crypto for flex or informing the user of address legitimacy. It does not make calldata tx cost to 00 padded addresses cheaper like EVM does though.

Changelog

util/vanity/*

Testing

  1. cargo build -p vanity to build the vanity target
  2. cargo test -p vanity

Outstanding issues

@Copilot Copilot AI review requested due to automatic review settings May 14, 2025 00:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new CLI tool called "vanity" for mining Move addresses with customizable prefix/suffix patterns. Key changes include the addition of a mining utility in miner.rs, a CLI interface in main.rs and cli.rs with pattern validation, and integration into the overall workspace via configuration files and documentation.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
util/vanity/src/miner.rs Implements the vanity address mining logic using Rayon’s thread pool.
util/vanity/src/main.rs Provides the CLI entry point that invokes the mining utility.
util/vanity/src/cli.rs Adds pattern parsing and validation logic for user inputs.
util/vanity/README.md Documents the tool and its usage, with installation instructions.
util/vanity/Cargo.toml Defines the package and its dependencies.
util/vanity/.gitignore Excludes the target directory from version control.
Cargo.toml Integrates the vanity tool into the workspace.

Copy link
Collaborator

@0xmovses 0xmovses left a comment

Choose a reason for hiding this comment

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

This looks cool, can you explain a bit the intention of this tool. Why would I want to use it? I think it's worth adding a few unit tests to demonstrate its usage.

@0xmovses
Copy link
Collaborator

It's so that I can add prefix/suffix patterns to an address right?

@Primata Primata requested a review from l-monninger May 14, 2025 14:50
Copy link
Collaborator

@0xmovses 0xmovses left a comment

Choose a reason for hiding this comment

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

Can you write some unit tests for this? Then if all is good happy to approve, I support freedom of expression.

@Primata
Copy link
Contributor Author

Primata commented May 19, 2025

Glad you do 🏴‍☠️ 🌈

@0xmovses
Copy link
Collaborator

Thanks for the test, will run after programme review.

Copy link
Collaborator

@0xmovses 0xmovses left a comment

Choose a reason for hiding this comment

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

LGayTM

Copy link
Contributor

@andygolay andygolay left a comment

Choose a reason for hiding this comment

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

Looks like a Cargo Format check is failing and I got a few failing tests in the vanity package:

   Compiling vanity v0.2.1 (/Users/andygmove/Downloads/repos/movement/util/vanity)
warning: unused import: `tracing`
  --> util/vanity/src/miner.rs:10:5
   |
10 | use tracing;
   |     ^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: unused import: `predicates::prelude`
  --> util/vanity/src/cli.rs:70:6
   |
70 |     use predicates::prelude::*;
   |         ^^^^^^^^^^^^^^^^^^^

warning: `vanity` (bin "vanity" test) generated 2 warnings (run `cargo fix --bin "vanity" --tests` to apply 1 suggestion)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 1m 22s
     Running unittests src/main.rs (target/debug/deps/vanity-c8535288652eb800)

running 5 tests
test cli::tests::test_valid_pattern ... ok
test cli::tests::test_cli_runs_with_ends ... FAILED
test cli::tests::test_cli_runs_with_starts ... FAILED
test cli::tests::test_cli_runs_with_starts_and_ends ... FAILED
test cli::tests::test_cli_parsing_starts_pattern ... ok

A couple Rust warnings in there to clean up.

Otherwise LGodlyTM. I tested it locally and it produced a valid keypair with my desired vanity address.

Copy link
Contributor

@andygolay andygolay left a comment

Choose a reason for hiding this comment

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

LGTM, I hadn't ran cargo build -p vanity first before running the tests. I did it just now and all passed.

I ran a cargo fmt to fix the Cargo Format CI failure and committed; I think this is good to merge.

pub enum Vanity {
Move {
#[clap(long)]
starts: Option<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You probably want to invalidate the case where both --starts and --ends are None. You can either do this in the implementation or use ArgGroup.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You're still not invalidating this case. Is there a reason you don't want to do this?

/// Pattern parsing errors.
#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
pub enum PatternError {
#[error("the pattern's length exceeds 39 characters or the pattern is empty")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is the case, why not make it pub struct Pattern(Box<[u8;39]>). That's a fixed-size, heap allocated byte-array with buffer that is always 39 characters and never any more.

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.

4 participants